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(
75 unsigned int iconSizeXY,
76 const std::string & geometryArg);
77 /// save the geometry state in the session manager.
78 virtual void saveGeometry();
79 virtual void setBusy(bool);
80 /// add toolbar, if newline==true, add a toolbar break before the toolbar
81 GuiToolbar * makeToolbar(ToolbarInfo const & tbinfo, bool newline);
82 virtual void updateStatusBar();
83 virtual void message(docstring const & str);
84 virtual bool hasFocus() const;
85 void updateLayoutChoice(bool force);
86 bool isToolbarVisible(std::string const & id);
87 void updateToolbars();
89 QMenu * createPopupMenu();
91 /// dispatch to current BufferView
92 void dispatch(FuncRequest const & cmd);
94 /// \return the buffer currently shown in this window
96 Buffer const * buffer() const;
97 /// set a buffer to the current workarea.
98 void setBuffer(Buffer * b); ///< \c Buffer to set.
100 /// GuiBufferDelegate.
102 void resetAutosaveTimers();
103 void errors(std::string const &);
104 void structureChanged() { updateToc(); }
108 void showDialog(std::string const & name);
109 void showDialogWithData(std::string const & name,
110 std::string const & data);
111 void showInsetDialog(std::string const & name,
112 std::string const & data, Inset * inset);
113 void updateDialog(std::string const & name,
114 std::string const & data);
116 /// called on timeout
119 void updateEmbeddedFiles();
121 /// \return the current buffer view.
124 /// get access to the dialogs
125 Dialogs & getDialogs() { return *dialogs_; }
127 Dialogs const & getDialogs() const { return *dialogs_; }
129 /// load a buffer into the current workarea.
130 Buffer * loadLyXFile(support::FileName const & name, ///< File to load.
131 bool tolastfiles = true); ///< append to the "Open recent" menu?
133 /** redraw \c inset in all the BufferViews in which it is currently
134 * visible. If successful return a pointer to the owning Buffer.
136 Buffer const * updateInset(Inset const *);
138 void restartCursor();
140 /// \return the \c Workarea associated to \p Buffer
141 /// \retval 0 if no \c WorkArea is found.
142 GuiWorkArea * workArea(Buffer & buffer);
144 /// Add a \c WorkArea
145 /// \return the \c Workarea associated to \p Buffer
146 /// \retval 0 if no \c WorkArea is found.
147 GuiWorkArea * addWorkArea(Buffer & buffer);
149 void setCurrentWorkArea(GuiWorkArea * work_area);
151 void removeWorkArea(GuiWorkArea * work_area);
152 /// return the current WorkArea (the one that has the focus).
153 GuiWorkArea const * currentWorkArea() const;
160 /// clear any temporary message and replace with current status.
165 void updateWindowTitle(GuiWorkArea * wa);
168 void on_currentWorkAreaChanged(GuiWorkArea *);
170 /// slots to change the icon size
171 void smallSizedIcons();
172 void normalSizedIcons();
173 void bigSizedIcons();
177 void addTabWorkArea();
179 /// connect to signals in the given BufferView
180 void connectBufferView(BufferView & bv);
181 /// disconnect from signals in the given BufferView
182 void disconnectBufferView();
183 /// connect to signals in the given buffer
184 void connectBuffer(Buffer & buf);
185 /// disconnect from signals in the given buffer
186 void disconnectBuffer();
190 void dragEnterEvent(QDragEnterEvent * ev);
192 void dropEvent(QDropEvent * ev);
193 /// make sure we quit cleanly
194 virtual void closeEvent(QCloseEvent * e);
196 virtual void resizeEvent(QResizeEvent * e);
198 virtual void moveEvent(QMoveEvent * e);
200 /// in order to catch Tab key press.
201 bool event(QEvent * e);
202 bool focusNextPrevChild(bool);
204 QRect updateFloatingGeometry();
206 void setIconSize(unsigned int size);
209 struct GuiViewPrivate;
213 QTimer statusbar_timer_;
215 /// are we quitting by the menu?
216 bool quitting_by_menu_;
219 QRect floatingGeometry_;
228 ToolbarSize toolbarSize_;
230 /// auto-saving of buffers
231 Timeout * const autosave_timeout_;
232 /// dialogs for this view
237 } // namespace frontend