]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/XWorkArea.h
ws fixes, formatting and some other small changes
[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 #ifdef __GNUG__
17 #pragma interface
18 #endif
19
20 #include "frontends/WorkArea.h"
21 #include "XPainter.h"
22
23 #include FORMS_H_LOCATION
24
25 ///
26 class XWorkArea : public WorkArea {
27 public:
28         ///
29         XWorkArea(int xpos, int ypos, int width, int height);
30         ///
31         ~XWorkArea();
32         ///
33         virtual Painter & getPainter() { return painter_; }
34         ///
35         virtual int workWidth() const { return work_area->w; }
36         ///
37         virtual int workHeight() const { return work_area->h; }
38         ///
39         Window getWin() const { return work_area->form->window; }
40         ///
41         virtual void setScrollbarParams(int height, int pos, int line_height);
42         ///
43         Pixmap getPixmap() const { return workareapixmap; }
44         /// xforms callback
45         static int work_area_handler(FL_OBJECT *, int event,
46                                      FL_Coord, FL_Coord,
47                                      int /*key*/, void * xev);
48
49         /// return x position of window
50         int xpos() const { return work_area->x; }
51         /// return y position of window
52         int ypos() const { return work_area->y; }
53
54         /// xforms callback from scrollbar
55         void scroll_cb();
56         /// a selection exists
57         virtual void haveSelection(bool) const;
58         ///
59         virtual string const getClipboard() const;
60         ///
61         virtual void putClipboard(string const &) const;
62
63         /// handles SelectionRequest X Event, to fill the clipboard
64         int event_cb(XEvent * xev);
65 private:
66         /// generate the pixmap, and copy backing pixmap to it,
67         /// and send resize event if needed
68         void redraw(int, int);
69
70         /// GC used for copying to the screen
71         GC copy_gc;
72
73         ///
74         FL_OBJECT * backgroundbox;
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
89 #endif // XWORKAREA_H