]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/XWorkArea.h
Pass LyxView & to the WorkArea.
[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 "lyx_forms.h"
20
21 class LyXView;
22
23 ///
24 class XWorkArea : public WorkArea {
25 public:
26         ///
27         XWorkArea(LyXView & owner, int xpos, int ypos, int width, int height);
28         ///
29         ~XWorkArea();
30         ///
31         virtual Painter & getPainter() { return painter_; }
32         ///
33         virtual int workWidth() const { return work_area->w; }
34         ///
35         virtual int workHeight() const { return work_area->h; }
36         ///
37         Window getWin() const { return work_area->form->window; }
38         ///
39         virtual void setScrollbarParams(int height, int pos, int line_height);
40         ///
41         Pixmap getPixmap() const { return workareapixmap; }
42         /// xforms callback
43         static int work_area_handler(FL_OBJECT *, int event,
44                                      FL_Coord, FL_Coord,
45                                      int /*key*/, void * xev);
46
47         /// return x position of window
48         int xpos() const { return work_area->x; }
49         /// return y position of window
50         int ypos() const { return work_area->y; }
51
52         /// xforms callback from scrollbar
53         void scroll_cb();
54         /// a selection exists
55         virtual void haveSelection(bool) const;
56         ///
57         virtual std::string const getClipboard() const;
58         ///
59         virtual void putClipboard(std::string const &) const;
60
61         /// handles SelectionRequest X Event, to fill the clipboard
62         int event_cb(XEvent * xev);
63 private:
64         /// generate the pixmap, and copy backing pixmap to it,
65         /// and send resize event if needed
66         void redraw(int, int);
67
68         /// GC used for copying to the screen
69         GC copy_gc;
70
71         /// the workarea free object
72         FL_OBJECT * work_area;
73         /// the scrollbar objcet
74         FL_OBJECT * scrollbar;
75         /// The pixmap overlay on the workarea
76         Pixmap workareapixmap;
77         /// the xforms-specific painter
78         XPainter painter_;
79         /// if we call redraw with true needed for locking-insets
80         bool screen_cleared;
81         /// the current document's height (for scrollbar)
82         int doc_height_;
83 };
84
85 #endif // XWORKAREA_H