4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Lars Gullik Bjornes
9 * \author Abdelrazak Younes
10 * \author Peter Kümmel
12 * Full author contact details are available in file CREDITS.
18 #include "frontends/LyXView.h"
20 #include <QMainWindow>
24 class QDragEnterEvent;
39 QWidget * mainWindow();
42 * GuiView - Qt4 implementation of LyXView
44 * qt4-private implementation of the main LyX window.
46 * Note: a QObject emits a destroyed(QObject *) Qt signal when it
47 * is deleted. This might be useful for closing other dialogs
48 * depending on a given GuiView.
50 class GuiView : public QMainWindow, public LyXView
54 /// create a main window of the given dimensions
61 virtual void setFocus();
64 NotMaximized = 0, // LyX::newLyXView() relies on this to be zero!
66 HorizontallyMaximized,
70 virtual void setGeometry(std::string const & geometryArg);
71 /// save the geometry state in the session manager.
72 virtual void saveGeometry();
73 virtual void setBusy(bool);
74 /// add toolbar, if newline==true, add a toolbar break before the toolbar
75 GuiToolbar * makeToolbar(ToolbarInfo const & tbinfo, bool newline);
76 virtual void updateStatusBar();
77 virtual void message(docstring const & str);
78 virtual bool hasFocus() const;
79 void updateLayoutChoice(bool force);
80 bool isToolbarVisible(std::string const & id);
81 void updateToolbars();
83 QMenu * createPopupMenu();
85 /// dispatch to current BufferView
86 void dispatch(FuncRequest const & cmd);
88 /// \return the buffer currently shown in this window
90 Buffer const * buffer() const;
91 /// set a buffer to the current workarea.
92 void setBuffer(Buffer * b); ///< \c Buffer to set.
94 /// GuiBufferDelegate.
96 void resetAutosaveTimers();
97 void errors(std::string const &);
98 void structureChanged() { updateToc(); }
102 void showDialog(std::string const & name);
103 void showDialogWithData(std::string const & name,
104 std::string const & data);
105 void showInsetDialog(std::string const & name,
106 std::string const & data, Inset * inset);
107 void updateDialog(std::string const & name,
108 std::string const & data);
110 /// called on timeout
113 void updateEmbeddedFiles();
115 /// \return the current buffer view.
118 /// get access to the dialogs
119 Dialogs & getDialogs() { return *dialogs_; }
121 Dialogs const & getDialogs() const { return *dialogs_; }
123 /// load a buffer into the current workarea.
124 Buffer * loadLyXFile(support::FileName const & name, ///< File to load.
125 bool tolastfiles = true); ///< append to the "Open recent" menu?
127 /** redraw \c inset in all the BufferViews in which it is currently
128 * visible. If successful return a pointer to the owning Buffer.
130 Buffer const * updateInset(Inset const *);
132 void restartCursor();
134 /// \return the \c Workarea associated to \p Buffer
135 /// \retval 0 if no \c WorkArea is found.
136 GuiWorkArea * workArea(Buffer & buffer);
138 /// Add a \c WorkArea
139 /// \return the \c Workarea associated to \p Buffer
140 /// \retval 0 if no \c WorkArea is found.
141 GuiWorkArea * addWorkArea(Buffer & buffer);
143 void setCurrentWorkArea(GuiWorkArea * work_area);
145 void removeWorkArea(GuiWorkArea * work_area);
146 /// return the current WorkArea (the one that has the focus).
147 GuiWorkArea const * currentWorkArea() const;
154 /// clear any temporary message and replace with current status.
159 void updateWindowTitle(GuiWorkArea * wa);
162 void on_currentWorkAreaChanged(GuiWorkArea *);
164 /// slots to change the icon size
165 void smallSizedIcons();
166 void normalSizedIcons();
167 void bigSizedIcons();
171 void addTabWorkArea();
173 /// connect to signals in the given BufferView
174 void connectBufferView(BufferView & bv);
175 /// disconnect from signals in the given BufferView
176 void disconnectBufferView();
177 /// connect to signals in the given buffer
178 void connectBuffer(Buffer & buf);
179 /// disconnect from signals in the given buffer
180 void disconnectBuffer();
184 void dragEnterEvent(QDragEnterEvent * ev);
186 void dropEvent(QDropEvent * ev);
187 /// make sure we quit cleanly
188 virtual void closeEvent(QCloseEvent * e);
190 virtual void resizeEvent(QResizeEvent * e);
192 virtual void moveEvent(QMoveEvent * e);
194 /// in order to catch Tab key press.
195 bool event(QEvent * e);
196 bool focusNextPrevChild(bool);
198 QRect updateFloatingGeometry();
200 void setIconSize(unsigned int size);
203 struct GuiViewPrivate;
207 QTimer statusbar_timer_;
209 /// are we quitting by the menu?
210 bool quitting_by_menu_;
213 QRect floatingGeometry_;
222 ToolbarSize toolbarSize_;
224 /// auto-saving of buffers
225 Timeout * const autosave_timeout_;
226 /// dialogs for this view
231 } // namespace frontend