2 /* This file is part of
3 * ======================================================
5 * LyX, The Document Processor
7 * Copyright 1995 Matthias Ettrich
8 * Copyright 1995-2000 The LyX Team.
10 * ======================================================*/
21 #include FORMS_H_LOCATION
26 #define USE_FL_SCROLLBAR 1
31 WorkArea(BufferView *, int xpos, int ypos, int width, int height);
35 Painter & getPainter() { return painter_; }
37 unsigned int workWidth() const { return work_area->w; }
39 unsigned int width() const { return work_area->w + scrollbar->w; }
41 unsigned int height() const { return work_area->h; }
43 int xpos() const { return work_area->x; }
45 int ypos() const { return work_area->y; }
47 void resize(int xpos, int ypos, int width, int height);
50 fl_redraw_object(work_area);
51 fl_redraw_object(scrollbar);
52 #ifndef USE_FL_SCROLLBAR
53 fl_redraw_object(button_down);
54 fl_redraw_object(button_up);
58 void setFocus() const;
60 Window getWin() const { return work_area->form->window; }
62 bool hasFocus() const { return work_area->focus; }
64 bool active() const { return work_area->active; }
66 bool belowMouse() const;
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 #ifdef USE_FL_SCROLLBAR
76 fl_set_scrollbar_value(scrollbar, y);
78 fl_set_slider_value(scrollbar, y);
82 void setScrollbarBounds(double, double) const;
84 void setScrollbarIncrements(double inc) const;
86 double getScrollbarValue() const {
87 #ifdef USE_FL_SCROLLBAR
88 return fl_get_scrollbar_value(scrollbar);
90 return fl_get_slider_value(scrollbar);
93 #ifdef USE_FL_SCROLLBAR
95 std::pair<float, float> getScrollbarBounds() const {
96 std::pair<float, float> p;
97 fl_get_scrollbar_bounds(scrollbar, &p.first, &p.second);
102 std::pair<double, double> getScrollbarBounds() const {
103 std::pair<double, double> p;
104 fl_get_slider_bounds(scrollbar, &p.first, &p.second);
109 Pixmap getPixmap() const { return workareapixmap; }
111 static int work_area_handler(FL_OBJECT *, int event,
113 int /*key*/, void * xev);
114 #ifndef USE_FL_SCROLLBAR
116 static void up_cb(FL_OBJECT *, long);
118 static void down_cb(FL_OBJECT *, long);
121 static void scroll_cb(FL_OBJECT *, long);
124 void createPixmap(int, int);
126 FL_OBJECT * backgroundbox;
128 FL_OBJECT * work_area;
130 FL_OBJECT * scrollbar;
131 #ifndef USE_FL_SCROLLBAR
133 FL_OBJECT * button_down;
135 FL_OBJECT * button_up;
139 /// The pixmap overlay on the workarea
140 Pixmap workareapixmap;
144 FL_OBJECT * figinset_canvas;