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