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/FileName.h"
19 #include "support/Timeout.h"
21 #include <QMouseEvent>
26 class QContextMenuEvent;
27 class QDragEnterEvent;
50 /// for emulating triple click
54 DoubleClick() : state(Qt::NoButton), active(false) {}
56 DoubleClick(QMouseEvent * e) : state(e->button()), active(true) {}
58 bool operator==(QMouseEvent const & e) { return state == e.button(); }
62 Qt::MouseButton state;
67 /** Qt only emits mouse events when the mouse is being moved, but
68 * we want to generate 'pseudo' mouse events when the mouse button is
69 * pressed and the mouse cursor is below the bottom, or above the top
70 * of the work area. In this way, we'll be able to continue scrolling
71 * (and selecting) the text.
73 * This class stores all the parameters needed to make this happen.
75 class SyntheticMouseEvent
78 SyntheticMouseEvent();
87 * Implementation of the work area (buffer view GUI)
91 struct GuiWorkArea::Private
93 Private(GuiWorkArea *);
96 void resizeBufferView();
98 /// paint the cursor and store the background
99 void showCursor(int x, int y, int h,
100 bool l_shape, bool rtl, bool completable);
105 void dispatch(FuncRequest const & cmd0);
106 /// hide the visible cursor, if it is visible
108 /// show the cursor if it is not visible
110 /// Set the range and value of the scrollbar and connect to its valueChanged
112 void updateScrollbar();
113 /// Change the cursor when the mouse hovers over a clickable inset
114 void updateCursorShape();
116 void setCursorShape(Qt::CursorShape shape);
118 bool needResize() const {
119 return need_resize_ || p->pixelRatio() != pixel_ratio_;
125 BufferView * buffer_view_;
128 /// is the cursor currently displayed
129 bool cursor_visible_;
132 QTimer cursor_timeout_;
134 SyntheticMouseEvent synthetic_mouse_event_;
136 DoubleClick dc_event_;
139 CursorWidget * cursor_;
143 bool schedule_redraw_;
146 /// Ratio between physical pixels and device-independent pixels
147 /// We save the last used value to detect changes of the
148 /// current pixel_ratio of the viewport.
151 GuiCompleter * completer_;
153 /// Special mode in which Esc and Enter (with or without Shift)
156 /// store the name of the context menu when the mouse is
157 /// pressed. This is used to get the correct context menu
158 /// when the menu is actually shown (after releasing on Windows)
159 /// and after the DEPM has done its job.
160 std::string context_menu_name_;
162 /// stuff related to window title
164 support::FileName file_name_;
170 docstring vc_status_;
174 bool externally_modified_;
178 } // namespace frontend