3 * \file GuiWorkArea_Private.h
4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Abdelrazak Younes
9 * Full author contact details are available in file CREDITS.
12 #ifndef WORKAREA_PRIVATE_H
13 #define WORKAREA_PRIVATE_H
15 // Comment out to use QImage backend instead of QPixmap. This won't have any
16 // effect on Windows, MacOSX and most X11 environment when running locally.
17 // When running remotely on X11, this may have a big performance penalty.
20 #include "FuncRequest.h"
21 #include "qt_helpers.h"
23 #include "support/docstring.h"
24 #include "support/Timeout.h"
26 #include <QAbstractScrollArea>
27 #include <QMouseEvent>
35 class QContextMenuEvent;
36 class QDragEnterEvent;
59 /// for emulating triple click
63 DoubleClick() : state(Qt::NoButton), active(false) {}
65 DoubleClick(QMouseEvent * e) : state(e->button()), active(true) {}
67 bool operator==(QMouseEvent const & e) { return state == e.button(); }
71 Qt::MouseButton state;
76 /** Qt only emits mouse events when the mouse is being moved, but
77 * we want to generate 'pseudo' mouse events when the mouse button is
78 * pressed and the mouse cursor is below the bottom, or above the top
79 * of the work area. In this way, we'll be able to continue scrolling
80 * (and selecting) the text.
82 * This class stores all the parameters needed to make this happen.
84 class SyntheticMouseEvent
87 SyntheticMouseEvent();
96 * Implementation of the work area (buffer view GUI)
100 struct GuiWorkArea::Private
102 Private(GuiWorkArea *);
104 /// update the passed area.
105 void update(int x, int y, int w, int h);
109 void resizeBufferView();
111 /// paint the cursor and store the background
112 virtual void showCursor(int x, int y, int h,
113 bool l_shape, bool rtl, bool completable);
116 virtual void removeCursor();
118 void dispatch(FuncRequest const & cmd0, KeyModifier = NoModifier);
119 /// hide the visible cursor, if it is visible
121 /// show the cursor if it is not visible
124 void updateScrollbar();
125 /// Change the cursor when the mouse hovers over a clickable inset
126 void updateCursorShape();
128 void setCursorShape(Qt::CursorShape shape);
133 screen_ = QImage(p->viewport()->width(), p->viewport()->height(),
134 QImage::Format_ARGB32_Premultiplied);
141 screen_ = QPixmap(p->viewport()->width(), p->viewport()->height());
150 BufferView * buffer_view_;
151 /// Read only Buffer status cache.
155 /// is the cursor currently displayed
156 bool cursor_visible_;
159 QTimer cursor_timeout_;
161 SyntheticMouseEvent synthetic_mouse_event_;
163 DoubleClick dc_event_;
166 CursorWidget * cursor_;
170 bool schedule_redraw_;
175 GuiCompleter * completer_;
177 /// Special mode in which Esc and Enter (with or without Shift)
180 /// store the name of the context menu when the mouse is
181 /// pressed. This is used to get the correct context menu
182 /// when the menu is actually shown (after releasing on Windows)
183 /// and after the DEPM has done its job.
184 std::string context_menu_name_;
187 } // namespace frontend