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 CANVAS_H
00029 #define CANVAS_H
00030
00031 #include <vdk/vdkobj.h>
00032 #include <vdk/colors.h>
00033 #include <vdk/rawpixmap.h>
00052 class VDKCanvas: public VDKObject
00053 {
00054 protected:
00055
00056 VDKColor* background;
00057 bool setFg,setBg,setF;
00058 GdkGC *gc;
00059 void DrawBackground();
00060 GdkFont* canvasFont;
00061 public:
00062 static int ConfigureEvent(GtkWidget* w, GdkEventConfigure* event, void* o);
00063 static int ExposeEvent(GtkWidget* w, GdkEventExpose* event, void* o);
00064 GdkPixmap *pixmap;
00065 void Reset();
00066
00067
00068
00069
00075 VDKReadWriteValueProp<VDKCanvas,bool> EnableClear;
00076
00077 public:
00078 VDKCanvas(VDKForm* owner, int w = 100, int h = 100);
00079 virtual ~VDKCanvas();
00083 void Clear();
00084 void DrawString(int x, int y, char* text);
00085 void DrawText(int x, int y, char* text, int n);
00086 void DrawPoint(int x, int y);
00087 void DrawLine(int x, int y, int x1, int y1);
00088 void DrawRect(int filled,int x, int y, int w, int h);
00089 void DrawArc(int filled,int x,int y, int width,
00090 int height,int angle1, int angle2);
00091 void DrawPolygon(int filled,GdkPoint *points, gint npoints);
00092 void DrawPoints(GdkPoint *points, int npoints);
00093 void DrawSegments(GdkSegment *segs, int nsegs);
00094 void DrawLines(GdkPoint *points, int npoints);
00095 void DrawPixmap(int x, int y, char *pixfile);
00096 void DrawPixmap(int x, int y, VDKRawPixmap* pix);
00097 void DrawPixmap(int x, int y, char ** data);
00101 void Redraw();
00102 void SetForeground(VDKRgb color, GtkStateType state = GTK_STATE_NORMAL);
00103 void SetBackground(VDKRgb color, GtkStateType state = GTK_STATE_NORMAL);
00104 void SetFont(VDKFont* f);
00105 };
00106
00107 #endif
00108
00109
00110