]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/XWorkArea.h
ditch FileInfo -> use boost.filesystem
[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 redraw(int, int);
71
72         /// GC used for copying to the screen
73         GC copy_gc;
74
75         /// the workarea free object
76         FL_OBJECT * work_area;
77         /// the scrollbar objcet
78         FL_OBJECT * scrollbar;
79         /// The pixmap overlay on the workarea
80         Pixmap workareapixmap;
81         /// the xforms-specific painter
82         XPainter painter_;
83         /// if we call redraw with true needed for locking-insets
84         bool screen_cleared;
85         /// the current document's height (for scrollbar)
86         int doc_height_;
87         ///
88         boost::shared_ptr<Box> wa_box_;
89         ///
90         WidgetMap widgets_;
91 };
92
93 } // namespace frontend
94 } // namespace lyx
95
96 #endif // XWORKAREA_H