vdkdrawarea.h

00001 
00002 /*
00003  * ===========================
00004  * VDK Visual Develeopment Kit
00005  * Version 2.0.0
00006  * March 2002
00007  * ===========================
00008  *
00009  * Copyright (C) 2002, Mario Motta
00010  * Developed by Mario Motta <mmotta@guest.net>
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  _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 

Generated on Fri Jan 12 14:48:28 2007 for vdk 2.4.0 by  doxygen 1.5.1