]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/XFormsView.h
ed08ddb24a770a0799a4e32dd410d1bc550efd34
[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         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         static int atCloseMainFormCB(FL_FORM *, void *);
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 private:
83         /**
84          * setWindowTitle - set title of window
85          * @param t main window title
86          * @param it iconified (short) title
87          */
88         virtual void setWindowTitle(std::string const & t, std::string const & it);
89
90         /// update the minibuffer state message
91         void show_view_state();
92
93         /// The top-most box of the layout engine containing all other boxes.
94         Box window_;
95
96         // Accessors to the various Boxes.
97         std::map<Position, Box *> box_map_;
98
99         /// the minibuffer
100         boost::scoped_ptr<XMiniBuffer> minibuffer_;
101         ///
102         boost::signals::connection view_state_con;
103         ///
104         boost::signals::connection focus_con;
105         ///
106         boost::signals::connection redraw_con;
107
108         /// the main form.
109         FL_FORM * form_;
110         /// Passed to the window manager to give a pretty little symbol ;-)
111         Pixmap icon_pixmap_;
112         ///
113         Pixmap icon_mask_;
114 };
115
116 } // namespace frontend
117 } // namespace lyx
118
119 #endif