Naveen Neel / shedskin
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers gdipluslinecaps.h Source File

gdipluslinecaps.h

00001 /*
00002  * gdipluslinecaps.h
00003  *
00004  * GDI+ AdjustableArrowCap class
00005  *
00006  * This file is part of the w32api package.
00007  *
00008  * Contributors:
00009  *   Created by Markus Koenig <markus@stber-koenig.de>
00010  *
00011  * THIS SOFTWARE IS NOT COPYRIGHTED
00012  *
00013  * This source code is offered for use in the public domain. You may
00014  * use, modify or distribute it freely.
00015  *
00016  * This code is distributed in the hope that it will be useful but
00017  * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
00018  * DISCLAIMED. This includes but is not limited to warranties of
00019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00020  *
00021  */
00022 
00023 #ifndef __GDIPLUS_LINECAPS_H
00024 #define __GDIPLUS_LINECAPS_H
00025 #if __GNUC__ >=3
00026 #pragma GCC system_header
00027 #endif
00028 
00029 #ifndef __cplusplus
00030 #error "A C++ compiler is required to include gdipluslinecaps.h."
00031 #endif
00032 
00033 class AdjustableArrowCap: public CustomLineCap
00034 {
00035 public:
00036     AdjustableArrowCap(REAL height, REAL width, BOOL isFilled):
00037         CustomLineCap(NULL, Ok)
00038     {
00039         GpAdjustableArrowCap *nativeAdjustableArrowCap = NULL;
00040         lastStatus = DllExports::GdipCreateAdjustableArrowCap(
00041                 height, width, isFilled,
00042                 &nativeAdjustableArrowCap);
00043         nativeCustomLineCap = nativeAdjustableArrowCap;
00044     }
00045     virtual ~AdjustableArrowCap()
00046     {
00047     }
00048     virtual AdjustableArrowCap* Clone() const
00049     {
00050         GpCustomLineCap *cloneCustomLineCap = NULL;
00051         Status status = updateStatus(DllExports::GdipCloneCustomLineCap(
00052                 nativeCustomLineCap, &cloneCustomLineCap));
00053         if (status == Ok) {
00054             AdjustableArrowCap *result = new AdjustableArrowCap(
00055                     cloneCustomLineCap, lastStatus);
00056             if (!result) {
00057                 DllExports::GdipDeleteCustomLineCap(
00058                         cloneCustomLineCap);
00059                 lastStatus = OutOfMemory;
00060             }
00061             return result;
00062         } else {
00063             return NULL;
00064         }
00065     }
00066 
00067     REAL GetHeight() const
00068     {
00069         REAL result = 0.0f;
00070         updateStatus(DllExports::GdipGetAdjustableArrowCapHeight(
00071                 (GpAdjustableArrowCap*) nativeCustomLineCap,
00072                 &result));
00073         return result;
00074     }
00075     REAL GetMiddleInset() const
00076     {
00077         REAL result = 0.0f;
00078         updateStatus(DllExports::GdipGetAdjustableArrowCapMiddleInset(
00079                 (GpAdjustableArrowCap*) nativeCustomLineCap,
00080                 &result));
00081         return result;
00082     }
00083     REAL GetWidth() const
00084     {
00085         REAL result = 0.0f;
00086         updateStatus(DllExports::GdipGetAdjustableArrowCapWidth(
00087                 (GpAdjustableArrowCap*) nativeCustomLineCap,
00088                 &result));
00089         return result;
00090     }
00091     BOOL IsFilled() const
00092     {
00093         BOOL result = FALSE;
00094         updateStatus(DllExports::GdipGetAdjustableArrowCapFillState(
00095                 (GpAdjustableArrowCap*) nativeCustomLineCap,
00096                 &result));
00097         return result;
00098     }
00099     Status SetFillState(BOOL isFilled)
00100     {
00101         return updateStatus(DllExports::GdipSetAdjustableArrowCapFillState(
00102                 (GpAdjustableArrowCap*) nativeCustomLineCap,
00103                 isFilled));
00104     }
00105     Status SetHeight(REAL height)
00106     {
00107         return updateStatus(DllExports::GdipSetAdjustableArrowCapHeight(
00108                 (GpAdjustableArrowCap*) nativeCustomLineCap,
00109                 height));
00110     }
00111     Status SetMiddleInset(REAL middleInset)
00112     {
00113         return updateStatus(DllExports::GdipSetAdjustableArrowCapMiddleInset(
00114                 (GpAdjustableArrowCap*) nativeCustomLineCap,
00115                 middleInset));
00116     }
00117     Status SetWidth(REAL width)
00118     {
00119         return updateStatus(DllExports::GdipSetAdjustableArrowCapWidth(
00120                 (GpAdjustableArrowCap*) nativeCustomLineCap,
00121                 width));
00122     }
00123 
00124 private:
00125     AdjustableArrowCap(GpCustomLineCap *customLineCap, Status status):
00126         CustomLineCap(customLineCap, status) {}
00127     AdjustableArrowCap(const AdjustableArrowCap&);
00128     AdjustableArrowCap& operator=(const AdjustableArrowCap&);
00129 };
00130 
00131 #endif /* __GDIPLUS_LINECAPS_H */