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 // X11 use a define called CursorShape, and we really want to use
15 // that name our selves. Therefore we do something similar to what is done
19 #ifndef FIXX11H_CursorShape
20 #define FIXX11H_CursorShape
21 int const XCursorShape = CursorShape;
23 int const CursorShape = CursorShape;
30 #ifndef BASE_WORKAREA_H
31 #define BASE_WORKAREA_H
33 #include "frontends/key_state.h"
34 #include "frontends/LyXKeySym.h"
35 #include "frontends/Timeout.h"
37 #include <boost/signals/trackable.hpp>
48 /// types of cursor in work area
52 /// L-shape for locked insets of a different language
54 /// reverse L-shape for RTL text
59 * The work area class represents the widget that provides the
60 * view onto a document. It is owned by the BufferView, and
61 * is responsible for handing events back to its owning BufferView.
62 * It works in concert with the BaseScreen class to update the
63 * widget view of a document.
65 class WorkArea : public boost::signals::trackable {
67 WorkArea(LyXView & lyx_view);
69 virtual ~WorkArea() {}
71 void setBufferView(BufferView * buffer_view);
74 BufferView & bufferView();
76 BufferView const & bufferView() const;
79 /// return the painter object for this work area
80 virtual Painter & getPainter() = 0;
82 /// return the width of the work area in pixels
83 virtual int width() const = 0;
85 /// return the height of the work area in pixels
86 virtual int height() const = 0;
89 * Update the scrollbar.
90 * @param height the total document height in pixels
91 * @param pos the current position in the document, in pixels
92 * @param line_height the line-scroll amount, in pixels
94 virtual void setScrollbarParams(int height, int pos, int line_height) = 0;
96 /// redraw the screen, without using existing pixmap
97 virtual void redraw();
99 /// grey out (no buffer)
102 /// FIXME: should be protected, public until the qt3 and gtk frontends are
104 void processKeySym(LyXKeySymPtr key, key_modifier::state state);
107 /// cause the display of the given area of the work area
108 virtual void expose(int x, int y, int w, int h) = 0;
111 /// FIXME: This is public because of qt3 and gtk, should be protected
112 void dispatch(FuncRequest const & cmd0);
114 /// FIXME: This is public because of qt3 and gtk, should be protected
115 void resizeBufferView();
117 /// FIXME: This is public because of qt3 and gtk, should be protected
118 void scrollBufferView(int position);
121 /// hide the visible cursor, if it is visible
124 /// show the cursor if it is not visible
127 /// toggle the cursor's visibility
131 virtual void removeCursor() = 0;
133 /// paint the cursor and store the background
134 virtual void showCursor(int x, int y, int h, CursorShape shape) = 0;
137 BufferView * buffer_view_;
144 void updateScrollbar();
146 void checkAndGreyOut();
148 void displayMessage(std::string const &);
149 /// buffer messages signal connection
150 boost::signals::connection message_connection_;
155 /// is the cursor currently displayed
156 bool cursor_visible_;
159 Timeout cursor_timeout_;
162 } // namespace frontend
165 #endif // BASE_WORKAREA_H