![]() |
Main Page
Class Hierarchy
Alphabetical List
Compound List
File List
Compound Members
![]() |
00001 /******************************************************************************** 00002 * * 00003 * Region 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 FXREGIONHELPER_H 00023 #define FXREGIONHELPER_H 00024 00025 namespace FXEX { 00026 00027 /** 00028 * Creates a region object which you can then build up the shapes within that region. 00029 * This allows you to build up a shape as needed. 00030 */ 00031 class FXAPI FXRegionHelper { 00032 00033 protected: 00034 FXRegion region; // the region to use 00035 00036 private: 00037 // make an arc 00038 void makeArc(FXint x,FXint y,FXint w,FXint h,FXuint npoints,FXPoint *points); 00039 00040 public: 00041 /// create regions 00042 void createPolygon(const FXPoint* points,FXuint npoints,FXbool winding=FALSE); 00043 void createEllipse(FXint x,FXint y,FXint w,FXint h,FXuint npoints=180); 00044 void createCircle(FXint x,FXint y,FXint w,FXuint npoints=180); 00045 void createRectangle(FXint x,FXint y,FXint w,FXint h); 00046 void createSquare(FXint x,FXint y,FXint w); 00047 void createTriangle(FXint x1,FXint y1,FXint x2,FXint y2,FXint x3,FXint y3); 00048 00049 public: 00050 /// Construct region helper 00051 FXRegionHelper(); 00052 00053 /// Build from existing region helper 00054 FXRegionHelper(const FXRegionHelper&); 00055 00056 /// Build region from existing region 00057 FXRegionHelper(const FXRegion& r); 00058 00059 /// get the region 00060 FXRegion& getRegion() { return region; } 00061 00062 /// reset/clear/empty the region back to a zero region 00063 void clear(); 00064 00065 /// assign to new region, from existing region helper 00066 FXRegionHelper& operator=(const FXRegionHelper& r); 00067 00068 /// assign to new region, from existing region 00069 FXRegionHelper& operator=(const FXRegion& r); 00070 00071 /// dtor 00072 virtual ~FXRegionHelper(); 00073 }; 00074 00075 } // namespace FXEX 00076 #endif // FXREGIONHELPER_H