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