vdk 2.4.0
canvas.h
1/*
2 * ===========================
3 * VDK Visual Develeopment Kit
4 * Version 0.6.1
5 * May 1999
6 * ===========================
7 *
8 * Copyright (C) 1998, Mario Motta
9 * Developed by Mario Motta <mmotta@guest.net>
10 * Modified by Tamas Kohegyi <tamas.kohegyi@unforgettable.com>
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 CANVAS_H
29#define CANVAS_H
30
31#include <vdk/vdkobj.h>
32#include <vdk/colors.h>
33#include <vdk/rawpixmap.h>
52class VDKCanvas: public VDKObject
53{
54 protected:
55 // bool dragFlag,startdragFlag;
56 VDKColor* background;
57 bool setFg,setBg,setF;
58 GdkGC *gc;
59 void DrawBackground();
60 GdkFont* canvasFont;
61 public:
62 static int ConfigureEvent(GtkWidget* w, GdkEventConfigure* event, void* o);
63 static int ExposeEvent(GtkWidget* w, GdkEventExpose* event, void* o);
64 GdkPixmap *pixmap; // buffered pixmap
65 void Reset(); // recreate the buffered bixmap
66
67 /*
68 * properties
69 */
75 VDKReadWriteValueProp<VDKCanvas,bool> EnableClear;
76
77 public:
78 VDKCanvas(VDKForm* owner, int w = 100, int h = 100);
79 virtual ~VDKCanvas();
83 void Clear();
84 void DrawString(int x, int y, char* text);
85 void DrawText(int x, int y, char* text, int n);
86 void DrawPoint(int x, int y);
87 void DrawLine(int x, int y, int x1, int y1);
88 void DrawRect(int filled,int x, int y, int w, int h);
89 void DrawArc(int filled,int x,int y, int width,
90 int height,int angle1, int angle2);
91 void DrawPolygon(int filled,GdkPoint *points, gint npoints);
92 void DrawPoints(GdkPoint *points, int npoints);
93 void DrawSegments(GdkSegment *segs, int nsegs);
94 void DrawLines(GdkPoint *points, int npoints);
95 void DrawPixmap(int x, int y, char *pixfile);
96 void DrawPixmap(int x, int y, VDKRawPixmap* pix);
97 void DrawPixmap(int x, int y, char ** data);
101 void Redraw();
102 void SetForeground(VDKRgb color, GtkStateType state = GTK_STATE_NORMAL);
103 void SetBackground(VDKRgb color, GtkStateType state = GTK_STATE_NORMAL);
104 void SetFont(VDKFont* f);
105};
106
107#endif
108
109
110
This class provides a canvas widget.
Definition: canvas.h:53
void SetBackground(VDKRgb color, GtkStateType state=GTK_STATE_NORMAL)
Definition: canvas.cc:505
void SetForeground(VDKRgb color, GtkStateType state=GTK_STATE_NORMAL)
Definition: canvas.cc:480
void SetFont(VDKFont *f)
Definition: canvas.cc:530
VDKReadWriteValueProp< VDKCanvas, bool > EnableClear
Definition: canvas.h:75
void Clear()
Definition: canvas.cc:80
void Redraw()
Definition: canvas.cc:134
provides a raw color object
Definition: colors.h:37
Provides a raw font.
Definition: vdkfont.h:38
VDKForm widgets, generally the outermost widget container.
Definition: forms.h:69
Definition: vdkobj.h:141
Provides a raw pixmap.
Definition: rawpixmap.h:38
Provides a simple RGB color structure.
Definition: vdkutils.h:38