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

FXDCHelper.h

Go to the documentation of this file.
00001 /********************************************************************************
00002 *                                                                               *
00003 *                Device Context (DC) helper routines                            *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 2003 by Mathew Robertson.   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 #ifndef FXDCHELPER_H
00023 #define FXDCHELPER_H
00024 
00025 namespace FXEX {
00026 
00027 /**
00028  * FXDCHelper provides drawing support routines which can be used in your custom widgets.
00029  * eg drawing various styles of rectangles.
00030  *
00031  * It takes frame style options (FRAME_*) for specifying the specific types of frame styles
00032  */
00033 class FXAPI FXDCHelper {
00034 
00035 protected:
00036   FXApp   *app;              // application
00037   FXuint   options;          // options
00038   FXDC    *device;           // the device to be drawn into
00039   FXColor  baseColor;        // Base color
00040   FXColor  hiliteColor;      // Highlight color
00041   FXColor  shadowColor;      // Shadow color
00042   FXColor  borderColor;      // Border color
00043   FXint    border;           // Border width
00044 
00045 public: // we can draw these routines
00046 
00047   /// various rectangles that can be drawn
00048   void drawBorderRectangle(FXint x,FXint y,FXint w,FXint h);
00049   void drawRaisedRectangle(FXint x,FXint y,FXint w,FXint h);
00050   void drawSunkenRectangle(FXint x,FXint y,FXint w,FXint h);
00051   void drawRidgeRectangle(FXint x,FXint y,FXint w,FXint h);
00052   void drawGrooveRectangle(FXint x,FXint y,FXint w,FXint h);
00053   void drawDoubleRaisedRectangle(FXint x,FXint y,FXint w,FXint h);
00054   void drawDoubleSunkenRectangle(FXint x,FXint y,FXint w,FXint h);
00055   void drawFocusRectangle(FXint x,FXint y,FXint w,FXint h);
00056   void drawFrame(FXint x,FXint y,FXint w,FXint h);
00057 
00058   /// fill region
00059   void fillRegion(const FXRegion& region);
00060 
00061   /// fill an arc centered at x,y
00062   /// width,height from center
00063   /// start-angle,end-angle in degrees from 12 oclock, clockwise
00064   void fillArc(FXint x,FXint y,FXint w,FXint h,FXfloat start,FXfloat end);
00065 
00066 public:
00067   /// Construct packer layout manager
00068   FXDCHelper(FXApp *a,FXDC *dc=NULL,FXuint opts=0);
00069 
00070   /// Construct based on existing helper
00071   FXDCHelper(const FXDCHelper& h);
00072 
00073   /// assign from other DC helper
00074   FXDCHelper &operator=(const FXDCHelper& h);
00075 
00076   /// get application
00077   FXApp* getApp() { return app; }
00078 
00079   /// set's the current DC
00080   void setDC(FXDC *dc) { device=dc; }
00081 
00082   /// get the curretn DC
00083   FXDC *getDC() const { return device; }
00084 
00085   /// Change frame style
00086   void setFrameStyle(FXuint style);
00087 
00088   /// Get current frame style
00089   FXuint getFrameStyle() const;
00090 
00091   /// Get border width
00092   FXint getBorderWidth() const { return border; }
00093 
00094   /// Change highlight color
00095   void setHiliteColor(FXColor clr);
00096 
00097   /// Get highlight color
00098   FXColor getHiliteColor() const { return hiliteColor; }
00099 
00100   /// Change shadow color
00101   void setShadowColor(FXColor clr);
00102 
00103   /// Get shadow color
00104   FXColor getShadowColor() const { return shadowColor; }
00105 
00106   /// Change border color
00107   void setBorderColor(FXColor clr);
00108 
00109   /// Get border color
00110   FXColor getBorderColor() const { return borderColor; }
00111 
00112   /// Change base gui color
00113   void setBaseColor(FXColor clr);
00114 
00115   /// Get base gui color
00116   FXColor getBaseColor() const { return baseColor; }
00117 
00118   /// dtor
00119   virtual ~FXDCHelper();
00120   };
00121 
00122 } // namespace FXEX
00123 #endif // FXDCHELPER_H
00124