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();
62 virtual void setGeometry(
67 unsigned int iconSizeXY,
68 const std::string & geometryArg);
69 /// save the geometry state in the session manager.
70 virtual void saveGeometry();
71 virtual void setBusy(bool);
72 /// add toolbar, if newline==true, add a toolbar break before the toolbar
73 GuiToolbar * makeToolbar(ToolbarInfo const & tbinfo, bool newline);
74 virtual void updateStatusBar();
75 virtual void message(docstring const & str);
76 virtual bool hasFocus() const;
77 void showMiniBuffer(bool);
78 void updateLayoutChoice(bool force);
79 bool isToolbarVisible(std::string const & id);
80 void updateToolbars();
82 QMenu * createPopupMenu();
84 /// dispatch to current BufferView
85 void dispatch(FuncRequest const & cmd);
87 /// \return the buffer currently shown in this window
89 Buffer const * buffer() const;
90 /// set a buffer to the current workarea.
91 void setBuffer(Buffer * b); ///< \c Buffer to set.
93 /// GuiBufferDelegate.
95 void resetAutosaveTimers();
96 void errors(std::string const &);
97 void structureChanged() { updateToc(); }
101 void showDialog(std::string const & name);
102 void showDialogWithData(std::string const & name,
103 std::string const & data);
104 void showInsetDialog(std::string const & name,
105 std::string const & data, Inset * inset);
106 void updateDialog(std::string const & name,
107 std::string const & data);
109 /// called on timeout
112 void updateEmbeddedFiles();
114 /// \return the current buffer view.
117 /// get access to the dialogs
118 Dialogs & getDialogs() { return *dialogs_; }
120 Dialogs const & getDialogs() const { return *dialogs_; }
122 /// load a buffer into the current workarea.
123 Buffer * loadLyXFile(support::FileName const & name, ///< File to load.
124 bool tolastfiles = true); ///< append to the "Open recent" menu?
126 /** redraw \c inset in all the BufferViews in which it is currently
127 * visible. If successful return a pointer to the owning Buffer.
129 Buffer const * updateInset(Inset const *);
131 void restartCursor();
133 /// \return the \c Workarea associated to \p Buffer
134 /// \retval 0 if no \c WorkArea is found.
135 GuiWorkArea * workArea(Buffer & buffer);
137 /// Add a \c WorkArea
138 /// \return the \c Workarea associated to \p Buffer
139 /// \retval 0 if no \c WorkArea is found.
140 GuiWorkArea * addWorkArea(Buffer & buffer);
142 void setCurrentWorkArea(GuiWorkArea * work_area);
144 void removeWorkArea(GuiWorkArea * work_area);
145 /// return the current WorkArea (the one that has the focus).
146 GuiWorkArea const * currentWorkArea() const;
153 /// clear any temporary message and replace with current status.
158 void updateWindowTitle(GuiWorkArea * wa);
161 void on_currentWorkAreaChanged(GuiWorkArea *);
163 /// slots to change the icon size
164 void smallSizedIcons();
165 void normalSizedIcons();
166 void bigSizedIcons();
170 void addTabWorkArea();
172 /// connect to signals in the given BufferView
173 void connectBufferView(BufferView & bv);
174 /// disconnect from signals in the given BufferView
175 void disconnectBufferView();
176 /// connect to signals in the given buffer
177 void connectBuffer(Buffer & buf);
178 /// disconnect from signals in the given buffer
179 void disconnectBuffer();
183 void dragEnterEvent(QDragEnterEvent * ev);
185 void dropEvent(QDropEvent * ev);
186 /// make sure we quit cleanly
187 virtual void closeEvent(QCloseEvent * e);
189 virtual void resizeEvent(QResizeEvent * e);
191 virtual void moveEvent(QMoveEvent * e);
193 /// in order to catch Tab key press.
194 bool event(QEvent * e);
195 bool focusNextPrevChild(bool);
197 QRect updateFloatingGeometry();
199 void setIconSize(unsigned int size);
201 /// toggle toolbar state
202 void toggleToolbarState(std::string const & name, bool allowauto);
205 struct GuiViewPrivate;
209 QTimer statusbar_timer_;
211 /// are we quitting by the menu?
212 bool quitting_by_menu_;
215 QRect floatingGeometry_;
224 ToolbarSize toolbarSize_;
226 /// auto-saving of buffers
227 Timeout * const autosave_timeout_;
228 /// dialogs for this view
233 } // namespace frontend