]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiView.h
* QLMenubar.C (macxMenuBarInit): fix workaround for menu merging
[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  * \author Peter Kümmel
11  *
12  * Full author contact details are available in file CREDITS.
13  */
14
15 #ifndef GUI_VIEW_H
16 #define GUI_VIEW_H
17
18 // Must be here because of moc.
19 #include <config.h>
20
21 #include "frontends/LyXView.h"
22 #include "funcrequest.h"
23
24 #include <QMainWindow>
25 #include <QTimer>
26 #include <QAction>
27 #include <QCloseEvent>
28
29 class QToolBar;
30 class QMenu;
31
32
33 namespace lyx {
34 namespace frontend {
35
36 class QCommandBuffer;
37
38 QWidget* mainWindow();
39
40 /**
41  * GuiView - Qt4 implementation of LyXView
42  *
43  * qt4-private implementation of the main LyX window.
44  *
45  * Note: any QObject emits a destroyed(QObject *) Qt signal when it
46  *       is deleted.This might be useful for closing other dialogs
47  *       depending on a given GuiView.
48  */
49 class GuiView : public QMainWindow, public LyXView {
50         Q_OBJECT
51 public:
52         /// create a main window of the given dimensions
53         GuiView(int id);
54
55         ~GuiView();
56
57         virtual void init();
58         virtual void close();
59         virtual void setGeometry(
60                 unsigned int width,
61                 unsigned int height,
62                 int posx, int posy,
63                 bool maximize,
64                 unsigned int iconSizeXY,
65                 const std::string & geometryArg);
66         virtual void saveGeometry();
67         virtual void busy(bool);
68         Toolbars::ToolbarPtr makeToolbar(ToolbarBackend::Toolbar const & tbb);
69         virtual void updateStatusBar();
70         virtual void message(lyx::docstring const & str);
71         virtual void clearMessage();
72         virtual bool hasFocus() const;
73
74         virtual void updateTab();
75
76         /// show - display the top-level window
77         void show();
78
79         /// add the command buffer
80         void addCommandBuffer(QToolBar * toolbar);
81
82         /// menu item has been selected
83         void activated(FuncRequest const &);
84
85         void initTab(QWidget* workArea);
86
87         QMenu* createPopupMenu();
88
89 Q_SIGNALS:
90         void closing(int);
91
92 public Q_SLOTS:
93         /// idle timeout
94         void update_view_state_qt();
95
96         /// populate a toplevel menu and all its children on demand
97         void updateMenu(QAction *);
98
99         void currentTabChanged (int index); 
100
101         /// slots to change the icon size
102         void smallSizedIcons();
103         void normalSizedIcons();
104         void bigSizedIcons();
105
106 protected:
107         /// make sure we quit cleanly
108         virtual void closeEvent(QCloseEvent * e);
109
110         ///
111         virtual void resizeEvent(QResizeEvent * e);
112
113         ///
114         virtual void moveEvent(QMoveEvent * e);
115
116 private:
117         /// focus the command buffer widget
118         void focus_command_widget();
119
120         /**
121          * setWindowTitle - set title of window
122          * @param t main window title
123          * @param it iconified (short) title
124          */
125         virtual void setWindowTitle(lyx::docstring const & t, lyx::docstring const & it);
126
127         QTimer statusbar_timer_;
128
129         /// command buffer
130         QCommandBuffer * commandbuffer_;
131
132         /// are we quitting by the menu?
133         bool quitting_by_menu_;
134
135         ///
136         void updateFloatingGeometry();
137         ///
138         QRect floatingGeometry_;
139
140         void setIconSize(unsigned int size);
141
142         struct GuiViewPrivate;
143         GuiViewPrivate& d;
144 };
145
146 } // namespace frontend
147 } // namespace lyx
148
149 #endif // GUIVIEW_H