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;
40 QWidget * mainWindow();
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 virtual void setFocus();
63 virtual void setBusy(bool);
65 /// add toolbar, if newline==true, add a toolbar break before the toolbar
66 GuiToolbar * makeToolbar(ToolbarInfo const & tbinfo, bool newline);
67 virtual void updateStatusBar();
68 virtual void message(docstring const & str);
69 virtual bool hasFocus() const;
70 void updateLayoutChoice(bool force);
71 bool isToolbarVisible(std::string const & id);
72 void updateToolbars();
74 QMenu * createPopupMenu();
76 /// dispatch to current BufferView
77 void dispatch(FuncRequest const & cmd);
79 /// \return the buffer currently shown in this window
81 Buffer const * buffer() const;
82 /// set a buffer to the current workarea.
83 void setBuffer(Buffer * b); ///< \c Buffer to set.
85 /// GuiBufferDelegate.
87 void resetAutosaveTimers();
88 void errors(std::string const &);
89 void structureChanged() { updateToc(); }
93 void showDialog(std::string const & name);
94 void showDialogWithData(std::string const & name,
95 std::string const & data);
96 void showInsetDialog(std::string const & name,
97 std::string const & data, Inset * inset);
98 void updateDialog(std::string const & name,
99 std::string const & data);
101 /// called on timeout
104 void updateEmbeddedFiles();
106 /// \return the current buffer view.
109 /// get access to the dialogs
110 Dialogs & getDialogs() { return *dialogs_; }
112 Dialogs const & getDialogs() const { return *dialogs_; }
114 /// load a buffer into the current workarea.
115 Buffer * loadLyXFile(support::FileName const & name, ///< File to load.
116 bool tolastfiles = true); ///< append to the "Open recent" menu?
118 /** redraw \c inset in all the BufferViews in which it is currently
119 * visible. If successful return a pointer to the owning Buffer.
121 Buffer const * updateInset(Inset const *);
123 void restartCursor();
125 /// \return the \c Workarea associated to \p Buffer
126 /// \retval 0 if no \c WorkArea is found.
127 GuiWorkArea * workArea(Buffer & buffer);
129 /// Add a \c WorkArea
130 /// \return the \c Workarea associated to \p Buffer
131 /// \retval 0 if no \c WorkArea is found.
132 GuiWorkArea * addWorkArea(Buffer & buffer);
134 void setCurrentWorkArea(GuiWorkArea * work_area);
136 void removeWorkArea(GuiWorkArea * work_area);
137 /// return the current WorkArea (the one that has the focus).
138 GuiWorkArea const * currentWorkArea() const;
145 /// clear any temporary message and replace with current status.
150 void updateWindowTitle(GuiWorkArea * wa);
153 void on_currentWorkAreaChanged(GuiWorkArea *);
155 /// slots to change the icon size
156 void smallSizedIcons();
157 void normalSizedIcons();
158 void bigSizedIcons();
162 void addTabWorkArea();
164 /// connect to signals in the given BufferView
165 void connectBufferView(BufferView & bv);
166 /// disconnect from signals in the given BufferView
167 void disconnectBufferView();
168 /// connect to signals in the given buffer
169 void connectBuffer(Buffer & buf);
170 /// disconnect from signals in the given buffer
171 void disconnectBuffer();
175 void dragEnterEvent(QDragEnterEvent * ev);
177 void dropEvent(QDropEvent * ev);
178 /// make sure we quit cleanly
179 void closeEvent(QCloseEvent * e);
181 void showEvent(QShowEvent *);
183 /// in order to catch Tab key press.
184 bool event(QEvent * e);
185 bool focusNextPrevChild(bool);
188 struct GuiViewPrivate;
192 QTimer statusbar_timer_;
194 /// are we quitting by the menu?
195 bool quitting_by_menu_;
204 ToolbarSize toolbarSize_;
206 /// auto-saving of buffers
207 Timeout * const autosave_timeout_;
208 /// dialogs for this view
213 } // namespace frontend