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