]> git.lyx.org Git - features.git/blob - src/WorkArea.h
Some changes to compile new painter code with compaq cxx
[features.git] / src / WorkArea.h
1 // -*- C++ -*-
2 /* This file is part of
3  * ======================================================
4  * 
5  *           LyX, The Document Processor
6  *        
7  *           Copyright 1995 Matthias Ettrich
8  *           Copyright 1995-2000 The LyX Team.
9  *
10  * ======================================================*/
11
12 #ifndef WORKAREA_H
13 #define WORKAREA_H
14
15 #ifdef __GNUG__
16 #pragma interface
17 #endif
18
19 #include <utility>
20 using std::pair;
21
22 #include FORMS_H_LOCATION
23 #include "Painter.h"
24
25 class BufferView;
26
27 class WorkArea {
28 public:
29         ///
30         WorkArea(BufferView *, int xpos, int ypos, int width, int height);
31         ///
32         ~WorkArea();
33 #ifdef USE_PAINTER
34         ///
35         Painter & getPainter() { return painter_; }
36 #endif
37         ///
38         int workWidth() const { return work_area->w; }
39         ///
40         int width() const { return work_area->w + scrollbar->w; }
41         ///
42         int height() const { return work_area->h; }
43         ///
44         int xpos() const { return work_area->x; }
45         ///
46         int ypos() const { return work_area->y; }
47         ///
48         void resize(int xpos, int ypos, int width, int height);
49         ///
50         void redraw() const {
51                 fl_redraw_object(work_area);
52                 fl_redraw_object(scrollbar);
53                 fl_redraw_object(button_down);
54                 fl_redraw_object(button_up);
55         }
56         ///
57         void setFocus() const;
58         ///
59         Window getWin() const { return work_area->form->window; }
60         ///
61         bool hasFocus() const { return work_area->focus; }
62         ///
63         bool active() const { return work_area->active; }
64         ///
65         bool visible() const { return work_area->form->visible; }
66         ///
67         void greyOut() const;
68         ///
69         void setScrollbar(double pos, double length_fraction) const;
70         ///
71         void setScrollbarValue(double y) const { fl_set_slider_value(scrollbar, y); }
72         ///
73         void setScrollbarBounds(double, double) const;
74         ///
75         void setScrollbarIncrements(float inc) const;
76         ///
77         double getScrollbarValue() const {
78                 return fl_get_slider_value(scrollbar);
79         }
80         ///
81         pair<double, double> getScrollbarBounds() const {
82                 pair<double, double> p;
83                 fl_get_slider_bounds(scrollbar, &p.first, &p.second);
84                 return p;
85         }
86         ///
87         Pixmap getPixmap() const { return workareapixmap; }
88         ///
89         //Signal2<long, int> up;
90         ///
91         //Signal2<long, int> down;
92         ///
93         //Signal1<double> scroll;
94         ///
95         //Signal0 expose;
96         ///
97         //Signal3<int, int, unsigned int> buttonPress;
98         ///
99         //Signal3<int, int, unsigned int> buttonRelease;
100         ///
101         //Signal3<int, int, unsigned int> motion;
102         ///
103         //Signal0 focus;
104         ///
105         //Signal0 unfocus;
106         ///
107         //Signal0 enter;
108         ///
109         //Signal0 leave;
110         ///
111         //Signal3<int, int, unsigned int> doubleclick;
112         ///
113         //Signal3<int, int, unsigned int> trippleclick;
114         ///
115         //Signal2<Window, XEvent *> selection;
116         /// xforms callback
117         static int work_area_handler(FL_OBJECT *, int event,
118                                      FL_Coord, FL_Coord,
119                                      int /*key*/, void * xev);
120         /// xforms callback
121         static void up_cb(FL_OBJECT *, long);
122         /// xforms callback
123         static void down_cb(FL_OBJECT *, long);
124         /// xforms callback
125         static void scroll_cb(FL_OBJECT *, long);
126 private:
127         ///
128         void createPixmap(int, int);
129         ///
130         FL_OBJECT * backgroundbox;
131         ///     
132         FL_OBJECT * work_area;
133         ///
134         FL_OBJECT * scrollbar;
135         ///
136         FL_OBJECT * button_down;
137         ///
138         FL_OBJECT * button_up;
139         ///
140         BufferView * owner;
141         /// The pixmap overlay on the workarea
142         Pixmap workareapixmap;
143 #ifdef USE_PAINTER
144         ///
145         Painter painter_;
146 #endif
147         ///
148         FL_OBJECT * figinset_canvas;
149 };
150 #endif