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;
89 void stopBlinkingCursor();
91 void startBlinkingCursor();
95 void titleChanged(GuiWorkArea *);
100 /// Scroll the BufferView.
102 * This is a slot for the valueChanged() signal of the vertical scrollbar.
103 * \p value value of the scrollbar.
105 void scrollTo(int value);
106 /// timer to limit triple clicks
107 void doubleClickTimeout();
108 /// toggle the cursor's visibility
110 /// close this work area.
111 /// Slot for Buffer::closing signal.
113 /// Slot to restore proper scrollbar behaviour.
114 void fixVerticalScrollBar();
117 /// Update window titles of all users.
118 void updateWindowTitle();
120 bool event(QEvent *);
122 void contextMenuEvent(QContextMenuEvent *);
124 void focusInEvent(QFocusEvent *);
126 void focusOutEvent(QFocusEvent *);
127 /// repaint part of the widget
128 void paintEvent(QPaintEvent * ev);
129 /// widget has been resized
130 void resizeEvent(QResizeEvent * ev);
131 /// mouse button press
132 void mousePressEvent(QMouseEvent * ev);
133 /// mouse button release
134 void mouseReleaseEvent(QMouseEvent * ev);
135 /// mouse double click of button
136 void mouseDoubleClickEvent(QMouseEvent * ev);
138 void mouseMoveEvent(QMouseEvent * ev);
140 void wheelEvent(QWheelEvent * ev);
142 void keyPressEvent(QKeyEvent * ev);
144 void inputMethodEvent(QInputMethodEvent * ev);
146 QVariant inputMethodQuery(Qt::InputMethodQuery query) const;
148 /// The slot connected to SyntheticMouseEvent::timeout.
149 void generateSyntheticMouseEvent();
151 friend class GuiCompleter;
157 class EmbeddedWorkArea : public GuiWorkArea
162 EmbeddedWorkArea(QWidget *);
165 /// Dummy methods for Designer.
166 void setWidgetResizable(bool) {}
167 void setWidget(QWidget *) {}
169 QSize sizeHint () const;
175 void closeEvent(QCloseEvent * ev);
177 void hideEvent(QHideEvent *ev);
182 }; // EmbeddedWorkArea
185 /// A tabbed set of GuiWorkAreas.
186 class TabWorkArea : public QTabWidget
190 TabWorkArea(QWidget * parent = 0);
193 void setFullScreen(bool full_screen);
194 void showBar(bool show);
196 bool setCurrentWorkArea(GuiWorkArea *);
197 GuiWorkArea * addWorkArea(Buffer & buffer, GuiView & view);
198 bool removeWorkArea(GuiWorkArea *);
199 GuiWorkArea * currentWorkArea();
200 GuiWorkArea * workArea(Buffer & buffer);
201 GuiWorkArea * workArea(int index);
202 void paintEvent(QPaintEvent *);
206 void currentWorkAreaChanged(GuiWorkArea *);
208 void lastWorkAreaRemoved();
211 /// close current buffer, or the one given by \c clicked_tab_
212 void closeCurrentBuffer();
213 /// hide current tab, or the one given by \c clicked_tab_
214 void hideCurrentTab();
215 /// close the tab given by \c index
216 void closeTab(int index);
218 void updateTabTexts();
222 void on_currentTabChanged(int index);
224 void showContextMenu(const QPoint & pos);
226 void moveTab(int fromIndex, int toIndex);
228 void mouseDoubleClickEvent(QMouseEvent * event);
234 QToolButton * closeBufferButton;
238 class DragTabBar : public QTabBar
243 DragTabBar(QWidget * parent = 0);
247 void mousePressEvent(QMouseEvent * event);
249 void mouseMoveEvent(QMouseEvent * event);
251 void dragEnterEvent(QDragEnterEvent * event);
253 void dropEvent(QDropEvent * event);
257 QPoint dragStartPos_;
261 void tabMoveRequested(int fromIndex, int toIndex);
264 } // namespace frontend