Dillo
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 
8 namespace dw {
9 namespace core {
10 
17 {
18 public:
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 
80  virtual void scrollTo (int x, int y) = 0;
81 
85  virtual void scroll (ScrollCommand) { };
86 
96  virtual void setViewportSize (int width, int height,
97  int hScrollbarThickness,
98  int vScrollbarThickness) = 0;
99 
100  /*
101  * -----------------------
102  * Drawing functions
103  * -----------------------
104  */
105 
116  virtual void startDrawing (Rectangle *area) = 0;
117 
123  virtual void finishDrawing (Rectangle *area) = 0;
124 
134  virtual void queueDraw (Rectangle *area) = 0;
135 
141  virtual void queueDrawTotal () = 0;
142 
151  virtual void cancelQueueDraw () = 0;
152 
153  /*
154  * The following methods should be self-explaining.
155  */
156 
157  virtual void drawPoint (style::Color *color,
158  style::Color::Shading shading,
159  int x, int y) = 0;
160  virtual void drawLine (style::Color *color,
161  style::Color::Shading shading,
162  int x1, int y1, int x2, int y2) = 0;
163  virtual void drawTypedLine (style::Color *color,
164  style::Color::Shading shading,
165  style::LineType type, int width,
166  int x1, int y1, int x2, int y2) = 0;
167  virtual void drawRectangle (style::Color *color,
168  style::Color::Shading shading, bool filled,
169  int x, int y, int width, int height) = 0;
170  virtual void drawArc (style::Color *color,
171  style::Color::Shading shading, bool filled,
172  int centerX, int centerY, int width, int height,
173  int angle1, int angle2) = 0;
174  virtual void drawPolygon (style::Color *color,
175  style::Color::Shading shading,
176  bool filled, bool convex, Point *points,
177  int npoints) = 0;
178  virtual void drawText (style::Font *font,
179  style::Color *color,
180  style::Color::Shading shading,
181  int x, int y, const char *text, int len) = 0;
182  virtual void drawSimpleWrappedText (style::Font *font, style::Color *color,
183  style::Color::Shading shading,
184  int x, int y, int w, int h,
185  const char *text) = 0;
186  virtual void drawImage (Imgbuf *imgbuf, int xRoot, int yRoot,
187  int x, int y, int width, int height) = 0;
188 
189  /*
190  * --------------
191  * Clipping
192  * --------------
193  */
194 
195  /*
196  * To prevent drawing outside of a given area, a clipping view may be
197  * requested, which also implements this interface. The clipping view is
198  * related to the parent view (clipping views may be nested!), anything
199  * which is drawn into this clipping view, is later merged again into the
200  * parent view. An implementation will typically use additional pixmaps,
201  * which are later merged into the parent view pixmap/window.
202  */
203 
204  virtual View *getClippingView (int x, int y, int width, int height) = 0;
205  virtual void mergeClippingView (View *clippingView) = 0;
206 };
207 
208 } // namespace core
209 } // namespace dw
210 
211 #endif // __DW_VIEW_HH__
Cursor
Definition: style.hh:200
virtual void drawText(style::Font *font, style::Color *color, style::Color::Shading shading, int x, int y, const char *text, int len)=0
Definition: style.hh:751
virtual void drawLine(style::Color *color, style::Color::Shading shading, int x1, int y1, int x2, int y2)=0
Shading
Definition: style.hh:767
dw::core::Shape implemtation for simple rectangles.
Definition: types.hh:69
virtual void setCanvasSize(int width, int ascent, int descent)=0
Set the canvas size.
virtual void drawImage(Imgbuf *imgbuf, int xRoot, int yRoot, int x, int y, int width, int height)=0
LineType
Definition: style.hh:291
virtual int getHScrollbarThickness()=0
Get the thickness of the horizontal scrollbar, when it is visible.
The central class for managing and drawing a widget tree.
Definition: layout.hh:16
This is the base class for many other classes, which defines very common virtual methods.
Definition: object.hh:24
static Layout * layout
Definition: dw_anchors_test.cc:38
virtual void mergeClippingView(View *clippingView)=0
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
Definition: style.hh:698
virtual void setLayout(Layout *layout)=0
This methods notifies the view, that it has been attached to a layout.
virtual void drawRectangle(style::Color *color, style::Color::Shading shading, bool filled, int x, int y, int width, int height)=0
virtual void startDrawing(Rectangle *area)=0
Called before drawing.
virtual void queueDrawTotal()=0
Queue the total viewport for drawing.
virtual void setBgColor(style::Color *color)=0
Set the background of the view.
virtual void finishDrawing(Rectangle *area)=0
Called after drawing.
virtual bool usesViewport()=0
Return, whether this view uses a viewport.
virtual void drawPolygon(style::Color *color, style::Color::Shading shading, bool filled, bool convex, Point *points, int npoints)=0
virtual View * getClippingView(int x, int y, int width, int height)=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 setCursor(style::Cursor cursor)=0
Set the cursor appearance.
The platform independent interface for image buffers.
Definition: imgbuf.hh:161
Dw is in this namespace, or sub namespaces of this one.
Definition: alignedtablecell.cc:28
static core::Imgbuf * imgbuf
Definition: dw_images_scaled.cc:38
An interface to encapsulate platform dependent drawing.
Definition: view.hh:16
virtual int getVScrollbarThickness()=0
Get the thickness of the vertical scrollbar, when it is visible.
virtual void queueDraw(Rectangle *area)=0
Queue a region, which is given in canvas coordinates, for drawing.
Definition: types.hh:49
virtual void scroll(ScrollCommand)
Scroll the viewport as commanded.
Definition: view.hh:85
virtual void scrollTo(int x, int y)=0
Scroll the vieport to the given position.
ScrollCommand
Definition: types.hh:35
virtual void cancelQueueDraw()=0
Cancel a draw queue request.
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 drawPoint(style::Color *color, style::Color::Shading shading, int x, int y)=0
virtual void setViewportSize(int width, int height, int hScrollbarThickness, int vScrollbarThickness)=0
Set the viewport size.