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