]> git.lyx.org Git - lyx.git/blob - src/WorkArea.h
some using changes small changes in lyxfont and some other things, read the 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 using std::pair;
25
26 class BufferView;
27
28 class WorkArea {
29 public:
30         ///
31         WorkArea(BufferView *, int xpos, int ypos, int width, int height);
32         ///
33         ~WorkArea();
34         ///
35         Painter & getPainter() { return painter_; }
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 belowMouse() const;
65         ///
66         bool visible() const { return work_area->form->visible; }
67         ///
68         void greyOut() const;
69         ///
70         void setScrollbar(double pos, double length_fraction) const;
71         ///
72         void setScrollbarValue(double y) const { fl_set_slider_value(scrollbar, y); }
73         ///
74         void setScrollbarBounds(double, double) const;
75         ///
76         void setScrollbarIncrements(float inc) const;
77         ///
78         double getScrollbarValue() const {
79                 return fl_get_slider_value(scrollbar);
80         }
81         ///
82         pair<double, double> getScrollbarBounds() const {
83                 pair<double, double> p;
84                 fl_get_slider_bounds(scrollbar, &p.first, &p.second);
85                 return p;
86         }
87         ///
88         Pixmap getPixmap() const { return workareapixmap; }
89         /// xforms callback
90         static int work_area_handler(FL_OBJECT *, int event,
91                                      FL_Coord, FL_Coord,
92                                      int /*key*/, void * xev);
93         /// xforms callback
94         static void up_cb(FL_OBJECT *, long);
95         /// xforms callback
96         static void down_cb(FL_OBJECT *, long);
97         /// xforms callback
98         static void scroll_cb(FL_OBJECT *, long);
99 private:
100         ///
101         void createPixmap(int, int);
102         ///
103         FL_OBJECT * backgroundbox;
104         ///     
105         FL_OBJECT * work_area;
106         ///
107         FL_OBJECT * scrollbar;
108         ///
109         FL_OBJECT * button_down;
110         ///
111         FL_OBJECT * button_up;
112         ///
113         BufferView * owner;
114         /// The pixmap overlay on the workarea
115         Pixmap workareapixmap;
116         ///
117         Painter painter_;
118         ///
119         FL_OBJECT * figinset_canvas;
120 };
121 #endif