]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/XWorkArea.h
Change glob() API to accept a dir parameter.
[lyx.git] / src / frontends / xforms / XWorkArea.h
1 // -*- C++ -*-
2 /**
3  * \file XWorkArea.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author unknown
8  * \author John Levon
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #ifndef XWORKAREA_H
14 #define XWORKAREA_H
15
16 #include "frontends/WorkArea.h"
17 #include "XPainter.h"
18
19 #include "LayoutEngine.h"
20
21 #include "lyx_forms.h"
22
23 class LyXView;
24
25 namespace lyx {
26 namespace frontend {
27
28 class XWorkArea : public WorkArea {
29 public:
30         ///
31         XWorkArea(LyXView & owner, int width, int height);
32         ///
33         ~XWorkArea();
34         ///
35         virtual Painter & getPainter() { return painter_; }
36         ///
37         virtual int workWidth() const { return work_area->w; }
38         ///
39         virtual int workHeight() const { return work_area->h; }
40         ///
41         Window getWin() const { return work_area->form->window; }
42         ///
43         virtual void setScrollbarParams(int height, int pos, int line_height);
44         ///
45         Pixmap getPixmap() const { return workareapixmap; }
46         /// xforms callback
47         static int work_area_handler(FL_OBJECT *, int event,
48                                      FL_Coord, FL_Coord,
49                                      int /*key*/, void * xev);
50
51         /// return x position of window
52         int xpos() const { return work_area->x; }
53         /// return y position of window
54         int ypos() const { return work_area->y; }
55
56         /// xforms callback from scrollbar
57         void scroll_cb();
58         /// a selection exists
59         virtual void haveSelection(bool) const;
60         ///
61         virtual std::string const getClipboard() const;
62         ///
63         virtual void putClipboard(std::string const &) const;
64
65         /// handles SelectionRequest X Event, to fill the clipboard
66         int event_cb(XEvent * xev);
67 private:
68         /// generate the pixmap, and copy backing pixmap to it,
69         /// and send resize event if needed
70         void updateGeometry(int, int);
71
72         ///
73         void paint(int x, int y, int w, int h);
74
75         /// GC used for copying to the screen
76         GC copy_gc;
77
78         /// the workarea free object
79         FL_OBJECT * work_area;
80         /// the scrollbar objcet
81         FL_OBJECT * scrollbar;
82         /// The pixmap overlay on the workarea
83         Pixmap workareapixmap;
84         /// the xforms-specific painter
85         XPainter painter_;
86         /// if we call redraw with true needed for locking-insets
87         bool screen_cleared;
88         /// the current document's height (for scrollbar)
89         int doc_height_;
90         ///
91         boost::shared_ptr<Box> wa_box_;
92         ///
93         WidgetMap widgets_;
94 };
95
96 } // namespace frontend
97 } // namespace lyx
98
99 #endif // XWORKAREA_H