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