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"
17 #include "support/FileName.h"
18 #include "support/Timeout.h"
20 #include <QMouseEvent>
33 /// for emulating triple click
37 DoubleClick() : state(Qt::NoButton), active(false) {}
39 DoubleClick(QMouseEvent * e) : state(e->button()), active(true) {}
41 bool operator==(QMouseEvent const & e) { return state == e.button(); }
45 Qt::MouseButton state;
50 /** Qt only emits mouse events when the mouse is being moved, but
51 * we want to generate 'pseudo' mouse events when the mouse button is
52 * pressed and the mouse cursor is below the bottom, or above the top
53 * of the work area. In this way, we'll be able to continue scrolling
54 * (and selecting) the text.
56 * This class stores all the parameters needed to make this happen.
58 class SyntheticMouseEvent
61 SyntheticMouseEvent();
70 * Implementation of the work area (buffer view GUI)
74 struct GuiWorkArea::Private
77 Private(GuiWorkArea *);
83 void resizeBufferView();
86 void dispatch(FuncRequest const & cmd0);
87 /// hide the visible cursor, if it is visible
89 /// show the cursor if it is not visible
91 /// Set the range and value of the scrollbar and connect to its valueChanged
93 void updateScrollbar();
94 /// Change the cursor when the mouse hovers over a clickable inset
95 void updateCursorShape();
97 bool needResize() const {
98 return need_resize_ || p->pixelRatio() != pixel_ratio_;
104 BufferView * buffer_view_;
109 CaretWidget * caret_;
110 /// is the cursor currently displayed
113 QTimer caret_timeout_;
116 SyntheticMouseEvent synthetic_mouse_event_;
118 DoubleClick dc_event_;
123 bool schedule_redraw_;
126 /// Ratio between physical pixels and device-independent pixels
127 /// We save the last used value to detect changes of the
128 /// current pixel_ratio of the viewport.
131 GuiCompleter * completer_;
133 /// Special mode in which Esc and Enter (with or without Shift)
136 /// store the name of the context menu when the mouse is
137 /// pressed. This is used to get the correct context menu
138 /// when the menu is actually shown (after releasing on Windows)
139 /// and after the DEPM has done its job.
140 std::string context_menu_name_;
142 /// stuff related to window title
144 support::FileName file_name_;
150 docstring vc_status_;
154 bool externally_modified_;
158 } // namespace frontend