]> git.lyx.org Git - lyx.git/blob - src/WorkArea.h
Dekels tabular/textinset patches
[lyx.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
21 #include <sigc++/signal_system.h>
22
23 #include FORMS_H_LOCATION
24 #include "Painter.h"
25
26 #ifdef SIGC_CXX_NAMESPACES
27 using SigC::Signal0;
28 using SigC::Signal1;
29 using SigC::Signal2;
30 using SigC::Signal3;
31 #endif
32
33 #if 0
34 class BufferView;
35 #endif
36
37 ///
38 class WorkArea {
39 public:
40         ///
41         WorkArea(
42 #if 0
43                 BufferView *,
44 #endif
45                 int xpos, int ypos, int width, int height);
46         ///
47         ~WorkArea();
48         ///
49         Painter & getPainter() { return painter_; }
50         ///
51         int workWidth() const { return work_area->w; }
52         ///
53         unsigned int width() const { return work_area->w + scrollbar->w; }
54         ///
55         unsigned int height() const { return work_area->h; }
56         ///
57         int xpos() const { return work_area->x; }
58         ///
59         int ypos() const { return work_area->y; }
60         ///
61         void resize(int xpos, int ypos, int width, int height);
62         ///
63         void redraw() const {
64                 fl_redraw_object(work_area);
65                 fl_redraw_object(scrollbar);
66         }
67         ///
68         void setFocus() const;
69         ///
70         Window getWin() const { return work_area->form->window; }
71         ///
72         bool hasFocus() const { return work_area->focus; }
73         ///
74         bool active() const { return work_area->active; }
75         ///
76         bool belowMouse() const;
77         ///
78         bool visible() const { return work_area->form->visible; }
79         ///
80         void greyOut() const;
81         ///
82         void setScrollbar(double pos, double length_fraction) const;
83         ///
84         void setScrollbarValue(double y) const {
85                 fl_set_scrollbar_value(scrollbar, y);
86         }
87         ///
88         void setScrollbarBounds(double, double) const;
89         ///
90         void setScrollbarIncrements(double inc) const;
91         ///
92         double getScrollbarValue() const {
93                 return fl_get_scrollbar_value(scrollbar);
94         }
95         ///
96         std::pair<float, float> const getScrollbarBounds() const {
97                 std::pair<float, float> p;
98                 fl_get_scrollbar_bounds(scrollbar, &p.first, &p.second);
99                 return p;
100         }
101         ///
102         Pixmap getPixmap() const { return workareapixmap; }
103         /// xforms callback
104         static int work_area_handler(FL_OBJECT *, int event,
105                                      FL_Coord, FL_Coord,
106                                      int /*key*/, void * xev);
107         /// xforms callback
108         static void scroll_cb(FL_OBJECT *, long);
109         ///
110         string const getClipboard() const;
111         ///
112         void putClipboard(string const &) const;
113 #if 0
114         ///
115         BufferView * owner() const { return owner_; }
116 #endif
117         // Signals
118         ///
119         Signal0<void> workAreaExpose;
120         ///
121         Signal1<void, double> scrollCB;
122         ///
123         Signal2<void, KeySym, unsigned int> workAreaKeyPress;
124         ///
125         Signal3<void, int, int, unsigned int> workAreaButtonPress;
126         ///
127         Signal3<void, int, int, unsigned int> workAreaButtonRelease;
128         ///
129         Signal3<void, int, int, unsigned int> workAreaMotionNotify;
130         ///
131         Signal0<void> workAreaFocus;
132         ///
133         Signal0<void> workAreaUnfocus;
134         ///
135         Signal0<void> workAreaEnter;
136         ///
137         Signal0<void> workAreaLeave;
138         ///
139         Signal3<void, int, int, unsigned int> workAreaDoubleClick;
140         ///
141         Signal3<void, int, int, unsigned int> workAreaTripleClick;
142 private:
143         ///
144         void createPixmap(int, int);
145         ///
146         FL_OBJECT * backgroundbox;
147         ///     
148         FL_OBJECT * work_area;
149         ///
150         FL_OBJECT * scrollbar;
151 #if 0
152         ///
153         BufferView * owner_;
154 #endif
155         /// The pixmap overlay on the workarea
156         Pixmap workareapixmap;
157         ///
158         Painter painter_;
159         ///
160         FL_OBJECT * figinset_canvas;
161         /// if we call redraw with true needed for locking-insets
162         bool screen_cleared;
163 };
164 #endif