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

FXDCWindow.h

Go to the documentation of this file.
00001 /********************************************************************************
00002 *                                                                               *
00003 *  D e v i c e   C o n t e x t   F o r   W i n d o w s   a n d   I m a g e s    *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 1999,2006 by Jeroen van der Zijp.   All Rights Reserved.        *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or                 *
00009 * modify it under the terms of the GNU Lesser General Public                    *
00010 * License as published by the Free Software Foundation; either                  *
00011 * version 2.1 of the License, or (at your option) any later version.            *
00012 *                                                                               *
00013 * This library is distributed in the hope that it will be useful,               *
00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of                *
00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU             *
00016 * Lesser General Public License for more details.                               *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public              *
00019 * License along with this library; if not, write to the Free Software           *
00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.    *
00021 *********************************************************************************
00022 * $Id: FXDCWindow.h,v 1.46 2006/01/22 17:58:00 fox Exp $                        *
00023 ********************************************************************************/
00024 #ifndef FXDCWINDOW_H
00025 #define FXDCWINDOW_H
00026 
00027 #ifndef FXDC_H
00028 #include "FXDC.h"
00029 #endif
00030 
00031 namespace FX {
00032 
00033 
00034 class FXApp;
00035 class FXDrawable;
00036 class FXImage;
00037 class FXBitmap;
00038 class FXIcon;
00039 class FXFont;
00040 class FXVisual;
00041 
00042 
00043 /**
00044 * Window Device Context
00045 *
00046 * The Window Device Context allows drawing into an FXDrawable, such as an
00047 * on-screen window (FXWindow and derivatives) or an off-screen image (FXImage
00048 * and its derivatives).
00049 * Because certain hardware resources are locked down, only one FXDCWindow may be
00050 * locked on a drawable at any one time.
00051 */
00052 class FXAPI FXDCWindow : public FXDC {
00053   friend class FXFont;
00054 protected:
00055   FXDrawable *surface;        // Drawable surface
00056   FXVisual   *visual;         // Visual of drawable
00057   FXRectangle rect;           // Paint rectangle inside drawable
00058 #ifndef WIN32
00059   FXuint      flags;          // GC Flags
00060   FXPixel     devfg;          // Device foreground pixel value
00061   FXPixel     devbg;          // Device background pixel value
00062   void       *xftDraw;        // Hook used only for XFT support
00063 #else
00064   FXID        oldpalette;
00065   FXID        oldbrush;
00066   FXID        oldpen;
00067   FXPixel     devfg;          // Device foreground pixel value
00068   FXPixel     devbg;          // Device background pixel value
00069   FXbool      needsNewBrush;
00070   FXbool      needsNewPen;
00071   FXbool      needsPath;
00072   FXbool      needsClipReset;
00073 #endif
00074 private:
00075 #ifdef WIN32
00076   void updateBrush();
00077   void updatePen();
00078 #endif
00079 private:
00080   FXDCWindow();
00081   FXDCWindow(const FXDCWindow&);
00082   FXDCWindow &operator=(const FXDCWindow&);
00083 public:
00084 
00085   /// Construct for painting in response to expose;
00086   /// This sets the clip rectangle to the exposed rectangle
00087   FXDCWindow(FXDrawable* drawable,FXEvent* event);
00088 
00089   /// Construct for normal drawing;
00090   /// This sets clip rectangle to the whole drawable
00091   FXDCWindow(FXDrawable* drawable);
00092 
00093   /// Begin locks in a drawable surface
00094   void begin(FXDrawable *drawable);
00095 
00096   /// End unlock the drawable surface
00097   void end();
00098 
00099   /// Read back pixel
00100   virtual FXColor readPixel(FXint x,FXint y);
00101 
00102   /// Draw points
00103   virtual void drawPoint(FXint x,FXint y);
00104   virtual void drawPoints(const FXPoint* points,FXuint npoints);
00105   virtual void drawPointsRel(const FXPoint* points,FXuint npoints);
00106 
00107   /// Draw lines
00108   virtual void drawLine(FXint x1,FXint y1,FXint x2,FXint y2);
00109   virtual void drawLines(const FXPoint* points,FXuint npoints);
00110   virtual void drawLinesRel(const FXPoint* points,FXuint npoints);
00111   virtual void drawLineSegments(const FXSegment* segments,FXuint nsegments);
00112 
00113   /// Draw rectangles
00114   virtual void drawRectangle(FXint x,FXint y,FXint w,FXint h);
00115   virtual void drawRectangles(const FXRectangle* rectangles,FXuint nrectangles);
00116 
00117   /// Draw rounded rectangle with ellipse with ew and ellips height eh
00118   virtual void drawRoundRectangle(FXint x,FXint y,FXint w,FXint h,FXint ew,FXint eh);
00119 
00120   /// Draw arcs
00121   virtual void drawArc(FXint x,FXint y,FXint w,FXint h,FXint ang1,FXint ang2);
00122   virtual void drawArcs(const FXArc* arcs,FXuint narcs);
00123 
00124   /// Draw ellipse
00125   virtual void drawEllipse(FXint x,FXint y,FXint w,FXint h);
00126 
00127   /// Filled rectangles
00128   virtual void fillRectangle(FXint x,FXint y,FXint w,FXint h);
00129   virtual void fillRectangles(const FXRectangle* rectangles,FXuint nrectangles);
00130 
00131   /// Filled rounded rectangle with ellipse with ew and ellips height eh
00132   virtual void fillRoundRectangle(FXint x,FXint y,FXint w,FXint h,FXint ew,FXint eh);
00133 
00134   /// Fill chord
00135   virtual void fillChord(FXint x,FXint y,FXint w,FXint h,FXint ang1,FXint ang2);
00136   virtual void fillChords(const FXArc* chords,FXuint nchords);
00137 
00138   /// Draw arcs
00139   virtual void fillArc(FXint x,FXint y,FXint w,FXint h,FXint ang1,FXint ang2);
00140   virtual void fillArcs(const FXArc* arcs,FXuint narcs);
00141 
00142   /// Fill ellipse
00143   virtual void fillEllipse(FXint x,FXint y,FXint w,FXint h);
00144 
00145   /// Filled polygon
00146   virtual void fillPolygon(const FXPoint* points,FXuint npoints);
00147   virtual void fillConcavePolygon(const FXPoint* points,FXuint npoints);
00148   virtual void fillComplexPolygon(const FXPoint* points,FXuint npoints);
00149 
00150   /// Filled polygon with relative points
00151   virtual void fillPolygonRel(const FXPoint* points,FXuint npoints);
00152   virtual void fillConcavePolygonRel(const FXPoint* points,FXuint npoints);
00153   virtual void fillComplexPolygonRel(const FXPoint* points,FXuint npoints);
00154 
00155   /// Draw hashed box
00156   virtual void drawHashBox(FXint x,FXint y,FXint w,FXint h,FXint b=1);
00157 
00158   /// Draw focus rectangle
00159   virtual void drawFocusRectangle(FXint x,FXint y,FXint w,FXint h);
00160 
00161   /// Draw area from source
00162   virtual void drawArea(const FXDrawable* source,FXint sx,FXint sy,FXint sw,FXint sh,FXint dx,FXint dy);
00163 
00164   /// Draw area stretched area from source
00165   virtual void drawArea(const FXDrawable* source,FXint sx,FXint sy,FXint sw,FXint sh,FXint dx,FXint dy,FXint dw,FXint dh);
00166 
00167   /// Draw image
00168   virtual void drawImage(const FXImage* image,FXint dx,FXint dy);
00169 
00170   /// Draw bitmap
00171   virtual void drawBitmap(const FXBitmap* bitmap,FXint dx,FXint dy);
00172 
00173   /// Draw icon
00174   virtual void drawIcon(const FXIcon* icon,FXint dx,FXint dy);
00175   virtual void drawIconShaded(const FXIcon* icon,FXint dx,FXint dy);
00176   virtual void drawIconSunken(const FXIcon* icon,FXint dx,FXint dy);
00177 
00178   /// Draw string with base line starting at x, y
00179   virtual void drawText(FXint x,FXint y,const FXString& string);
00180   virtual void drawText(FXint x,FXint y,const FXchar* string,FXuint length);
00181 
00182   /// Draw text starting at x, y over filled background
00183   virtual void drawImageText(FXint x,FXint y,const FXString& string);
00184   virtual void drawImageText(FXint x,FXint y,const FXchar* string,FXuint length);
00185 
00186   /// Set foreground/background drawing color
00187   virtual void setForeground(FXColor clr);
00188   virtual void setBackground(FXColor clr);
00189 
00190   /// Set dash pattern
00191   virtual void setDashes(FXuint dashoffset,const FXchar *dashpattern,FXuint dashlength);
00192 
00193   /// Set line width
00194   virtual void setLineWidth(FXuint linewidth=0);
00195 
00196   /// Set line cap style
00197   virtual void setLineCap(FXCapStyle capstyle=CAP_BUTT);
00198 
00199   /// Set line join style
00200   virtual void setLineJoin(FXJoinStyle joinstyle=JOIN_MITER);
00201 
00202   /// Set line style
00203   virtual void setLineStyle(FXLineStyle linestyle=LINE_SOLID);
00204 
00205   /// Set fill style
00206   virtual void setFillStyle(FXFillStyle fillstyle=FILL_SOLID);
00207 
00208   /// Set fill rule
00209   virtual void setFillRule(FXFillRule fillrule=RULE_EVEN_ODD);
00210 
00211   /// Set blit function
00212   virtual void setFunction(FXFunction func=BLT_SRC);
00213 
00214   /// Set the tile
00215   virtual void setTile(FXImage* tile,FXint dx=0,FXint dy=0);
00216 
00217   /// Set the stipple pattern
00218   virtual void setStipple(FXBitmap *stipple,FXint dx=0,FXint dy=0);
00219 
00220   /// Set the stipple pattern
00221   virtual void setStipple(FXStipplePattern stipple,FXint dx=0,FXint dy=0);
00222 
00223   /// Set clip region
00224   virtual void setClipRegion(const FXRegion& region);
00225 
00226   /// Set clip rectangle
00227   virtual void setClipRectangle(FXint x,FXint y,FXint w,FXint h);
00228 
00229   /// Set clip rectangle
00230   virtual void setClipRectangle(const FXRectangle& rectangle);
00231 
00232   /// Clear clipping
00233   virtual void clearClipRectangle();
00234 
00235   /// Set clip mask
00236   virtual void setClipMask(FXBitmap* mask,FXint dx=0,FXint dy=0);
00237 
00238   /// Clear clip mask
00239   virtual void clearClipMask();
00240 
00241   /// Set font to draw text with
00242   virtual void setFont(FXFont *fnt);
00243 
00244   /// Clip against child windows
00245   virtual void clipChildren(FXbool yes);
00246 
00247   /// Destructor
00248   virtual ~FXDCWindow();
00249   };
00250 
00251 }
00252 
00253 #endif

Copyright © 1997-2005 Jeroen van der Zijp