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;
38 QWidget * mainWindow();
41 * GuiView - Qt4 implementation of LyXView
43 * qt4-private implementation of the main LyX window.
45 * Note: a QObject emits a destroyed(QObject *) Qt signal when it
46 * is deleted. This might be useful for closing other dialogs
47 * depending on a given GuiView.
49 class GuiView : public QMainWindow, public LyXView
53 /// create a main window of the given dimensions
60 virtual void setFocus();
61 virtual void setGeometry(
66 unsigned int iconSizeXY,
67 const std::string & geometryArg);
68 /// save the geometry state in the session manager.
69 virtual void saveGeometry();
70 virtual void setBusy(bool);
71 /// add toolbar, if newline==true, add a toolbar break before the toolbar
72 GuiToolbar * makeToolbar(ToolbarInfo const & tbinfo, bool newline);
73 virtual void updateStatusBar();
74 virtual void message(docstring const & str);
75 virtual bool hasFocus() const;
76 void showMiniBuffer(bool);
77 void openMenu(docstring const &);
78 void openLayoutList();
79 void updateLayoutChoice(bool force);
80 bool isToolbarVisible(std::string const & id);
81 void updateToolbars();
82 ToolbarInfo * getToolbarInfo(std::string const & name);
83 void toggleToolbarState(std::string const & name, bool allowauto);
85 QMenu * createPopupMenu();
87 /// dispatch to current BufferView
88 void dispatch(FuncRequest const & cmd);
90 /// \return the buffer currently shown in this window
92 Buffer const * buffer() const;
93 /// set a buffer to the current workarea.
94 void setBuffer(Buffer * b); ///< \c Buffer to set.
96 /// GuiBufferDelegate.
98 void resetAutosaveTimers();
99 void errors(std::string const &);
100 void structureChanged() { updateToc(); }
104 void showDialog(std::string const & name);
105 void showDialogWithData(std::string const & name,
106 std::string const & data);
107 void showInsetDialog(std::string const & name,
108 std::string const & data, Inset * inset);
109 void updateDialog(std::string const & name,
110 std::string const & data);
112 /// called on timeout
115 void updateEmbeddedFiles();
117 /// \return the current buffer view.
120 /// get access to the dialogs
121 Dialogs & getDialogs() { return *dialogs_; }
123 Dialogs const & getDialogs() const { return *dialogs_; }
125 /// load a buffer into the current workarea.
126 Buffer * loadLyXFile(support::FileName const & name, ///< File to load.
127 bool tolastfiles = true); ///< append to the "Open recent" menu?
129 /** redraw \c inset in all the BufferViews in which it is currently
130 * visible. If successful return a pointer to the owning Buffer.
132 Buffer const * updateInset(Inset const *);
134 void restartCursor();
136 /// \return the \c Workarea associated to \p Buffer
137 /// \retval 0 if no \c WorkArea is found.
138 GuiWorkArea * workArea(Buffer & buffer);
140 /// Add a \c WorkArea
141 /// \return the \c Workarea associated to \p Buffer
142 /// \retval 0 if no \c WorkArea is found.
143 GuiWorkArea * addWorkArea(Buffer & buffer);
145 void setCurrentWorkArea(GuiWorkArea * work_area);
147 void removeWorkArea(GuiWorkArea * work_area);
148 /// return the current WorkArea (the one that has the focus).
149 GuiWorkArea const * currentWorkArea() const;
156 /// clear any temporary message and replace with current status.
161 void updateWindowTitle(GuiWorkArea * wa);
164 void on_currentWorkAreaChanged(GuiWorkArea *);
166 /// slots to change the icon size
167 void smallSizedIcons();
168 void normalSizedIcons();
169 void bigSizedIcons();
173 void addTabWorkArea();
175 /// connect to signals in the given BufferView
176 void connectBufferView(BufferView & bv);
177 /// disconnect from signals in the given BufferView
178 void disconnectBufferView();
179 /// connect to signals in the given buffer
180 void connectBuffer(Buffer & buf);
181 /// disconnect from signals in the given buffer
182 void disconnectBuffer();
186 void dragEnterEvent(QDragEnterEvent * ev);
188 void dropEvent(QDropEvent * ev);
189 /// make sure we quit cleanly
190 virtual void closeEvent(QCloseEvent * e);
192 virtual void resizeEvent(QResizeEvent * e);
194 virtual void moveEvent(QMoveEvent * e);
196 /// in order to catch Tab key press.
197 bool event(QEvent * e);
198 bool focusNextPrevChild(bool);
200 QRect updateFloatingGeometry();
202 void setIconSize(unsigned int size);
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