Dillo v3.1.1-119-g140d9ebd
Loading...
Searching...
No Matches
view.hh
Go to the documentation of this file.
1#ifndef __DW_VIEW_HH__
2#define __DW_VIEW_HH__
3
4#ifndef __INCLUDED_FROM_DW_CORE_HH__
5# error Do not include this file directly, use "core.hh" instead.
6#endif
7
8namespace dw {
9namespace core {
10
17{
18public:
19 /*
20 * ----------------------------
21 * Operations on the view
22 * ----------------------------
23 */
24
29 virtual void setLayout (Layout *layout) = 0;
30
34 virtual void setCanvasSize (int width, int ascent, int descent) = 0;
35
39 virtual void setCursor (style::Cursor cursor) = 0;
40
44 virtual void setBgColor (style::Color *color) = 0;
45
46 /*
47 * ---------------------------------------------------------
48 * Scrolling and Related. Only usesViewport must be
49 * implemented, if it returns false, the other methods
50 * are never called.
51 * ---------------------------------------------------------
52 */
53
57 virtual bool usesViewport () = 0;
58
65 virtual int getHScrollbarThickness () = 0;
66
73 virtual int getVScrollbarThickness () = 0;
74
75 virtual int getScrollbarOnLeft () = 0;
76
82 virtual void scrollTo (int x, int y) = 0;
83
87 virtual void scroll (ScrollCommand) { };
88
98 virtual void setViewportSize (int width, int height,
99 int hScrollbarThickness,
100 int vScrollbarThickness) = 0;
101
102 /*
103 * -----------------------
104 * Drawing functions
105 * -----------------------
106 */
107
118 virtual void startDrawing (Rectangle *area) = 0;
119
125 virtual void finishDrawing (Rectangle *area) = 0;
126
136 virtual void queueDraw (Rectangle *area) = 0;
137
143 virtual void queueDrawTotal () = 0;
144
153 virtual void cancelQueueDraw () = 0;
154
155 /*
156 * The following methods should be self-explaining.
157 */
158
159 virtual void drawPoint (style::Color *color,
160 style::Color::Shading shading,
161 int x, int y) = 0;
162 virtual void drawLine (style::Color *color,
163 style::Color::Shading shading,
164 int x1, int y1, int x2, int y2) = 0;
165 virtual void drawTypedLine (style::Color *color,
166 style::Color::Shading shading,
167 style::LineType type, int width,
168 int x1, int y1, int x2, int y2) = 0;
169 virtual void drawRectangle (style::Color *color,
170 style::Color::Shading shading, bool filled,
171 int x, int y, int width, int height) = 0;
172 virtual void drawArc (style::Color *color,
173 style::Color::Shading shading, bool filled,
174 int centerX, int centerY, int width, int height,
175 int angle1, int angle2) = 0;
176 virtual void drawPolygon (style::Color *color,
177 style::Color::Shading shading,
178 bool filled, bool convex, Point *points,
179 int npoints) = 0;
180 virtual void drawText (style::Font *font,
181 style::Color *color,
182 style::Color::Shading shading,
183 int x, int y, const char *text, int len) = 0;
184 virtual void drawSimpleWrappedText (style::Font *font, style::Color *color,
185 style::Color::Shading shading,
186 int x, int y, int w, int h,
187 const char *text) = 0;
188 virtual void drawImage (Imgbuf *imgbuf, int xRoot, int yRoot,
189 int x, int y, int width, int height) = 0;
190
191 /*
192 * --------------
193 * Clipping
194 * --------------
195 */
196
197 /*
198 * To prevent drawing outside of a given area, a clipping view may be
199 * requested, which also implements this interface. The clipping view is
200 * related to the parent view (clipping views may be nested!), anything
201 * which is drawn into this clipping view, is later merged again into the
202 * parent view. An implementation will typically use additional pixmaps,
203 * which are later merged into the parent view pixmap/window.
204 */
205
206 virtual View *getClippingView (int x, int y, int width, int height) = 0;
207 virtual void mergeClippingView (View *clippingView) = 0;
208};
209
210} // namespace core
211} // namespace dw
212
213#endif // __DW_VIEW_HH__
The platform independent interface for image buffers.
Definition imgbuf.hh:162
The central class for managing and drawing a widget tree.
Definition layout.hh:17
dw::core::Shape implemtation for simple rectangles.
Definition types.hh:70
An interface to encapsulate platform dependent drawing.
Definition view.hh:17
virtual void setViewportSize(int width, int height, int hScrollbarThickness, int vScrollbarThickness)=0
Set the viewport size.
virtual void mergeClippingView(View *clippingView)=0
virtual void drawImage(Imgbuf *imgbuf, int xRoot, int yRoot, int x, int y, int width, int height)=0
virtual void queueDraw(Rectangle *area)=0
Queue a region, which is given in canvas coordinates, for drawing.
virtual void startDrawing(Rectangle *area)=0
Called before drawing.
virtual void drawPoint(style::Color *color, style::Color::Shading shading, int x, int y)=0
virtual int getScrollbarOnLeft()=0
virtual void drawPolygon(style::Color *color, style::Color::Shading shading, bool filled, bool convex, Point *points, int npoints)=0
virtual void drawTypedLine(style::Color *color, style::Color::Shading shading, style::LineType type, int width, int x1, int y1, int x2, int y2)=0
virtual void drawSimpleWrappedText(style::Font *font, style::Color *color, style::Color::Shading shading, int x, int y, int w, int h, const char *text)=0
virtual void scroll(ScrollCommand)
Scroll the viewport as commanded.
Definition view.hh:87
virtual int getHScrollbarThickness()=0
Get the thickness of the horizontal scrollbar, when it is visible.
virtual void setCanvasSize(int width, int ascent, int descent)=0
Set the canvas size.
virtual void finishDrawing(Rectangle *area)=0
Called after drawing.
virtual void queueDrawTotal()=0
Queue the total viewport for drawing.
virtual void setCursor(style::Cursor cursor)=0
Set the cursor appearance.
virtual bool usesViewport()=0
Return, whether this view uses a viewport.
virtual void drawArc(style::Color *color, style::Color::Shading shading, bool filled, int centerX, int centerY, int width, int height, int angle1, int angle2)=0
virtual int getVScrollbarThickness()=0
Get the thickness of the vertical scrollbar, when it is visible.
virtual void drawLine(style::Color *color, style::Color::Shading shading, int x1, int y1, int x2, int y2)=0
virtual void drawText(style::Font *font, style::Color *color, style::Color::Shading shading, int x, int y, const char *text, int len)=0
virtual void setBgColor(style::Color *color)=0
Set the background of the view.
virtual void cancelQueueDraw()=0
Cancel a draw queue request.
virtual void drawRectangle(style::Color *color, style::Color::Shading shading, bool filled, int x, int y, int width, int height)=0
virtual void scrollTo(int x, int y)=0
Scroll the vieport to the given position.
virtual void setLayout(Layout *layout)=0
This methods notifies the view, that it has been attached to a layout.
virtual View * getClippingView(int x, int y, int width, int height)=0
This is the base class for many other classes, which defines very common virtual methods.
Definition object.hh:25
static Layout * layout
static core::Imgbuf * imgbuf
ScrollCommand
Definition types.hh:35
Dw is in this namespace, or sub namespaces of this one.