Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

canvas.h

00001 /*
00002  * ===========================
00003  * VDK Visual Develeopment Kit
00004  * Version 0.6.1
00005  * May 1999
00006  * ===========================
00007  *
00008  * Copyright (C) 1998, Mario Motta
00009  * Developed by Mario Motta <mmotta@guest.net>
00010  * Modified by Tamas Kohegyi <tamas.kohegyi@unforgettable.com>
00011  *
00012  * This library is free software; you can redistribute it and/or
00013  * modify it under the terms of the GNU Library General Public 
00014  * License as published by the Free Software Foundation; either 
00015  * version 2 of the License, or (at your option) any later version. 
00016  * 
00017  * This library is distributed in the hope that it will be useful, 
00018  * but WITHOUT ANY WARRANTY; without even the implied warranty of 
00019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
00020  * Library General Public License for more details. 
00021  * 
00022  * You should have received a copy of the GNU Library General Public 
00023  * License along with this library; if not, write to the Free Software 
00024  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 
00025  * 02111-1307, USA. 
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   // bool dragFlag,startdragFlag; 
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;   // buffered pixmap 
00065   void Reset();        // recreate the buffered bixmap 
00066 
00067   /* 
00068    * properties 
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 

Generated on Sat May 4 23:45:37 2002 for vdk 2.0.1 by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002