1 /* 2 * gdipluslinecaps.h 3 * 4 * GDI+ AdjustableArrowCap class 5 * 6 * This file is part of the w32api package. 7 * 8 * Contributors: 9 * Created by Markus Koenig <markus (at) stber-koenig.de> 10 * 11 * THIS SOFTWARE IS NOT COPYRIGHTED 12 * 13 * This source code is offered for use in the public domain. You may 14 * use, modify or distribute it freely. 15 * 16 * This code is distributed in the hope that it will be useful but 17 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY 18 * DISCLAIMED. This includes but is not limited to warranties of 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 20 * 21 */ 22 23 #ifndef __GDIPLUS_LINECAPS_H 24 #define __GDIPLUS_LINECAPS_H 25 #if __GNUC__ >=3 26 #pragma GCC system_header 27 #endif 28 29 #ifndef __cplusplus 30 #error "A C++ compiler is required to include gdipluslinecaps.h." 31 #endif 32 33 class AdjustableArrowCap: public CustomLineCap 34 { 35 public: 36 AdjustableArrowCap(REAL height, REAL width, BOOL isFilled): 37 CustomLineCap(NULL, Ok) 38 { 39 GpAdjustableArrowCap *nativeAdjustableArrowCap = NULL; 40 lastStatus = DllExports::GdipCreateAdjustableArrowCap( 41 height, width, isFilled, 42 &nativeAdjustableArrowCap); 43 nativeCustomLineCap = nativeAdjustableArrowCap; 44 } 45 virtual ~AdjustableArrowCap() 46 { 47 } 48 virtual AdjustableArrowCap* Clone() const 49 { 50 GpCustomLineCap *cloneCustomLineCap = NULL; 51 Status status = updateStatus(DllExports::GdipCloneCustomLineCap( 52 nativeCustomLineCap, &cloneCustomLineCap)); 53 if (status == Ok) { 54 AdjustableArrowCap *result = new AdjustableArrowCap( 55 cloneCustomLineCap, lastStatus); 56 if (!result) { 57 DllExports::GdipDeleteCustomLineCap( 58 cloneCustomLineCap); 59 lastStatus = OutOfMemory; 60 } 61 return result; 62 } else { 63 return NULL; 64 } 65 } 66 67 REAL GetHeight() const 68 { 69 REAL result = 0.0f; 70 updateStatus(DllExports::GdipGetAdjustableArrowCapHeight( 71 (GpAdjustableArrowCap*) nativeCustomLineCap, 72 &result)); 73 return result; 74 } 75 REAL GetMiddleInset() const 76 { 77 REAL result = 0.0f; 78 updateStatus(DllExports::GdipGetAdjustableArrowCapMiddleInset( 79 (GpAdjustableArrowCap*) nativeCustomLineCap, 80 &result)); 81 return result; 82 } 83 REAL GetWidth() const 84 { 85 REAL result = 0.0f; 86 updateStatus(DllExports::GdipGetAdjustableArrowCapWidth( 87 (GpAdjustableArrowCap*) nativeCustomLineCap, 88 &result)); 89 return result; 90 } 91 BOOL IsFilled() const 92 { 93 BOOL result = FALSE; 94 updateStatus(DllExports::GdipGetAdjustableArrowCapFillState( 95 (GpAdjustableArrowCap*) nativeCustomLineCap, 96 &result)); 97 return result; 98 } 99 Status SetFillState(BOOL isFilled) 100 { 101 return updateStatus(DllExports::GdipSetAdjustableArrowCapFillState( 102 (GpAdjustableArrowCap*) nativeCustomLineCap, 103 isFilled)); 104 } 105 Status SetHeight(REAL height) 106 { 107 return updateStatus(DllExports::GdipSetAdjustableArrowCapHeight( 108 (GpAdjustableArrowCap*) nativeCustomLineCap, 109 height)); 110 } 111 Status SetMiddleInset(REAL middleInset) 112 { 113 return updateStatus(DllExports::GdipSetAdjustableArrowCapMiddleInset( 114 (GpAdjustableArrowCap*) nativeCustomLineCap, 115 middleInset)); 116 } 117 Status SetWidth(REAL width) 118 { 119 return updateStatus(DllExports::GdipSetAdjustableArrowCapWidth( 120 (GpAdjustableArrowCap*) nativeCustomLineCap, 121 width)); 122 } 123 124 private: 125 AdjustableArrowCap(GpCustomLineCap *customLineCap, Status status): 126 CustomLineCap(customLineCap, status) {} 127 AdjustableArrowCap(const AdjustableArrowCap&); 128 AdjustableArrowCap& operator=(const AdjustableArrowCap&); 129 }; 130 131 #endif /* __GDIPLUS_LINECAPS_H */ 132