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