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"
18 #include "support/Timeout.h"
20 #include <QMouseEvent>
25 class QContextMenuEvent;
26 class QDragEnterEvent;
49 /// for emulating triple click
53 DoubleClick() : state(Qt::NoButton), active(false) {}
55 DoubleClick(QMouseEvent * e) : state(e->button()), active(true) {}
57 bool operator==(QMouseEvent const & e) { return state == e.button(); }
61 Qt::MouseButton state;
66 /** Qt only emits mouse events when the mouse is being moved, but
67 * we want to generate 'pseudo' mouse events when the mouse button is
68 * pressed and the mouse cursor is below the bottom, or above the top
69 * of the work area. In this way, we'll be able to continue scrolling
70 * (and selecting) the text.
72 * This class stores all the parameters needed to make this happen.
74 class SyntheticMouseEvent
77 SyntheticMouseEvent();
86 * Implementation of the work area (buffer view GUI)
90 struct GuiWorkArea::Private
92 Private(GuiWorkArea *);
94 /// update the passed area.
95 void update(int x, int y, int w, int h);
99 void resizeBufferView();
101 /// paint the cursor and store the background
102 void showCursor(int x, int y, int h,
103 bool l_shape, bool rtl, bool completable);
108 void dispatch(FuncRequest const & cmd0, KeyModifier = NoModifier);
109 /// hide the visible cursor, if it is visible
111 /// show the cursor if it is not visible
114 void updateScrollbar();
115 /// Change the cursor when the mouse hovers over a clickable inset
116 void updateCursorShape();
118 void setCursorShape(Qt::CursorShape shape);
123 if (lyxrc.use_qimage) {
124 screen_ = new QImage(p->viewport()->width(), p->viewport()->height(),
125 QImage::Format_ARGB32_Premultiplied);
127 screen_ = new QPixmap(p->viewport()->width(), p->viewport()->height());
133 QPaintDevice * screen_;
135 BufferView * buffer_view_;
136 /// Read only Buffer status cache.
140 /// is the cursor currently displayed
141 bool cursor_visible_;
144 QTimer cursor_timeout_;
146 SyntheticMouseEvent synthetic_mouse_event_;
148 DoubleClick dc_event_;
151 CursorWidget * cursor_;
155 bool schedule_redraw_;
160 GuiCompleter * completer_;
162 /// Special mode in which Esc and Enter (with or without Shift)
165 /// store the name of the context menu when the mouse is
166 /// pressed. This is used to get the correct context menu
167 /// when the menu is actually shown (after releasing on Windows)
168 /// and after the DEPM has done its job.
169 std::string context_menu_name_;
172 } // namespace frontend