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