4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
8 * \author Abdelrazak Younes
10 * Full author contact details are available in file CREDITS.
16 #include "frontends/WorkArea.h"
18 #include <QAbstractScrollArea>
22 class QDragEnterEvent;
40 class GuiWorkArea : public QAbstractScrollArea, public WorkArea
46 GuiWorkArea(QWidget *);
48 GuiWorkArea(Buffer & buffer, GuiView & gv);
55 void setBuffer(Buffer &);
57 void setGuiView(GuiView &);
59 void setFullScreen(bool full_screen);
60 /// is GuiView in fullscreen mode?
61 bool isFullScreen() const;
63 void scheduleRedraw();
65 BufferView & bufferView();
67 BufferView const & bufferView() const;
69 void redraw(bool update_metrics);
71 /// return true if the key is part of a shortcut
72 bool queryKeySym(KeySymbol const & key, KeyModifier mod) const;
73 /// Process Key pressed event.
74 /// This needs to be public because it is accessed externally by GuiView.
75 void processKeySym(KeySymbol const & key, KeyModifier mod);
77 bool inDialogMode() const;
78 void setDialogMode(bool mode);
81 GuiCompleter & completer();
83 Qt::CursorShape cursorShape() const;
85 /// Return the GuiView this workArea belongs to
86 GuiView const & view() const;
89 /// Current ratio between physical pixels and device-independent pixels
90 double pixelRatio() const;
94 void stopBlinkingCursor();
96 void startBlinkingCursor();
100 void titleChanged(GuiWorkArea *);
105 /// Scroll the BufferView.
107 * This is a slot for the valueChanged() signal of the vertical scrollbar.
108 * \p value value of the scrollbar.
110 void scrollTo(int value);
111 /// timer to limit triple clicks
112 void doubleClickTimeout();
113 /// toggle the cursor's visibility
115 /// close this work area.
116 /// Slot for Buffer::closing signal.
118 /// Slot to restore proper scrollbar behaviour.
119 void fixVerticalScrollBar();
122 /// Update window titles of all users.
123 void updateWindowTitle();
125 bool event(QEvent *);
127 void contextMenuEvent(QContextMenuEvent *);
129 void focusInEvent(QFocusEvent *);
131 void focusOutEvent(QFocusEvent *);
132 /// repaint part of the widget
133 void paintEvent(QPaintEvent * ev);
134 /// widget has been resized
135 void resizeEvent(QResizeEvent * ev);
136 /// mouse button press
137 void mousePressEvent(QMouseEvent * ev);
138 /// mouse button release
139 void mouseReleaseEvent(QMouseEvent * ev);
140 /// mouse double click of button
141 void mouseDoubleClickEvent(QMouseEvent * ev);
143 void mouseMoveEvent(QMouseEvent * ev);
145 void wheelEvent(QWheelEvent * ev);
146 /// key press event. It also knows how to handle ShortcutOverride events to
147 /// avoid code duplication.
148 void keyPressEvent(QKeyEvent * ev);
150 void inputMethodEvent(QInputMethodEvent * ev);
152 QVariant inputMethodQuery(Qt::InputMethodQuery query) const;
154 /// The slot connected to SyntheticMouseEvent::timeout.
155 void generateSyntheticMouseEvent();
157 friend class GuiCompleter;
163 class EmbeddedWorkArea : public GuiWorkArea
168 EmbeddedWorkArea(QWidget *);
171 /// Dummy methods for Designer.
172 void setWidgetResizable(bool) {}
173 void setWidget(QWidget *) {}
175 QSize sizeHint () const;
181 void closeEvent(QCloseEvent * ev);
183 void hideEvent(QHideEvent *ev);
188 }; // EmbeddedWorkArea
191 /// A tabbed set of GuiWorkAreas.
192 class TabWorkArea : public QTabWidget
196 TabWorkArea(QWidget * parent = 0);
199 void setFullScreen(bool full_screen);
200 void showBar(bool show);
202 bool setCurrentWorkArea(GuiWorkArea *);
203 GuiWorkArea * addWorkArea(Buffer & buffer, GuiView & view);
204 bool removeWorkArea(GuiWorkArea *);
205 GuiWorkArea * currentWorkArea();
206 GuiWorkArea * workArea(Buffer & buffer);
207 GuiWorkArea * workArea(int index);
208 void paintEvent(QPaintEvent *);
212 void currentWorkAreaChanged(GuiWorkArea *);
214 void lastWorkAreaRemoved();
217 /// close current buffer, or the one given by \c clicked_tab_
218 void closeCurrentBuffer();
219 /// hide current tab, or the one given by \c clicked_tab_
220 void hideCurrentTab();
221 /// close the tab given by \c index
222 void closeTab(int index);
224 void moveTab(int fromIndex, int toIndex);
226 void updateTabTexts();
230 void on_currentTabChanged(int index);
232 void showContextMenu(const QPoint & pos);
234 void mouseDoubleClickEvent(QMouseEvent * event);
240 QToolButton * closeBufferButton;
244 class DragTabBar : public QTabBar
249 DragTabBar(QWidget * parent = 0);
253 void mousePressEvent(QMouseEvent * event);
255 void mouseMoveEvent(QMouseEvent * event);
257 void dragEnterEvent(QDragEnterEvent * event);
259 void dropEvent(QDropEvent * event);
263 QPoint dragStartPos_;
267 void tabMoveRequested(int fromIndex, int toIndex);
270 } // namespace frontend