]> git.lyx.org Git - lyx.git/blob - src/WorkArea.h
Fixed undo handling for tabular-insets and update TabularLayout on
[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         ///
33         Painter & getPainter() { return painter_; }
34         ///
35         unsigned int workWidth() const { return work_area->w; }
36         ///
37         unsigned int width() const { return work_area->w + scrollbar->w; }
38         ///
39         unsigned int height() const { return work_area->h; }
40         ///
41         int xpos() const { return work_area->x; }
42         ///
43         int ypos() const { return work_area->y; }
44         ///
45         void resize(int xpos, int ypos, int width, int height);
46         ///
47         void redraw() const {
48                 fl_redraw_object(work_area);
49                 fl_redraw_object(scrollbar);
50         }
51         ///
52         void setFocus() const;
53         ///
54         Window getWin() const { return work_area->form->window; }
55         ///
56         bool hasFocus() const { return work_area->focus; }
57         ///
58         bool active() const { return work_area->active; }
59         ///
60         bool belowMouse() const;
61         ///
62         bool visible() const { return work_area->form->visible; }
63         ///
64         void greyOut() const;
65         ///
66         void setScrollbar(double pos, double length_fraction) const;
67         ///
68         void setScrollbarValue(double y) const {
69                 fl_set_scrollbar_value(scrollbar, y);
70         }
71         ///
72         void setScrollbarBounds(double, double) const;
73         ///
74         void setScrollbarIncrements(double inc) const;
75         ///
76         double getScrollbarValue() const {
77                 return fl_get_scrollbar_value(scrollbar);
78         }
79         ///
80         std::pair<float, float> getScrollbarBounds() const {
81                 std::pair<float, float> p;
82                 fl_get_scrollbar_bounds(scrollbar, &p.first, &p.second);
83                 return p;
84         }
85         ///
86         Pixmap getPixmap() const { return workareapixmap; }
87         /// xforms callback
88         static int work_area_handler(FL_OBJECT *, int event,
89                                      FL_Coord, FL_Coord,
90                                      int /*key*/, void * xev);
91         /// xforms callback
92         static void scroll_cb(FL_OBJECT *, long);
93 private:
94         ///
95         void createPixmap(int, int);
96         ///
97         FL_OBJECT * backgroundbox;
98         ///     
99         FL_OBJECT * work_area;
100         ///
101         FL_OBJECT * scrollbar;
102         ///
103         BufferView * owner;
104         /// The pixmap overlay on the workarea
105         Pixmap workareapixmap;
106         ///
107         Painter painter_;
108         ///
109         FL_OBJECT * figinset_canvas;
110 };
111 #endif