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