vdk 2.4.0
vdkdrawarea.h
1
2/*
3 * ===========================
4 * VDK Visual Develeopment Kit
5 * Version 2.0.0
6 * March 2002
7 * ===========================
8 *
9 * Copyright (C) 2002, Mario Motta
10 * Developed by Mario Motta <mmotta@guest.net>
11 *
12 * This library is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Library General Public
14 * License as published by the Free Software Foundation; either
15 * version 2 of the License, or (at your option) any later version.
16 *
17 * This library is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Library General Public License for more details.
21 *
22 * You should have received a copy of the GNU Library General Public
23 * License along with this library; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
25 * 02111-1307, USA.
26 */
27
28#ifndef _VDKDRAWAREA_H
29#define _VDKDRAWAREA_H
30
31#include <vdk/vdkobj.h>
32#include <vdk/colors.h>
33#include <vdk/rawpixbuf.h>
34
35class VDKDrawingArea;
36
44{
45 protected:
46 VDKDrawingArea* owner;
47 GdkPixmap *tile;
48 public:
57 virtual ~VDKDrawTool ();
63 VDKReadWriteValueProp <VDKDrawTool, GdkFill> Fill;
88 VDKReadWriteValueProp <VDKDrawTool, GdkFunction> Function;
89
90 void SetFill (GdkFill fill);
95 void SetTile (const char* tfile);
100 void SetTile (char** tdata);
105 void SetTile (GdkPixmap* tile);
110 GdkPixmap *Tile(char** tdata);
115 GdkPixmap *Tile(const char* tfile);
116
117 void SetFunction(GdkFunction f);
118 };
119
125class VDKPen: public VDKDrawTool
126{
127 public:
133 VDKPen (VDKDrawingArea* owner);
137 virtual ~VDKPen () {}
141 VDKReadWriteValueProp <VDKPen, VDKRgb> Color;
145 VDKReadWriteValueProp <VDKPen, gint> Thickness;
154 VDKReadWriteValueProp <VDKPen, GdkLineStyle> Style;
170 VDKReadWriteValueProp <VDKPen, GdkCapStyle> Cap;
180 VDKReadWriteValueProp <VDKPen, GdkJoinStyle> Join;
181//
182 void SetColor (VDKRgb color);
183 void SetThickness (int t);
184 void SetStyle (GdkLineStyle style);
185 void SetCap (GdkCapStyle cap);
186 void SetJoin (GdkJoinStyle join);
187};
188
196{
197 public:
198 VDKBrush (VDKDrawingArea* owner): VDKDrawTool (owner){}
199 virtual ~VDKBrush () {}
200};
201
211{
212 private:
213 static void RealizeEvent (GtkWidget* wid, gpointer gp );
214
215 protected:
216 GdkGC* _gc;
217 public:
230 VDKDrawingArea(VDKForm* owner);
234 virtual ~VDKDrawingArea();
238 void Clear();
239
240 void DrawString(int x, int y, char* text);
241 void DrawText(int x, int y, char* text, int n);
242 void DrawPoint(int x, int y);
243 void DrawLine(int x, int y, int x1, int y1);
244 void DrawRect(gint filled, int x, int y, int w, int h);
245 void DrawArc(int filled,int x,int y, int width,
246 int height,int angle1, int angle2);
247 void DrawPolygon(int filled,GdkPoint *points, gint npoints);
248 void DrawPoints(GdkPoint *points, int npoints);
249 void DrawSegments(GdkSegment *segs, int nsegs);
250 void DrawLines(GdkPoint *points, int npoints);
251 void DrawPixbuf(int x, int y, const char *pixfile);
252 void DrawPixbuf(int x, int y, VDKPixbuf* pix);
253 void DrawPixbuf(int x, int y, const char ** data);
254
255 void SetForeground(VDKRgb color, GtkStateType state = GTK_STATE_NORMAL);
256 void SetBackground(VDKRgb color, GtkStateType state = GTK_STATE_NORMAL);
257 GdkGC* GC () { return _gc; }
258 GdkDrawable* Drawable () { return widget->window; }
259 virtual void SetFont(VDKFont* f);
260};
261
262#endif
263
264
265
This class provides a brush to customize drawing. Actually unused, left for future improuvments.
Definition: vdkdrawarea.h:196
This class and subclasses provid customized drawing tools for VDKDrawingArea widget.
Definition: vdkdrawarea.h:44
VDKReadWriteValueProp< VDKDrawTool, GdkFill > Fill
Definition: vdkdrawarea.h:63
virtual ~VDKDrawTool()
Definition: vdkdrawarea.cc:43
VDKReadWriteValueProp< VDKDrawTool, GdkFunction > Function
Definition: vdkdrawarea.h:88
GdkPixmap * Tile(char **tdata)
Definition: vdkdrawarea.cc:109
VDKDrawTool(VDKDrawingArea *owner)
Definition: vdkdrawarea.cc:35
void SetTile(const char *tfile)
Definition: vdkdrawarea.cc:60
This class provides a drawing area widget. This widget should substitute VDKCanvas which is now depre...
Definition: vdkdrawarea.h:211
virtual void SetFont(VDKFont *f)
Definition: vdkdrawarea.cc:439
virtual ~VDKDrawingArea()
Definition: vdkdrawarea.cc:240
VDKPen * Pen
Definition: vdkdrawarea.h:221
VDKDrawingArea(VDKForm *owner)
Definition: vdkdrawarea.cc:216
void SetForeground(VDKRgb color, GtkStateType state=GTK_STATE_NORMAL)
Definition: vdkdrawarea.cc:398
VDKBrush * Brush
Definition: vdkdrawarea.h:225
void Clear()
Definition: vdkdrawarea.cc:253
void SetBackground(VDKRgb color, GtkStateType state=GTK_STATE_NORMAL)
Definition: vdkdrawarea.cc:417
Provides a raw font.
Definition: vdkfont.h:38
VDKForm widgets, generally the outermost widget container.
Definition: forms.h:69
Hierarchy root class.
Definition: vdkutils.h:264
Definition: vdkobj.h:141
GtkWidget * widget
Definition: vdkobj.h:241
This class provides a Pen to customize drawing.
Definition: vdkdrawarea.h:126
VDKPen(VDKDrawingArea *owner)
Definition: vdkdrawarea.cc:147
virtual ~VDKPen()
Definition: vdkdrawarea.h:137
VDKReadWriteValueProp< VDKPen, gint > Thickness
Definition: vdkdrawarea.h:145
VDKReadWriteValueProp< VDKPen, GdkCapStyle > Cap
Definition: vdkdrawarea.h:170
VDKReadWriteValueProp< VDKPen, VDKRgb > Color
Definition: vdkdrawarea.h:141
VDKReadWriteValueProp< VDKPen, GdkLineStyle > Style
Definition: vdkdrawarea.h:154
VDKReadWriteValueProp< VDKPen, GdkJoinStyle > Join
Definition: vdkdrawarea.h:180
Provides a raw image wrapping GdkPixbuf This class should in time substitute VDKRawPixmap that from n...
Definition: rawpixbuf.h:41
Provides a simple RGB color structure.
Definition: vdkutils.h:38