]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/QtView.h
load and restore correct windows postion
[lyx.git] / src / frontends / qt4 / QtView.h
1 // -*- C++ -*-
2 /**
3  * \file QtView.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 QTVIEW_H
15 #define QTVIEW_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  * QtView - Qt implementation of LyXView
43  *
44  * Qt-private implementation of the main LyX window.
45  */
46 class QtView : public QMainWindow, public LyXView {
47         Q_OBJECT
48 public:
49         /// create a main window of the given dimensions
50         QtView(unsigned int w, unsigned int h);
51
52         ~QtView();
53
54         /// show - display the top-level window
55         void show();
56
57         /// show busy cursor
58         virtual void busy(bool) const;
59
60         /// display a status message
61         virtual void message(std::string const & str);
62
63         /// clear status message
64         virtual void clearMessage();
65
66         /// add the command buffer
67         void addCommandBuffer(QToolBar * toolbar);
68
69         /// menu item has been selected
70         void activated(FuncRequest const &);
71
72         // returns true if this view has the focus.
73         virtual bool hasFocus() const;
74
75         static QMainWindow* mainWidget();
76
77 public slots:
78         /// idle timeout
79         void update_view_state_qt();
80
81         /// populate a toplevel menu and all its children on demand
82         void updateMenu(QAction *);
83
84 protected:
85         /// make sure we quit cleanly
86         virtual void closeEvent(QCloseEvent * e);
87 private:
88         /// focus the command buffer widget
89         void focus_command_widget();
90
91         /// update status bar
92         void update_view_state();
93
94         /**
95          * setWindowTitle - set title of window
96          * @param t main window title
97          * @param it iconified (short) title
98          */
99         virtual void setWindowTitle(std::string const & t, std::string const & it);
100
101         QTimer statusbar_timer_;
102
103         /// command buffer
104         QCommandBuffer * commandbuffer_;
105
106         ///
107         static QMainWindow* mainWidget_;
108 };
109
110 } // namespace frontend
111 } // namespace lyx
112
113 #endif // QTVIEW_H