]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiView.h
disable toolbar popup menu, this is better than the current state
[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         virtual void saveGeometry();
64         virtual void busy(bool);
65         Toolbars::ToolbarPtr makeToolbar(ToolbarBackend::Toolbar const & tbb);
66         virtual void updateStatusBar();
67         virtual void message(lyx::docstring const & str);
68         virtual void clearMessage();
69         virtual bool hasFocus() const;
70
71         virtual void updateTab();
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         void initTab(QWidget* workArea);
83
84         QMenu* createPopupMenu();
85
86 Q_SIGNALS:
87         void closing(int);
88
89 public Q_SLOTS:
90         /// idle timeout
91         void update_view_state_qt();
92
93         /// populate a toplevel menu and all its children on demand
94         void updateMenu(QAction *);
95
96         void currentTabChanged (int index); 
97
98 protected:
99         /// make sure we quit cleanly
100         virtual void closeEvent(QCloseEvent * e);
101
102         ///
103         virtual void resizeEvent(QResizeEvent * e);
104
105         ///
106         virtual void moveEvent(QMoveEvent * e);
107
108 private:
109         /// focus the command buffer widget
110         void focus_command_widget();
111
112         /**
113          * setWindowTitle - set title of window
114          * @param t main window title
115          * @param it iconified (short) title
116          */
117         virtual void setWindowTitle(lyx::docstring const & t, lyx::docstring const & it);
118
119         QTimer statusbar_timer_;
120
121         /// command buffer
122         QCommandBuffer * commandbuffer_;
123
124         ///
125         void updateFloatingGeometry();
126         ///
127         QRect floatingGeometry_;
128
129         struct GuiViewPrivate;
130         GuiViewPrivate& d;
131 };
132
133 } // namespace frontend
134 } // namespace lyx
135
136 #endif // GUIVIEW_H