]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiView.h
* Gui.h: new closeAll() pure virtual method.
[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  * Note: any QObject emits a destroyed(QObject *) Qt signal when it
47  *       is deleted.This might be useful for closing other dialogs
48  *       depending on a given GuiView.
49  */
50 class GuiView : public QMainWindow, public LyXView {
51         Q_OBJECT
52 public:
53         /// create a main window of the given dimensions
54         GuiView(int id);
55
56         ~GuiView();
57
58         virtual void init();
59         virtual void close();
60         virtual void setGeometry(
61                 unsigned int width,
62                 unsigned int height,
63                 int posx, int posy,
64                 bool maximize);
65         virtual void saveGeometry();
66         virtual void busy(bool) const;
67         Toolbars::ToolbarPtr makeToolbar(ToolbarBackend::Toolbar const & tbb);
68         virtual void updateStatusBar();
69         virtual void message(lyx::docstring const & str);
70         virtual void clearMessage();
71         virtual bool hasFocus() const;
72
73         /// show - display the top-level window
74         void show();
75
76         /// add the command buffer
77         void addCommandBuffer(QToolBar * toolbar);
78
79         /// menu item has been selected
80         void activated(FuncRequest const &);
81
82
83 Q_SIGNALS:
84         void closing(int);
85
86 public Q_SLOTS:
87         /// idle timeout
88         void update_view_state_qt();
89
90         /// populate a toplevel menu and all its children on demand
91         void updateMenu(QAction *);
92
93 protected:
94         /// make sure we quit cleanly
95         virtual void closeEvent(QCloseEvent * e);
96
97         ///
98         virtual void resizeEvent(QResizeEvent * e);
99
100         ///
101         virtual void moveEvent(QMoveEvent * e);
102
103 private:
104         /// focus the command buffer widget
105         void focus_command_widget();
106
107         /**
108          * setWindowTitle - set title of window
109          * @param t main window title
110          * @param it iconified (short) title
111          */
112         virtual void setWindowTitle(lyx::docstring const & t, lyx::docstring const & it);
113
114         QTimer statusbar_timer_;
115
116         /// command buffer
117         QCommandBuffer * commandbuffer_;
118
119         ///
120         void updateFloatingGeometry();
121         ///
122         QRect floatingGeometry_;
123 };
124
125 } // namespace frontend
126 } // namespace lyx
127
128 #endif // GUIVIEW_H