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 #include "FuncRequest.h"
16 #include "qt_helpers.h"
19 #include "support/docstring.h"
20 #include "support/Timeout.h"
22 #include <QMouseEvent>
27 class QContextMenuEvent;
28 class QDragEnterEvent;
51 /// for emulating triple click
55 DoubleClick() : state(Qt::NoButton), active(false) {}
57 DoubleClick(QMouseEvent * e) : state(e->button()), active(true) {}
59 bool operator==(QMouseEvent const & e) { return state == e.button(); }
63 Qt::MouseButton state;
68 /** Qt only emits mouse events when the mouse is being moved, but
69 * we want to generate 'pseudo' mouse events when the mouse button is
70 * pressed and the mouse cursor is below the bottom, or above the top
71 * of the work area. In this way, we'll be able to continue scrolling
72 * (and selecting) the text.
74 * This class stores all the parameters needed to make this happen.
76 class SyntheticMouseEvent
79 SyntheticMouseEvent();
88 * Implementation of the work area (buffer view GUI)
92 struct GuiWorkArea::Private
94 Private(GuiWorkArea *);
96 /// update the passed area.
97 void update(int x, int y, int w, int h);
101 void resizeBufferView();
103 /// paint the cursor and store the background
104 void showCursor(int x, int y, int h,
105 bool l_shape, bool rtl, bool completable);
110 void dispatch(FuncRequest const & cmd0, KeyModifier = NoModifier);
111 /// hide the visible cursor, if it is visible
113 /// show the cursor if it is not visible
116 void updateScrollbar();
117 /// Change the cursor when the mouse hovers over a clickable inset
118 void updateCursorShape();
120 void setCursorShape(Qt::CursorShape shape);
125 if (lyxrc.use_qimage) {
126 screen_ = new QImage(p->viewport()->width(), p->viewport()->height(),
127 QImage::Format_ARGB32_Premultiplied);
129 screen_ = new QPixmap(p->viewport()->width(), p->viewport()->height());
135 QPaintDevice * screen_;
137 BufferView * buffer_view_;
138 /// Read only Buffer status cache.
142 /// is the cursor currently displayed
143 bool cursor_visible_;
146 QTimer cursor_timeout_;
148 SyntheticMouseEvent synthetic_mouse_event_;
150 DoubleClick dc_event_;
153 CursorWidget * cursor_;
157 bool schedule_redraw_;
162 GuiCompleter * completer_;
164 /// Special mode in which Esc and Enter (with or without Shift)
167 /// store the name of the context menu when the mouse is
168 /// pressed. This is used to get the correct context menu
169 /// when the menu is actually shown (after releasing on Windows)
170 /// and after the DEPM has done its job.
171 std::string context_menu_name_;
174 } // namespace frontend