]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiView.h
a1da43712b1e6f8a426576949d49bd275f2e27f8
[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 FuncRequest;
30
31 //class string;
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         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 Q_SIGNALS:
86         void closing(int);
87
88 public Q_SLOTS:
89         /// idle timeout
90         void update_view_state_qt();
91
92         /// populate a toplevel menu and all its children on demand
93         void updateMenu(QAction *);
94
95         void currentTabChanged (int index); 
96
97 protected:
98         /// make sure we quit cleanly
99         virtual void closeEvent(QCloseEvent * e);
100
101         ///
102         virtual void resizeEvent(QResizeEvent * e);
103
104         ///
105         virtual void moveEvent(QMoveEvent * e);
106
107 private:
108         /// focus the command buffer widget
109         void focus_command_widget();
110
111         /**
112          * setWindowTitle - set title of window
113          * @param t main window title
114          * @param it iconified (short) title
115          */
116         virtual void setWindowTitle(lyx::docstring const & t, lyx::docstring const & it);
117
118         QTimer statusbar_timer_;
119
120         /// command buffer
121         QCommandBuffer * commandbuffer_;
122
123         ///
124         void updateFloatingGeometry();
125         ///
126         QRect floatingGeometry_;
127
128         struct GuiViewPrivate;
129         GuiViewPrivate& d;
130 };
131
132 } // namespace frontend
133 } // namespace lyx
134
135 #endif // GUIVIEW_H