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>
25 // FIXME: defined in X.h, spuriously pulled in by Qt 3 headers
38 /// types of cursor in work area
42 /// L-shape for locked insets of a different language
44 /// reverse L-shape for RTL text
49 * The work area class represents the widget that provides the
50 * view onto a document. It is owned by the BufferView, and
51 * is responsible for handing events back to its owning BufferView.
52 * It works in concert with the BaseScreen class to update the
53 * widget view of a document.
55 class WorkArea : public boost::signals::trackable {
57 WorkArea(int id, LyXView & lyx_view);
59 virtual ~WorkArea() {}
61 int const id() const { return id_; }
63 void setBufferView(BufferView * buffer_view);
66 BufferView & bufferView();
68 BufferView const & bufferView() const;
70 /// return the width of the work area in pixels
71 virtual int width() const = 0;
73 /// return the height of the work area in pixels
74 virtual int height() const = 0;
77 * Update the scrollbar.
78 * @param height the total document height in pixels
79 * @param pos the current position in the document, in pixels
80 * @param line_height the line-scroll amount, in pixels
82 virtual void setScrollbarParams(int height, int pos, int line_height) = 0;
84 /// redraw the screen, without using existing pixmap
85 virtual void redraw();
87 void checkAndGreyOut();
89 void stopBlinkingCursor();
90 void startBlinkingCursor();
93 /// grey out (no buffer)
94 virtual void greyOut();
96 void processKeySym(LyXKeySymPtr key, key_modifier::state state);
97 /// cause the display of the given area of the work area
98 virtual void expose(int x, int y, int w, int h) = 0;
100 void dispatch(FuncRequest const & cmd0);
102 void resizeBufferView();
104 void scrollBufferView(int position);
105 /// hide the visible cursor, if it is visible
107 /// show the cursor if it is not visible
109 /// toggle the cursor's visibility
112 virtual void removeCursor() = 0;
113 /// paint the cursor and store the background
114 virtual void showCursor(int x, int y, int h, CursorShape shape) = 0;
116 void updateScrollbar();
119 BufferView * buffer_view_;
130 void displayMessage(docstring const &);
131 /// buffer messages signal connection
132 boost::signals::connection message_connection_;
134 /// is the cursor currently displayed
135 bool cursor_visible_;
138 Timeout cursor_timeout_;
141 } // namespace frontend
144 #endif // BASE_WORKAREA_H