]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiView.h
new LFUN_WINDOW_CLOSE
[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 GUI_VIEW_H
15 #define GUI_VIEW_H
16
17 // Must be here because of moc.
18 #include <config.h>
19
20 #include "frontends/LyXView.h"
21 #include "funcrequest.h"
22
23 #include <QMainWindow>
24 #include <QTimer>
25 #include <QAction>
26 #include <QCloseEvent>
27
28 class QToolBar;
29
30 //class FuncRequest;
31
32 //class string;
33
34 namespace lyx {
35 namespace frontend {
36
37 class QCommandBuffer;
38
39 QWidget* mainWindow();
40
41 /**
42  * GuiView - Qt4 implementation of LyXView
43  *
44  * qt4-private implementation of the main LyX window.
45  */
46 class GuiView : public QMainWindow, public LyXView {
47         Q_OBJECT
48 public:
49         /// create a main window of the given dimensions
50         GuiView(int id);
51
52         ~GuiView();
53
54         virtual void init();
55         virtual void close();
56         virtual void setGeometry(
57                 unsigned int width,
58                 unsigned int height,
59                 int posx, int posy,
60                 bool maximize);
61         virtual void saveGeometry();
62         virtual void busy(bool) const;
63         Toolbars::ToolbarPtr makeToolbar(ToolbarBackend::Toolbar const & tbb);
64         virtual void updateStatusBar();
65         virtual void message(lyx::docstring const & str);
66         virtual void clearMessage();
67         virtual bool hasFocus() const;
68
69         /// show - display the top-level window
70         void show();
71
72         /// add the command buffer
73         void addCommandBuffer(QToolBar * toolbar);
74
75         /// menu item has been selected
76         void activated(FuncRequest const &);
77
78
79 Q_SIGNALS:
80         void closing(int);
81
82 public Q_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         /**
104          * setWindowTitle - set title of window
105          * @param t main window title
106          * @param it iconified (short) title
107          */
108         virtual void setWindowTitle(lyx::docstring const & t, lyx::docstring const & it);
109
110         QTimer statusbar_timer_;
111
112         /// command buffer
113         QCommandBuffer * commandbuffer_;
114
115         ///
116         void updateFloatingGeometry();
117         ///
118         QRect floatingGeometry_;
119 };
120
121 } // namespace frontend
122 } // namespace lyx
123
124 #endif // GUIVIEW_H