00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef _VDKDRAWAREA_H
00029 #define _VDKDRAWAREA_H
00030
00031 #include <vdk/vdkobj.h>
00032 #include <vdk/colors.h>
00033 #include <vdk/rawpixbuf.h>
00034
00035 class VDKDrawingArea;
00036
00043 class VDKDrawTool: public VDKNotCopyAble
00044 {
00045 protected:
00046 VDKDrawingArea* owner;
00047 GdkPixmap *tile;
00048 public:
00053 VDKDrawTool (VDKDrawingArea* owner);
00057 virtual ~VDKDrawTool ();
00063 VDKReadWriteValueProp <VDKDrawTool, GdkFill> Fill;
00088 VDKReadWriteValueProp <VDKDrawTool, GdkFunction> Function;
00089
00090 void SetFill (GdkFill fill);
00095 void SetTile (const char* tfile);
00100 void SetTile (char** tdata);
00105 void SetTile (GdkPixmap* tile);
00110 GdkPixmap *Tile(char** tdata);
00115 GdkPixmap *Tile(const char* tfile);
00116
00117 void SetFunction(GdkFunction f);
00118 };
00119
00125 class VDKPen: public VDKDrawTool
00126 {
00127 public:
00133 VDKPen (VDKDrawingArea* owner);
00137 virtual ~VDKPen () {}
00141 VDKReadWriteValueProp <VDKPen, VDKRgb> Color;
00145 VDKReadWriteValueProp <VDKPen, gint> Thickness;
00154 VDKReadWriteValueProp <VDKPen, GdkLineStyle> Style;
00170 VDKReadWriteValueProp <VDKPen, GdkCapStyle> Cap;
00180 VDKReadWriteValueProp <VDKPen, GdkJoinStyle> Join;
00181
00182 void SetColor (VDKRgb color);
00183 void SetThickness (int t);
00184 void SetStyle (GdkLineStyle style);
00185 void SetCap (GdkCapStyle cap);
00186 void SetJoin (GdkJoinStyle join);
00187 };
00188
00195 class VDKBrush: public VDKDrawTool
00196 {
00197 public:
00198 VDKBrush (VDKDrawingArea* owner): VDKDrawTool (owner){}
00199 virtual ~VDKBrush () {}
00200 };
00201
00210 class VDKDrawingArea: public VDKObject
00211 {
00212 private:
00213 static void RealizeEvent (GtkWidget* wid, gpointer gp );
00214
00215 protected:
00216 GdkGC* _gc;
00217 public:
00221 VDKPen* Pen;
00225 VDKBrush *Brush;
00230 VDKDrawingArea(VDKForm* owner);
00234 virtual ~VDKDrawingArea();
00238 void Clear();
00239
00240 void DrawString(int x, int y, char* text);
00241 void DrawText(int x, int y, char* text, int n);
00242 void DrawPoint(int x, int y);
00243 void DrawLine(int x, int y, int x1, int y1);
00244 void DrawRect(gint filled, int x, int y, int w, int h);
00245 void DrawArc(int filled,int x,int y, int width,
00246 int height,int angle1, int angle2);
00247 void DrawPolygon(int filled,GdkPoint *points, gint npoints);
00248 void DrawPoints(GdkPoint *points, int npoints);
00249 void DrawSegments(GdkSegment *segs, int nsegs);
00250 void DrawLines(GdkPoint *points, int npoints);
00251 void DrawPixbuf(int x, int y, const char *pixfile);
00252 void DrawPixbuf(int x, int y, VDKPixbuf* pix);
00253 void DrawPixbuf(int x, int y, const char ** data);
00254
00255 void SetForeground(VDKRgb color, GtkStateType state = GTK_STATE_NORMAL);
00256 void SetBackground(VDKRgb color, GtkStateType state = GTK_STATE_NORMAL);
00257 GdkGC* GC () { return _gc; }
00258 GdkDrawable* Drawable () { return widget->window; }
00259 virtual void SetFont(VDKFont* f);
00260 };
00261
00262 #endif
00263
00264
00265