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 * ======================================================*/
19 #include FORMS_H_LOCATION
20 #include "frontends/Painter.h"
21 #include "frontends/mouse_state.h"
22 #include "frontends/key_state.h"
24 #include <boost/signals/signal0.hpp>
25 #include <boost/signals/signal1.hpp>
26 #include <boost/signals/signal2.hpp>
27 #include <boost/signals/signal3.hpp>
35 WorkArea(int xpos, int ypos, int width, int height);
39 Painter & getPainter() { return painter_; }
41 int workWidth() const { return work_area->w; }
43 int workHeight() const { return work_area->h; }
45 unsigned int width() const { return work_area->w + scrollbar->w; }
46 //unsigned int width() const { return backgroundbox->w + 15; }
48 int xpos() const { return work_area->x; }
49 //int xpos() const { return backgroundbox->x; }
51 int ypos() const { return work_area->y; }
52 //int ypos() const { return backgroundbox->y; }
54 void resize(int xpos, int ypos, int width, int height);
57 fl_redraw_object(work_area);
58 fl_redraw_object(scrollbar);
61 void setFocus() const;
63 Window getWin() const { return work_area->form->window; }
65 bool hasFocus() const { return work_area->focus; }
67 bool visible() const { return work_area->form->visible; }
71 void setScrollbar(double pos, double length_fraction) const;
73 void setScrollbarValue(double y) const {
74 fl_set_scrollbar_value(scrollbar, y);
77 void setScrollbarBounds(double, double) const;
79 void setScrollbarIncrements(double inc) const;
81 double getScrollbarValue() const {
82 return fl_get_scrollbar_value(scrollbar);
85 std::pair<float, float> const getScrollbarBounds() const {
86 std::pair<float, float> p;
87 fl_get_scrollbar_bounds(scrollbar, &p.first, &p.second);
91 Pixmap getPixmap() const { return workareapixmap; }
93 static int work_area_handler(FL_OBJECT *, int event,
95 int /*key*/, void * xev);
97 static void scroll_cb(FL_OBJECT *, long);
98 /// a selection exists
99 void haveSelection(bool) const;
101 string const getClipboard() const;
103 void putClipboard(string const &) const;
106 boost::signal0<void> workAreaExpose;
108 boost::signal1<void, double> scrollCB;
110 boost::signal2<void, KeySym, key_modifier::state> workAreaKeyPress;
112 boost::signal3<void, int, int, mouse_button::state> workAreaButtonPress;
114 boost::signal3<void, int, int, mouse_button::state> workAreaButtonRelease;
116 boost::signal3<void, int, int, mouse_button::state> workAreaMotionNotify;
118 boost::signal0<void> workAreaFocus;
120 boost::signal0<void> workAreaUnfocus;
122 boost::signal3<void, int, int, mouse_button::state> workAreaDoubleClick;
124 boost::signal3<void, int, int, mouse_button::state> workAreaTripleClick;
125 /// emitted when an X client has requested our selection
126 boost::signal0<void> selectionRequested;
127 /// emitted when another X client has stolen our selection
128 boost::signal0<void> selectionLost;
130 /// handles SelectionRequest X Event, to fill the clipboard
131 int event_cb(XEvent * xev);
134 void createPixmap(int, int);
137 FL_OBJECT * backgroundbox;
139 FL_OBJECT * work_area;
141 FL_OBJECT * scrollbar;
143 mutable FL_OBJECT * splash_;
145 mutable FL_OBJECT * splash_text_;
146 /// The pixmap overlay on the workarea
147 Pixmap workareapixmap;
150 /// if we call redraw with true needed for locking-insets