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 "support/docstring.h"
20 #include <QAbstractScrollArea>
24 class QDragEnterEvent;
42 class GuiWorkArea : public QAbstractScrollArea, public WorkArea
48 GuiWorkArea(QWidget *);
50 GuiWorkArea(Buffer & buffer, GuiView & gv);
57 void setBuffer(Buffer &);
59 void setGuiView(GuiView &);
61 void setFullScreen(bool full_screen);
62 /// is GuiView in fullscreen mode?
63 bool isFullScreen() const;
65 void scheduleRedraw();
67 BufferView & bufferView();
69 BufferView const & bufferView() const;
71 void redraw(bool update_metrics);
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;
91 void stopBlinkingCursor();
93 void startBlinkingCursor();
97 void titleChanged(GuiWorkArea *);
102 /// Scroll the BufferView.
104 * This is a slot for the valueChanged() signal of the vertical scrollbar.
105 * \p value value of the scrollbar.
107 void scrollTo(int value);
108 /// timer to limit triple clicks
109 void doubleClickTimeout();
110 /// toggle the cursor's visibility
112 /// close this work area.
113 /// Slot for Buffer::closing signal.
115 /// Slot to restore proper scrollbar behaviour.
116 void fixVerticalScrollBar();
119 /// Update window titles of all users.
120 void updateWindowTitle();
122 bool event(QEvent *);
124 void contextMenuEvent(QContextMenuEvent *);
126 void focusInEvent(QFocusEvent *);
128 void focusOutEvent(QFocusEvent *);
129 /// repaint part of the widget
130 void paintEvent(QPaintEvent * ev);
131 /// widget has been resized
132 void resizeEvent(QResizeEvent * ev);
133 /// mouse button press
134 void mousePressEvent(QMouseEvent * ev);
135 /// mouse button release
136 void mouseReleaseEvent(QMouseEvent * ev);
137 /// mouse double click of button
138 void mouseDoubleClickEvent(QMouseEvent * ev);
140 void mouseMoveEvent(QMouseEvent * ev);
142 void wheelEvent(QWheelEvent * ev);
144 void keyPressEvent(QKeyEvent * ev);
146 void inputMethodEvent(QInputMethodEvent * ev);
148 QVariant inputMethodQuery(Qt::InputMethodQuery query) const;
150 /// The slot connected to SyntheticMouseEvent::timeout.
151 void generateSyntheticMouseEvent();
153 friend class GuiCompleter;
159 class EmbeddedWorkArea : public GuiWorkArea
164 EmbeddedWorkArea(QWidget *);
167 /// Dummy methods for Designer.
168 void setWidgetResizable(bool) {}
169 void setWidget(QWidget *) {}
171 QSize sizeHint () const;
177 void closeEvent(QCloseEvent * ev);
179 void hideEvent(QHideEvent *ev);
184 }; // EmbeddedWorkArea
187 /// A tabbed set of GuiWorkAreas.
188 class TabWorkArea : public QTabWidget
192 TabWorkArea(QWidget * parent = 0);
195 void setFullScreen(bool full_screen);
196 void showBar(bool show);
198 bool setCurrentWorkArea(GuiWorkArea *);
199 GuiWorkArea * addWorkArea(Buffer & buffer, GuiView & view);
200 bool removeWorkArea(GuiWorkArea *);
201 GuiWorkArea * currentWorkArea();
202 GuiWorkArea * workArea(Buffer & buffer);
203 GuiWorkArea * workArea(int index);
204 void paintEvent(QPaintEvent *);
208 void currentWorkAreaChanged(GuiWorkArea *);
210 void lastWorkAreaRemoved();
213 /// close current buffer, or the one given by \c clicked_tab_
214 void closeCurrentBuffer();
215 /// hide current tab, or the one given by \c clicked_tab_
216 void hideCurrentTab();
217 /// close the tab given by \c index
218 void closeTab(int index);
220 void updateTabTexts();
224 void on_currentTabChanged(int index);
226 void showContextMenu(const QPoint & pos);
228 void moveTab(int fromIndex, int toIndex);
230 void mouseDoubleClickEvent(QMouseEvent * event);
236 QToolButton * closeBufferButton;
240 class DragTabBar : public QTabBar
245 DragTabBar(QWidget * parent = 0);
249 void mousePressEvent(QMouseEvent * event);
251 void mouseMoveEvent(QMouseEvent * event);
253 void dragEnterEvent(QDragEnterEvent * event);
255 void dropEvent(QDropEvent * event);
259 QPoint dragStartPos_;
261 int dragCurrentIndex_;
265 void tabMoveRequested(int fromIndex, int toIndex);
268 } // namespace frontend