]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiView.h
delete unneeded Menubar virtual interface.
[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 #include "frontends/LyXView.h"
19 #include "FuncRequest.h"
20
21 #include <QAction>
22 #include <QCloseEvent>
23 #include <QMainWindow>
24 #include <QTimer>
25
26 class QDragEnterEvent;
27 class QDropEvent;
28 class QMenu;
29 class QToolBar;
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 setFocus();
59         virtual void setGeometry(
60                 unsigned int width,
61                 unsigned int height,
62                 int posx, int posy,
63                 int maximized,
64                 unsigned int iconSizeXY,
65                 const std::string & geometryArg);
66         virtual void saveGeometry();
67         virtual void busy(bool);
68         /// add toolbar, if newline==true, add a toolbar break before the toolbar
69         Toolbars::ToolbarPtr makeToolbar(ToolbarInfo const & tbinfo, bool newline);
70         virtual void updateStatusBar();
71         virtual void message(docstring const & str);
72         virtual void clearMessage();
73         virtual bool hasFocus() const;
74         void showMiniBuffer(bool);
75         void openMenu(docstring const &);
76
77         /// show - display the top-level window
78         void show();
79
80         /// add the command buffer
81         void addCommandBuffer(QToolBar * toolbar);
82
83         /// menu item has been selected
84         void activated(FuncRequest const &);
85
86         QMenu* createPopupMenu();
87
88 Q_SIGNALS:
89         void closing(int);
90
91 public Q_SLOTS:
92         /// idle timeout
93         void update_view_state_qt();
94
95         void currentTabChanged(int index);
96         void closeCurrentTab();
97
98         /// slots to change the icon size
99         void smallSizedIcons();
100         void normalSizedIcons();
101         void bigSizedIcons();
102
103 protected:
104         /// make sure we quit cleanly
105         virtual void closeEvent(QCloseEvent * e);
106
107         ///
108         virtual void resizeEvent(QResizeEvent * e);
109
110         ///
111         virtual void moveEvent(QMoveEvent * e);
112
113         /// \return the \c Workarea associated to \p  Buffer
114         /// \retval 0 if no \c WorkArea is found.
115         WorkArea * workArea(Buffer & buffer);
116
117         /// Add a \c WorkArea 
118         /// \return the \c Workarea associated to \p  Buffer
119         /// \retval 0 if no \c WorkArea is found.
120         WorkArea * addWorkArea(Buffer & buffer);
121         void setCurrentWorkArea(WorkArea * work_area);
122         void removeWorkArea(WorkArea * work_area);
123         WorkArea const * currentWorkArea() const;
124         WorkArea * currentWorkArea();
125
126 private:
127         ///
128         void dragEnterEvent(QDragEnterEvent * ev);
129         ///
130         void dropEvent(QDropEvent * ev);
131
132         /**
133          * setWindowTitle - set title of window
134          * @param t main window title
135          * @param it iconified (short) title
136          */
137         virtual void setWindowTitle(docstring const & t, docstring const & it);
138
139         /// in order to catch Tab key press.
140         bool event(QEvent * e);
141         bool focusNextPrevChild(bool);
142
143         QTimer statusbar_timer_;
144
145         /// command buffer
146         QCommandBuffer * commandbuffer_;
147
148         /// are we quitting by the menu?
149         bool quitting_by_menu_;
150
151         ///
152         QRect updateFloatingGeometry();
153         ///
154         QRect floatingGeometry_;
155
156         void setIconSize(unsigned int size);
157
158         struct ToolbarSize {
159                 int top_width;
160                 int bottom_width;
161                 int left_height;
162                 int right_height;
163         };
164
165         ToolbarSize toolbarSize_;
166
167         struct GuiViewPrivate;
168         GuiViewPrivate& d;
169 };
170
171 } // namespace frontend
172 } // namespace lyx
173
174 #endif // GUIVIEW_H