]> git.lyx.org Git - features.git/blob - src/frontends/xforms/XFormsView.h
This is the merging of the GUI API cleanup branch that was developed in svn+ssh:...
[features.git] / src / frontends / xforms / XFormsView.h
1 // -*- C++ -*-
2 /**
3  * \file XFormsView.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  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef LyXView_H
13 #define LyXView_H
14
15 #include "GuiImplementation.h"
16 #include "LayoutEngine.h"
17 #include "forms_fwd.h"
18
19 #include "frontends/LyXView.h"
20 #include <X11/Xlib.h> // for Pixmap
21
22 #include <boost/signal.hpp>
23
24 #include <map>
25
26 namespace lyx {
27 namespace frontend {
28
29 class XMiniBuffer;
30
31 /**
32  * XFormsView - xforms implementation of LyXView
33  *
34  * xforms-private implementation of the main LyX window.
35  */
36 class XFormsView : public LyXView {
37 public:
38         enum Position {
39                 Top,
40                 Bottom,
41                 Left,
42                 Right,
43                 Center
44         };
45
46         /// create a main window of the given dimensions
47         XFormsView(int w, int h);
48
49         ~XFormsView();
50
51         /// Accessor to the appropriate layout Box.
52         boost::shared_ptr<Box> getBox(Position pos) const;
53
54         /**
55          * show - display the top-level window
56          * @param xpos requested x position (or 0)
57          * @param xpos requested y position (or 0)
58          * @param title window title
59          */
60         void show(int xpos, int ypos, std::string const & t = std::string("LyX"));
61
62         /// get the xforms main form
63         FL_FORM * getForm() const;
64         /// redraw the main form.
65         virtual void redraw();
66         /// show busy cursor
67         virtual void busy(bool) const;
68
69         /// callback for close event from window manager
70         int atCloseMainFormCB();
71
72         /// display a status message
73         virtual void message(std::string const & str);
74
75         /// clear back to normal status message
76         virtual void clearMessage();
77
78         ///
79         void updateMetrics(bool resize_form = false);
80         ///
81         boost::signal<void()> metricsUpdated;
82
83         // returns true if this view has the focus.
84         virtual bool hasFocus() const;
85
86         ///
87         Gui & gui() { return frontend_; }
88
89 private:
90         /**
91          * setWindowTitle - set title of window
92          * @param t main window title
93          * @param it iconified (short) title
94          */
95         virtual void setWindowTitle(std::string const & t, std::string const & it);
96
97         /// update the minibuffer state message
98         void show_view_state();
99
100         /// The top-most box of the layout engine containing all other boxes.
101         Box window_;
102
103         typedef std::map<Position, boost::shared_ptr<Box> > BoxMap;
104
105         // Accessors to the various Boxes.
106         BoxMap box_map_;
107
108         /// the minibuffer
109         boost::scoped_ptr<XMiniBuffer> minibuffer_;
110         ///
111         boost::signals::connection view_state_con;
112         ///
113         boost::signals::connection focus_con;
114         ///
115         boost::signals::connection redraw_con;
116
117         /// the main form.
118         FL_FORM * form_;
119         /// Passed to the window manager to give a pretty little symbol ;-)
120         Pixmap icon_pixmap_;
121         ///
122         Pixmap icon_mask_;
123         ///
124         GuiImplementation frontend_;
125 };
126
127 } // namespace frontend
128 } // namespace lyx
129
130 #endif