2 /* This file is part of
3 * ======================================================
5 * LyX, The Document Processor
7 * Copyright 1995 Matthias Ettrich
8 * Copyright 1995-2001 The LyX Team.
10 * ======================================================*/
21 #include <sigc++/signal_system.h>
23 #include FORMS_H_LOCATION
24 #include "frontends/Painter.h"
25 #include "frontends/mouse_state.h"
26 #include "frontends/key_state.h"
32 WorkArea(int xpos, int ypos, int width, int height);
36 Painter & getPainter() { return painter_; }
38 int workWidth() const { return work_area->w; }
40 unsigned int width() const { return work_area->w + scrollbar->w; }
41 //unsigned int width() const { return backgroundbox->w + 15; }
43 unsigned int height() const { return work_area->h; }
44 //unsigned int height() const { return backgroundbox->h; }
46 int xpos() const { return work_area->x; }
47 //int xpos() const { return backgroundbox->x; }
49 int ypos() const { return work_area->y; }
50 //int ypos() const { return backgroundbox->y; }
52 void resize(int xpos, int ypos, int width, int height);
55 fl_redraw_object(work_area);
56 fl_redraw_object(scrollbar);
59 void setFocus() const;
61 Window getWin() const { return work_area->form->window; }
63 bool hasFocus() const { return work_area->focus; }
65 bool active() const { return work_area->active; }
67 bool belowMouse() const;
69 bool visible() const { return work_area->form->visible; }
73 void setScrollbar(double pos, double length_fraction) const;
75 void setScrollbarValue(double y) const {
76 fl_set_scrollbar_value(scrollbar, y);
79 void setScrollbarBounds(double, double) const;
81 void setScrollbarIncrements(double inc) const;
83 double getScrollbarValue() const {
84 return fl_get_scrollbar_value(scrollbar);
87 std::pair<float, float> const getScrollbarBounds() const {
88 std::pair<float, float> p;
89 fl_get_scrollbar_bounds(scrollbar, &p.first, &p.second);
93 Pixmap getPixmap() const { return workareapixmap; }
95 static int work_area_handler(FL_OBJECT *, int event,
97 int /*key*/, void * xev);
99 static void scroll_cb(FL_OBJECT *, long);
100 /// a selection exists
101 void haveSelection(bool) const;
103 string const getClipboard() const;
105 void putClipboard(string const &) const;
108 SigC::Signal0<void> workAreaExpose;
110 SigC::Signal1<void, double> scrollCB;
112 SigC::Signal2<void, KeySym, key_modifier::state> workAreaKeyPress;
114 SigC::Signal3<void, int, int, mouse_button::state> workAreaButtonPress;
116 SigC::Signal3<void, int, int, mouse_button::state> workAreaButtonRelease;
118 SigC::Signal3<void, int, int, mouse_button::state> workAreaMotionNotify;
120 SigC::Signal0<void> workAreaFocus;
122 SigC::Signal0<void> workAreaUnfocus;
124 SigC::Signal0<void> workAreaEnter;
126 SigC::Signal0<void> workAreaLeave;
128 SigC::Signal3<void, int, int, mouse_button::state> workAreaDoubleClick;
130 SigC::Signal3<void, int, int, mouse_button::state> workAreaTripleClick;
131 /// emitted when an X client has requested our selection
132 SigC::Signal0<void> selectionRequested;
133 /// emitted when another X client has stolen our selection
134 SigC::Signal0<void> selectionLost;
136 /// handles SelectionRequest X Event, to fill the clipboard
137 int event_cb(XEvent * xev);
140 void createPixmap(int, int);
143 FL_OBJECT * backgroundbox;
145 FL_OBJECT * work_area;
147 FL_OBJECT * scrollbar;
149 mutable FL_OBJECT * splash_;
151 mutable FL_OBJECT * splash_text_;
152 /// The pixmap overlay on the workarea
153 Pixmap workareapixmap;
156 /// if we call redraw with true needed for locking-insets