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"
23 #include <QMainWindow>
27 class QDragEnterEvent;
44 QWidget * mainWindow();
47 * GuiView - Qt4 implementation of LyXView
49 * qt4-private implementation of the main LyX window.
51 * Note: a QObject emits a destroyed(QObject *) Qt signal when it
52 * is deleted. This might be useful for closing other dialogs
53 * depending on a given GuiView.
55 class GuiView : public QMainWindow, public LyXView
59 /// create a main window of the given dimensions
66 int id() const { return id_; }
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 updateLayoutChoice(bool force);
77 bool isToolbarVisible(std::string const & id);
78 void updateToolbars();
80 QMenu * createPopupMenu();
82 /// dispatch to current BufferView
83 void dispatch(FuncRequest const & cmd);
85 /// \return the buffer currently shown in this window
87 Buffer const * buffer() const;
88 /// set a buffer to the current workarea.
89 void setBuffer(Buffer * b); ///< \c Buffer to set.
91 /// GuiBufferDelegate.
93 void resetAutosaveTimers();
94 void errors(std::string const &);
95 void structureChanged() { updateToc(); }
101 void updateEmbeddedFiles();
103 /// \return the current buffer view.
106 /// load a buffer into the current workarea.
107 Buffer * loadLyXFile(support::FileName const & name, ///< File to load.
108 bool tolastfiles = true); ///< append to the "Open recent" menu?
110 /** redraw \c inset in all the BufferViews in which it is currently
111 * visible. If successful return a pointer to the owning Buffer.
113 Buffer const * updateInset(Inset const *);
115 void restartCursor();
117 /// \return the \c Workarea associated to \p Buffer
118 /// \retval 0 if no \c WorkArea is found.
119 GuiWorkArea * workArea(Buffer & buffer);
121 /// Add a \c WorkArea
122 /// \return the \c Workarea associated to \p Buffer
123 /// \retval 0 if no \c WorkArea is found.
124 GuiWorkArea * addWorkArea(Buffer & buffer);
126 void setCurrentWorkArea(GuiWorkArea * work_area);
128 void removeWorkArea(GuiWorkArea * work_area);
129 /// return the current WorkArea (the one that has the focus).
130 GuiWorkArea const * currentWorkArea() const;
137 /// clear any temporary message and replace with current status.
142 void updateWindowTitle(GuiWorkArea * wa);
145 void on_currentWorkAreaChanged(GuiWorkArea *);
147 /// slots to change the icon size
148 void smallSizedIcons();
149 void normalSizedIcons();
150 void bigSizedIcons();
154 void addTabWorkArea();
156 /// connect to signals in the given BufferView
157 void connectBufferView(BufferView & bv);
158 /// disconnect from signals in the given BufferView
159 void disconnectBufferView();
160 /// connect to signals in the given buffer
161 void connectBuffer(Buffer & buf);
162 /// disconnect from signals in the given buffer
163 void disconnectBuffer();
167 void dragEnterEvent(QDragEnterEvent * ev);
169 void dropEvent(QDropEvent * ev);
170 /// make sure we quit cleanly
171 void closeEvent(QCloseEvent * e);
173 void showEvent(QShowEvent *);
175 /// in order to catch Tab key press.
176 bool event(QEvent * e);
177 bool focusNextPrevChild(bool);
180 struct GuiViewPrivate;
185 /// dialogs for this view
188 /** Check the status of all visible dialogs and disable or reenable
189 * them as appropriate.
191 * Disabling is needed for example when a dialog is open and the
192 * cursor moves to a position where the corresponding inset is not
197 /// Hide all visible dialogs
198 void hideAll() const;
199 /// Hide any dialogs that require a buffer for them to operate
200 void hideBufferDependent() const;
201 /** Update visible, buffer-dependent dialogs
202 If the bool is true then a buffer change has occurred
203 else it is still the same buffer.
205 void updateBufferDependent(bool) const;
207 /** \param name == "bibtex", "citation" etc; an identifier used to
208 launch a particular dialog.
209 \param data is a string representation of the Inset contents.
210 It is often little more than the output from Inset::write.
211 It is passed to, and parsed by, the frontend dialog.
212 Several of these dialogs do not need any data,
213 so it defaults to string().
214 \param inset ownership is _not_ passed to the frontend dialog.
215 It is stored internally and used by the kernel to ascertain
216 what to do with the FuncRequest dispatched from the frontend
217 dialog on 'Apply'; should it be used to create a new inset at
218 the current cursor position or modify an existing, 'open' inset?
220 void showDialog(std::string const & name,
221 std::string const & data, Inset * inset = 0);
223 /** \param name == "citation", "bibtex" etc; an identifier used
224 to update the contents of a particular dialog with \param data.
225 See the comments to 'show', above.
227 void updateDialog(std::string const & name, std::string const & data);
229 /// Is the dialog currently visible?
230 bool isDialogVisible(std::string const & name) const;
232 /** All Dialogs of the given \param name will be closed if they are
233 connected to the given \param inset.
235 void hideDialog(std::string const & name, Inset * inset);
237 void disconnectDialog(std::string const & name);
239 Inset * getOpenInset(std::string const & name) const;
243 void redrawDialog() const;
245 bool isValidName(std::string const & name) const;
247 Dialog * find_or_build(std::string const & name);
249 Dialog * build(std::string const & name);
255 } // namespace frontend