]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/XWorkArea.h
*duck*
[lyx.git] / src / frontends / xforms / XWorkArea.h
1 // -*- C++ -*-
2 /**
3  * \file XWorkArea.h
4  * Copyright 1995-2002 the LyX Team
5  * Read the file COPYING
6  *
7  * \author unknown
8  * \author John Levon <moz@compsoc.man.ac.uk>
9  */
10
11 #ifndef XWORKAREA_H
12 #define XWORKAREA_H
13
14 #ifdef __GNUG__
15 #pragma interface
16 #endif
17
18 #include "frontends/WorkArea.h"
19 #include "XPainter.h"
20
21 #include FORMS_H_LOCATION
22
23 ///
24 class XWorkArea : public WorkArea {
25 public:
26         ///
27         XWorkArea(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         virtual unsigned int width() const { return work_area->w + scrollbar->w; }
38         ///
39         virtual int xpos() const { return work_area->x; }
40         ///
41         virtual int ypos() const { return work_area->y; }
42         ///
43         virtual void resize(int xpos, int ypos, int width, int height);
44         ///
45         virtual void redraw() const {
46                 fl_redraw_object(work_area);
47                 fl_redraw_object(scrollbar);
48         }
49         ///
50         virtual void setFocus() const;
51         ///
52         Window getWin() const { return work_area->form->window; }
53         ///
54         virtual bool hasFocus() const { return work_area->focus; }
55         ///
56         virtual bool visible() const { return work_area->form->visible; }
57         ///
58         virtual void greyOut() const;
59         ///
60         virtual void setScrollbarParams(int height, int pos, int line_height);
61         ///
62         Pixmap getPixmap() const { return workareapixmap; }
63         /// xforms callback
64         static int work_area_handler(FL_OBJECT *, int event,
65                                      FL_Coord, FL_Coord,
66                                      int /*key*/, void * xev);
67  
68         /// xforms callback from scrollbar
69         void scroll_cb();
70         /// a selection exists
71         virtual void haveSelection(bool) const;
72         ///
73         virtual string const getClipboard() const;
74         ///
75         virtual void putClipboard(string const &) const;
76
77         /// handles SelectionRequest X Event, to fill the clipboard
78         int event_cb(XEvent * xev);
79 private:
80         ///
81         void createPixmap(int, int);
82
83         ///
84         FL_OBJECT * backgroundbox;
85         ///
86         FL_OBJECT * work_area;
87         ///
88         FL_OBJECT * scrollbar;
89         ///
90         mutable FL_OBJECT * splash_;
91         ///
92         mutable FL_OBJECT * splash_text_;
93         /// The pixmap overlay on the workarea
94         Pixmap workareapixmap;
95         ///
96         XPainter painter_;
97         /// if we call redraw with true needed for locking-insets
98         bool screen_cleared;
99         /// the current document's height (for scrollbar)
100         int doc_height_;
101 };
102  
103 #endif // XWORKAREA_H