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>
26 class QDragEnterEvent;
43 * GuiView - Qt4 implementation of LyXView
45 * qt4-private implementation of the main LyX window.
47 * Note: a QObject emits a destroyed(QObject *) Qt signal when it
48 * is deleted. This might be useful for closing other dialogs
49 * depending on a given GuiView.
51 class GuiView : public QMainWindow, public LyXView
55 /// create a main window of the given dimensions
62 int id() const { return id_; }
67 /// add toolbar, if newline==true, add a toolbar break before the toolbar
68 GuiToolbar * makeToolbar(ToolbarInfo const & tbinfo, bool newline);
69 virtual void updateStatusBar();
70 virtual void message(docstring const & str);
71 virtual bool hasFocus() const;
72 void updateLayoutChoice(bool force);
73 void updateToolbars();
74 QMenu * createPopupMenu();
75 FuncStatus getStatus(FuncRequest const & cmd);
76 void dispatch(FuncRequest const & cmd);
78 /// \return the buffer currently shown in this window
80 Buffer const * buffer() const;
81 /// set a buffer to the current workarea.
82 void setBuffer(Buffer * b); ///< \c Buffer to set.
84 /// GuiBufferDelegate.
86 void resetAutosaveTimers();
87 void errors(std::string const &);
88 void structureChanged() { updateToc(); }
94 void updateEmbeddedFiles();
96 /// \return the current buffer view.
99 /** redraw \c inset in all the BufferViews in which it is currently
100 * visible. If successful return a pointer to the owning Buffer.
102 Buffer const * updateInset(Inset const *);
104 void restartCursor();
106 /// \return the \c Workarea associated to \p Buffer
107 /// \retval 0 if no \c WorkArea is found.
108 GuiWorkArea * workArea(Buffer & buffer);
110 /// Add a \c WorkArea
111 /// \return the \c Workarea associated to \p Buffer
112 /// \retval 0 if no \c WorkArea is found.
113 GuiWorkArea * addWorkArea(Buffer & buffer);
115 void setCurrentWorkArea(GuiWorkArea * work_area);
117 void removeWorkArea(GuiWorkArea * work_area);
118 /// return the current WorkArea (the one that has the focus).
119 GuiWorkArea const * currentWorkArea() const;
126 /// clear any temporary message and replace with current status.
131 void updateWindowTitle(GuiWorkArea * wa);
134 void on_currentWorkAreaChanged(GuiWorkArea *);
136 /// slots to change the icon size
137 void smallSizedIcons();
138 void normalSizedIcons();
139 void bigSizedIcons();
143 void addTabWorkArea();
145 /// connect to signals in the given BufferView
146 void connectBufferView(BufferView & bv);
147 /// disconnect from signals in the given BufferView
148 void disconnectBufferView();
149 /// connect to signals in the given buffer
150 void connectBuffer(Buffer & buf);
151 /// disconnect from signals in the given buffer
152 void disconnectBuffer();
156 void dragEnterEvent(QDragEnterEvent * ev);
158 void dropEvent(QDropEvent * ev);
159 /// make sure we quit cleanly
160 void closeEvent(QCloseEvent * e);
162 void showEvent(QShowEvent *);
164 /// in order to catch Tab key press.
165 bool event(QEvent * e);
166 bool focusNextPrevChild(bool);
169 struct GuiViewPrivate;
174 /// dialogs for this view
177 /** Check the status of all visible dialogs and disable or reenable
178 * them as appropriate.
180 * Disabling is needed for example when a dialog is open and the
181 * cursor moves to a position where the corresponding inset is not
186 /// Hide all visible dialogs
187 void hideAll() const;
188 /// Hide any dialogs that require a buffer for them to operate
189 void hideBufferDependent() const;
190 /** Update visible, buffer-dependent dialogs
191 If the bool is true then a buffer change has occurred
192 else it is still the same buffer.
194 void updateBufferDependent(bool) const;
196 /** \param name == "bibtex", "citation" etc; an identifier used to
197 launch a particular dialog.
198 \param data is a string representation of the Inset contents.
199 It is often little more than the output from Inset::write.
200 It is passed to, and parsed by, the frontend dialog.
201 Several of these dialogs do not need any data,
202 so it defaults to string().
203 \param inset ownership is _not_ passed to the frontend dialog.
204 It is stored internally and used by the kernel to ascertain
205 what to do with the FuncRequest dispatched from the frontend
206 dialog on 'Apply'; should it be used to create a new inset at
207 the current cursor position or modify an existing, 'open' inset?
209 void showDialog(std::string const & name,
210 std::string const & data, Inset * inset = 0);
212 /** \param name == "citation", "bibtex" etc; an identifier used
213 to update the contents of a particular dialog with \param data.
214 See the comments to 'show', above.
216 void updateDialog(std::string const & name, std::string const & data);
218 /** All Dialogs of the given \param name will be closed if they are
219 connected to the given \param inset.
221 void hideDialog(std::string const & name, Inset * inset);
223 void disconnectDialog(std::string const & name);
225 Inset * getOpenInset(std::string const & name) const;
228 /// Is the dialog currently visible?
229 bool isDialogVisible(std::string const & name) const;
231 Dialog * find_or_build(std::string const & name);
233 Dialog * build(std::string const & name);
239 } // namespace frontend