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 /// Process Key pressed event.
72 /// This needs to be public because it is accessed externally by GuiView.
73 void processKeySym(KeySymbol const & key, KeyModifier mod);
75 bool inDialogMode() const;
76 void setDialogMode(bool mode);
79 GuiCompleter & completer();
81 Qt::CursorShape cursorShape() const;
83 /// Return the GuiView this workArea belongs to
84 GuiView const & view() const;
87 /// Current ratio between physical pixels and device-independent pixels
88 double pixelRatio() const;
92 void stopBlinkingCursor();
94 void startBlinkingCursor();
98 void titleChanged(GuiWorkArea *);
103 /// Scroll the BufferView.
105 * This is a slot for the valueChanged() signal of the vertical scrollbar.
106 * \p value value of the scrollbar.
108 void scrollTo(int value);
109 /// timer to limit triple clicks
110 void doubleClickTimeout();
111 /// toggle the cursor's visibility
113 /// close this work area.
114 /// Slot for Buffer::closing signal.
116 /// Slot to restore proper scrollbar behaviour.
117 void fixVerticalScrollBar();
120 /// Update window titles of all users.
121 void updateWindowTitle();
123 bool event(QEvent *);
125 void contextMenuEvent(QContextMenuEvent *);
127 void focusInEvent(QFocusEvent *);
129 void focusOutEvent(QFocusEvent *);
130 /// repaint part of the widget
131 void paintEvent(QPaintEvent * ev);
132 /// widget has been resized
133 void resizeEvent(QResizeEvent * ev);
134 /// mouse button press
135 void mousePressEvent(QMouseEvent * ev);
136 /// mouse button release
137 void mouseReleaseEvent(QMouseEvent * ev);
138 /// mouse double click of button
139 void mouseDoubleClickEvent(QMouseEvent * ev);
141 void mouseMoveEvent(QMouseEvent * ev);
143 void wheelEvent(QWheelEvent * ev);
145 void keyPressEvent(QKeyEvent * ev);
147 void inputMethodEvent(QInputMethodEvent * ev);
149 QVariant inputMethodQuery(Qt::InputMethodQuery query) const;
151 /// The slot connected to SyntheticMouseEvent::timeout.
152 void generateSyntheticMouseEvent();
154 friend class GuiCompleter;
160 class EmbeddedWorkArea : public GuiWorkArea
165 EmbeddedWorkArea(QWidget *);
168 /// Dummy methods for Designer.
169 void setWidgetResizable(bool) {}
170 void setWidget(QWidget *) {}
172 QSize sizeHint () const;
178 void closeEvent(QCloseEvent * ev);
180 void hideEvent(QHideEvent *ev);
185 }; // EmbeddedWorkArea
188 /// A tabbed set of GuiWorkAreas.
189 class TabWorkArea : public QTabWidget
193 TabWorkArea(QWidget * parent = 0);
196 void setFullScreen(bool full_screen);
197 void showBar(bool show);
199 bool setCurrentWorkArea(GuiWorkArea *);
200 GuiWorkArea * addWorkArea(Buffer & buffer, GuiView & view);
201 bool removeWorkArea(GuiWorkArea *);
202 GuiWorkArea * currentWorkArea();
203 GuiWorkArea * workArea(Buffer & buffer);
204 GuiWorkArea * workArea(int index);
205 void paintEvent(QPaintEvent *);
209 void currentWorkAreaChanged(GuiWorkArea *);
211 void lastWorkAreaRemoved();
214 /// close current buffer, or the one given by \c clicked_tab_
215 void closeCurrentBuffer();
216 /// hide current tab, or the one given by \c clicked_tab_
217 void hideCurrentTab();
218 /// close the tab given by \c index
219 void closeTab(int index);
221 void moveTab(int fromIndex, int toIndex);
223 void updateTabTexts();
227 void on_currentTabChanged(int index);
229 void showContextMenu(const QPoint & pos);
231 void mouseDoubleClickEvent(QMouseEvent * event);
237 QToolButton * closeBufferButton;
241 class DragTabBar : public QTabBar
246 DragTabBar(QWidget * parent = 0);
250 void mousePressEvent(QMouseEvent * event);
252 void mouseMoveEvent(QMouseEvent * event);
254 void dragEnterEvent(QDragEnterEvent * event);
256 void dropEvent(QDropEvent * event);
260 QPoint dragStartPos_;
264 void tabMoveRequested(int fromIndex, int toIndex);
267 } // namespace frontend