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 unsigned int width() const { return work_area->w + scrollbar->w; }
44 //unsigned int width() const { return backgroundbox->w + 15; }
46 unsigned int height() const { return work_area->h; }
47 //unsigned int height() const { return backgroundbox->h; }
49 int xpos() const { return work_area->x; }
50 //int xpos() const { return backgroundbox->x; }
52 int ypos() const { return work_area->y; }
53 //int ypos() const { return backgroundbox->y; }
55 void resize(int xpos, int ypos, int width, int height);
58 fl_redraw_object(work_area);
59 fl_redraw_object(scrollbar);
62 void setFocus() const;
64 Window getWin() const { return work_area->form->window; }
66 bool hasFocus() const { return work_area->focus; }
68 bool visible() const { return work_area->form->visible; }
72 void setScrollbar(double pos, double length_fraction) const;
74 void setScrollbarValue(double y) const {
75 fl_set_scrollbar_value(scrollbar, y);
78 void setScrollbarBounds(double, double) const;
80 void setScrollbarIncrements(double inc) const;
82 double getScrollbarValue() const {
83 return fl_get_scrollbar_value(scrollbar);
86 std::pair<float, float> const getScrollbarBounds() const {
87 std::pair<float, float> p;
88 fl_get_scrollbar_bounds(scrollbar, &p.first, &p.second);
92 Pixmap getPixmap() const { return workareapixmap; }
94 static int work_area_handler(FL_OBJECT *, int event,
96 int /*key*/, void * xev);
98 static void scroll_cb(FL_OBJECT *, long);
99 /// a selection exists
100 void haveSelection(bool) const;
102 string const getClipboard() const;
104 void putClipboard(string const &) const;
107 boost::signal0<void> workAreaExpose;
109 boost::signal1<void, double> scrollCB;
111 boost::signal2<void, KeySym, key_modifier::state> workAreaKeyPress;
113 boost::signal3<void, int, int, mouse_button::state> workAreaButtonPress;
115 boost::signal3<void, int, int, mouse_button::state> workAreaButtonRelease;
117 boost::signal3<void, int, int, mouse_button::state> workAreaMotionNotify;
119 boost::signal0<void> workAreaFocus;
121 boost::signal0<void> workAreaUnfocus;
123 boost::signal0<void> workAreaEnter;
125 boost::signal0<void> workAreaLeave;
127 boost::signal3<void, int, int, mouse_button::state> workAreaDoubleClick;
129 boost::signal3<void, int, int, mouse_button::state> workAreaTripleClick;
130 /// emitted when an X client has requested our selection
131 boost::signal0<void> selectionRequested;
132 /// emitted when another X client has stolen our selection
133 boost::signal0<void> selectionLost;
135 /// handles SelectionRequest X Event, to fill the clipboard
136 int event_cb(XEvent * xev);
139 void createPixmap(int, int);
142 FL_OBJECT * backgroundbox;
144 FL_OBJECT * work_area;
146 FL_OBJECT * scrollbar;
148 mutable FL_OBJECT * splash_;
150 mutable FL_OBJECT * splash_text_;
151 /// The pixmap overlay on the workarea
152 Pixmap workareapixmap;
155 /// if we call redraw with true needed for locking-insets