]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiView.h
fix: qt3/qt4 save/restore of the window geometry and maximize status
[lyx.git] / src / frontends / qt4 / GuiView.h
1 // -*- C++ -*-
2 /**
3  * \file GuiView.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Lars Gullik Bjornes
8  * \author John Levon
9  * \author Abdelrazak Younes
10  *
11  * Full author contact details are available in file CREDITS.
12  */
13
14 #ifndef GUIVIEW_H
15 #define GUIVIEW_H
16
17 // Must be here because of moc.
18 #include <config.h>
19
20 #include "GuiImplementation.h"
21
22 #include "frontends/LyXView.h"
23 #include "funcrequest.h"
24
25 #include <QMainWindow>
26 #include <QTimer>
27 #include <QAction>
28 #include <QCloseEvent>
29
30 class QToolBar;
31
32 //class FuncRequest;
33
34 //class string;
35
36 namespace lyx {
37 namespace frontend {
38
39 class QCommandBuffer;
40
41 QWidget* mainWindow();
42
43 /**
44  * GuiView - Qt4 implementation of LyXView
45  *
46  * Qt-private implementation of the main LyX window.
47  */
48 class GuiView : public QMainWindow, public LyXView {
49         Q_OBJECT
50 public:
51         /// create a main window
52         GuiView();
53
54         ~GuiView();
55
56         /// show - display the top-level window
57         void show();
58
59         /// show busy cursor
60         virtual void busy(bool) const;
61
62         /// display a status message
63         virtual void message(std::string const & str);
64
65         /// clear status message
66         virtual void clearMessage();
67
68         /// add the command buffer
69         void addCommandBuffer(QToolBar * toolbar);
70
71         /// menu item has been selected
72         void activated(FuncRequest const &);
73
74         // returns true if this view has the focus.
75         virtual bool hasFocus() const;
76
77         //
78         Gui & gui() { return frontend_; }
79
80         static QMainWindow* mainWidget();
81
82 public slots:
83         /// idle timeout
84         void update_view_state_qt();
85
86         /// populate a toplevel menu and all its children on demand
87         void updateMenu(QAction *);
88
89 protected:
90         /// make sure we quit cleanly
91         virtual void closeEvent(QCloseEvent * e);
92
93         ///
94         virtual void resizeEvent(QResizeEvent * e);
95
96         ///
97         virtual void moveEvent(QMoveEvent * e);
98
99 private:
100         /// focus the command buffer widget
101         void focus_command_widget();
102
103         /// update status bar
104         void update_view_state();
105
106         /**
107          * setWindowTitle - set title of window
108          * @param t main window title
109          * @param it iconified (short) title
110          */
111         virtual void setWindowTitle(std::string const & t, std::string const & it);
112
113         QTimer statusbar_timer_;
114
115         /// command buffer
116         QCommandBuffer * commandbuffer_;
117
118         ///
119         static QMainWindow* mainWidget_;
120
121         GuiImplementation frontend_;
122
123         ///
124         void updateFloatingGeometry();
125         ///
126         QRect floatingGeometry_;
127 };
128
129 } // namespace frontend
130 } // namespace lyx
131
132 #endif // GUIVIEW_H