4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
9 * \author Abdelrazak Younes
11 * Full author contact details are available in file CREDITS.
14 #ifndef BASE_WORKAREA_H
15 #define BASE_WORKAREA_H
17 #include "frontends/key_state.h"
18 #include "frontends/LyXKeySym.h"
19 #include "frontends/Timeout.h"
21 #include "support/docstring.h"
23 #include <boost/signals/trackable.hpp>
36 /// types of cursor in work area
40 /// L-shape for locked insets of a different language
42 /// reverse L-shape for RTL text
47 * The work area class represents the widget that provides the
48 * view onto a document. It is owned by the BufferView, and
49 * is responsible for handing events back to its owning BufferView.
50 * It works in concert with the BaseScreen class to update the
51 * widget view of a document.
53 class WorkArea : public boost::signals::trackable {
55 WorkArea(int id, LyXView & lyx_view);
57 virtual ~WorkArea() {}
59 int const id() const { return id_; }
61 void setBufferView(BufferView * buffer_view);
64 BufferView & bufferView();
66 BufferView const & bufferView() const;
68 /// \return true if has the keyboard input focus.
69 virtual bool hasFocus() const = 0;
71 /// return the width of the work area in pixels
72 virtual int width() const = 0;
74 /// return the height of the work area in pixels
75 virtual int height() const = 0;
78 * Update the scrollbar.
79 * @param height the total document height in pixels
80 * @param pos the current position in the document, in pixels
81 * @param line_height the line-scroll amount, in pixels
83 virtual void setScrollbarParams(int height, int pos, int line_height) = 0;
85 /// redraw the screen, without using existing pixmap
86 virtual void redraw(bool singlePar = false);
88 void checkAndGreyOut();
90 void stopBlinkingCursor();
91 void startBlinkingCursor();
94 /// grey out (no buffer)
95 virtual void greyOut();
97 void processKeySym(LyXKeySymPtr key, key_modifier::state state);
98 /// cause the display of the given area of the work area
99 virtual void expose(int x, int y, int w, int h) = 0;
101 void dispatch(FuncRequest const & cmd0);
103 void resizeBufferView();
105 void scrollBufferView(int position);
106 /// hide the visible cursor, if it is visible
108 /// show the cursor if it is not visible
110 /// toggle the cursor's visibility
113 virtual void removeCursor() = 0;
114 /// paint the cursor and store the background
115 virtual void showCursor(int x, int y, int h, CursorShape shape) = 0;
117 void updateScrollbar();
120 BufferView * buffer_view_;
131 void displayMessage(docstring const &);
132 /// buffer messages signal connection
133 boost::signals::connection message_connection_;
135 /// is the cursor currently displayed
136 bool cursor_visible_;
139 Timeout cursor_timeout_;
142 } // namespace frontend
145 #endif // BASE_WORKAREA_H