1 /**
2  * @file gdipluslinecaps.h
3  * Copyright 2012, 2013 MinGW.org project
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9  * and/or sell copies of the Software, and to permit persons to whom the
10  * Software is furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice (including the next
13  * paragraph) shall be included in all copies or substantial portions of the
14  * Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  * DEALINGS IN THE SOFTWARE.
23  */
24 /* Created by Markus Koenig <markus@stber-koenig.de> */
25 #ifndef __GDIPLUS_LINECAPS_H
26 #define __GDIPLUS_LINECAPS_H
27 #pragma GCC system_header
28 #include <_mingw.h>
29 
30 /*
31  * GDI+ AdjustableArrowCap class
32  */
33 
34 #ifndef __cplusplus
35 #error "A C++ compiler is required to include gdipluslinecaps.h."
36 #endif
37 
38 class AdjustableArrowCap: public CustomLineCap
39 {
40 public:
AdjustableArrowCap(REAL height,REAL width,BOOL isFilled)41 	AdjustableArrowCap(REAL height, REAL width, BOOL isFilled):
42 		CustomLineCap(NULL, Ok)
43 	{
44 		GpAdjustableArrowCap *nativeAdjustableArrowCap = NULL;
45 		lastStatus = DllExports::GdipCreateAdjustableArrowCap(
46 				height, width, isFilled,
47 				&nativeAdjustableArrowCap);
48 		nativeCustomLineCap = nativeAdjustableArrowCap;
49 	}
~AdjustableArrowCap()50 	virtual ~AdjustableArrowCap()
51 	{
52 	}
Clone()53 	virtual AdjustableArrowCap* Clone() const
54 	{
55 		GpCustomLineCap *cloneCustomLineCap = NULL;
56 		Status status = updateStatus(DllExports::GdipCloneCustomLineCap(
57 				nativeCustomLineCap, &cloneCustomLineCap));
58 		if (status == Ok) {
59 			AdjustableArrowCap *result = new AdjustableArrowCap(
60 					cloneCustomLineCap, lastStatus);
61 			if (!result) {
62 				DllExports::GdipDeleteCustomLineCap(
63 						cloneCustomLineCap);
64 				lastStatus = OutOfMemory;
65 			}
66 			return result;
67 		} else {
68 			return NULL;
69 		}
70 	}
71 
GetHeight()72 	REAL GetHeight() const
73 	{
74 		REAL result = 0.0f;
75 		updateStatus(DllExports::GdipGetAdjustableArrowCapHeight(
76 				(GpAdjustableArrowCap*) nativeCustomLineCap,
77 				&result));
78 		return result;
79 	}
GetMiddleInset()80 	REAL GetMiddleInset() const
81 	{
82 		REAL result = 0.0f;
83 		updateStatus(DllExports::GdipGetAdjustableArrowCapMiddleInset(
84 				(GpAdjustableArrowCap*) nativeCustomLineCap,
85 				&result));
86 		return result;
87 	}
GetWidth()88 	REAL GetWidth() const
89 	{
90 		REAL result = 0.0f;
91 		updateStatus(DllExports::GdipGetAdjustableArrowCapWidth(
92 				(GpAdjustableArrowCap*) nativeCustomLineCap,
93 				&result));
94 		return result;
95 	}
IsFilled()96 	BOOL IsFilled() const
97 	{
98 		BOOL result = FALSE;
99 		updateStatus(DllExports::GdipGetAdjustableArrowCapFillState(
100 				(GpAdjustableArrowCap*) nativeCustomLineCap,
101 				&result));
102 		return result;
103 	}
SetFillState(BOOL isFilled)104 	Status SetFillState(BOOL isFilled)
105 	{
106 		return updateStatus(DllExports::GdipSetAdjustableArrowCapFillState(
107 				(GpAdjustableArrowCap*) nativeCustomLineCap,
108 				isFilled));
109 	}
SetHeight(REAL height)110 	Status SetHeight(REAL height)
111 	{
112 		return updateStatus(DllExports::GdipSetAdjustableArrowCapHeight(
113 				(GpAdjustableArrowCap*) nativeCustomLineCap,
114 				height));
115 	}
SetMiddleInset(REAL middleInset)116 	Status SetMiddleInset(REAL middleInset)
117 	{
118 		return updateStatus(DllExports::GdipSetAdjustableArrowCapMiddleInset(
119 				(GpAdjustableArrowCap*) nativeCustomLineCap,
120 				middleInset));
121 	}
SetWidth(REAL width)122 	Status SetWidth(REAL width)
123 	{
124 		return updateStatus(DllExports::GdipSetAdjustableArrowCapWidth(
125 				(GpAdjustableArrowCap*) nativeCustomLineCap,
126 				width));
127 	}
128 
129 private:
AdjustableArrowCap(GpCustomLineCap * customLineCap,Status status)130 	AdjustableArrowCap(GpCustomLineCap *customLineCap, Status status):
131 		CustomLineCap(customLineCap, status) {}
132 	AdjustableArrowCap(const AdjustableArrowCap&);
133 	AdjustableArrowCap& operator=(const AdjustableArrowCap&);
134 };
135 
136 #endif /* __GDIPLUS_LINECAPS_H */
137