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>
34 /// for emulating triple click
38 DoubleClick() : state(Qt::NoButton), active(false) {}
40 DoubleClick(QMouseEvent * e) : state(e->button()), active(true) {}
42 bool operator==(QMouseEvent const & e) { return state == e.button(); }
46 Qt::MouseButton state;
51 /** Qt only emits mouse events when the mouse is being moved, but
52 * we want to generate 'pseudo' mouse events when the mouse button is
53 * pressed and the mouse cursor is below the bottom, or above the top
54 * of the work area. In this way, we'll be able to continue scrolling
55 * (and selecting) the text.
57 * This class stores all the parameters needed to make this happen.
59 class SyntheticMouseEvent
62 SyntheticMouseEvent();
71 * Implementation of the work area (buffer view GUI)
75 struct GuiWorkArea::Private
78 Private(GuiWorkArea *);
84 void resizeBufferView();
87 void dispatch(FuncRequest const & cmd0);
88 /// hide the visible caret, if it is visible
90 /// show the caret if it is not visible
92 /// Set the range and value of the scrollbar and connect to its valueChanged
94 void updateScrollbar();
95 /// Change the cursor when the mouse hovers over a clickable inset
96 void updateCursorShape();
98 void paintPreeditText(GuiPainter & pain);
100 bool needResize() const {
101 return need_resize_ || p->pixelRatio() != pixel_ratio_;
107 BufferView * buffer_view_;
112 CaretWidget * caret_;
113 /// is the caret currently displayed
116 QTimer caret_timeout_;
119 SyntheticMouseEvent synthetic_mouse_event_;
121 DoubleClick dc_event_;
126 bool schedule_redraw_;
128 /// the current preedit text of the input method
129 docstring preedit_string_;
130 /// Number of lines used by preedit text
132 /// the attributes of the preedit text
133 QList<QInputMethodEvent::Attribute> preedit_attr_;
135 /// Ratio between physical pixels and device-independent pixels
136 /// We save the last used value to detect changes of the
137 /// current pixel_ratio of the viewport.
140 GuiCompleter * completer_;
142 /// Special mode in which Esc and Enter (with or without Shift)
145 /// store the name of the context menu when the mouse is
146 /// pressed. This is used to get the correct context menu
147 /// when the menu is actually shown (after releasing on Windows)
148 /// and after the DEPM has done its job.
149 std::string context_menu_name_;
151 /// stuff related to window title
153 support::FileName file_name_;
159 docstring vc_status_;
163 bool externally_modified_;
167 } // namespace frontend