ReactOS 0.4.15-dev-8408-g466a198
gdiplusstringformat.h
Go to the documentation of this file.
1/*
2 * GdiPlusStringFormat.h
3 *
4 * Windows GDI+
5 *
6 * This file is part of the w32api package.
7 *
8 * THIS SOFTWARE IS NOT COPYRIGHTED
9 *
10 * This source code is offered for use in the public domain. You may
11 * use, modify or distribute it freely.
12 *
13 * This code is distributed in the hope that it will be useful but
14 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
15 * DISCLAIMED. This includes but is not limited to warranties of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17 */
18
19#ifndef _GDIPLUSSTRINGFORMAT_H
20#define _GDIPLUSSTRINGFORMAT_H
21
23{
24 public:
25 StringFormat(INT formatFlags = 0, LANGID language = LANG_NEUTRAL) : nativeFormat(NULL)
26 {
27 lastStatus = DllExports::GdipCreateStringFormat(formatFlags, language, &nativeFormat);
28 }
29
31 {
32 lastStatus = DllExports::GdipCloneStringFormat(format ? format->nativeFormat : NULL, &nativeFormat);
33 }
34
36 Clone() const
37 {
38 GpStringFormat *cloneFormat = NULL;
39
40 lastStatus = DllExports::GdipCloneStringFormat(nativeFormat, &cloneFormat);
41 if (lastStatus != Ok)
42 return NULL;
43
44 StringFormat *newFormat = new StringFormat(cloneFormat, lastStatus);
45 if (!newFormat)
46 DllExports::GdipDeleteStringFormat(cloneFormat);
47 return newFormat;
48 }
49
51 {
52 DllExports::GdipDeleteStringFormat(nativeFormat);
53 }
54
55 static const StringFormat *
57 {
58 return NULL; // FIXME
59 }
60
61 static const StringFormat *
63 {
64 return NULL; // FIXME
65 }
66
69 {
70 StringAlignment alignment;
71 SetStatus(DllExports::GdipGetStringFormatAlign(nativeFormat, &alignment));
72 return alignment;
73 }
74
75 LANGID
77 {
78 LANGID language;
79 SetStatus(DllExports::GdipGetStringFormatDigitSubstitution(nativeFormat, &language, NULL));
80 return language;
81 }
82
85 {
86 StringDigitSubstitute substitute;
87 SetStatus(DllExports::GdipGetStringFormatDigitSubstitution(nativeFormat, NULL, &substitute));
88 return substitute;
89 }
90
91 INT
93 {
94 INT flags;
95 SetStatus(DllExports::GdipGetStringFormatFlags(nativeFormat, &flags));
96 return flags;
97 }
98
101 {
102 HotkeyPrefix hotkeyPrefix;
103 SetStatus(DllExports::GdipGetStringFormatHotkeyPrefix(nativeFormat, reinterpret_cast<INT *>(&hotkeyPrefix)));
104 return hotkeyPrefix;
105 }
106
107 Status
109 {
110 return lastStatus;
111 }
112
115 {
116 StringAlignment alignment;
117 SetStatus(DllExports::GdipGetStringFormatLineAlign(nativeFormat, &alignment));
118 return alignment;
119 }
120
121 INT
123 {
124 INT count;
125 SetStatus(DllExports::GdipGetStringFormatMeasurableCharacterRangeCount(nativeFormat, &count));
126 return count;
127 }
128
129 INT
131 {
132 INT count;
133 SetStatus(DllExports::GdipGetStringFormatTabStopCount(nativeFormat, &count));
134 return count;
135 }
136
137 Status
138 GetTabStops(INT count, REAL *firstTabOffset, REAL *tabStops) const
139 {
140 return SetStatus(DllExports::GdipGetStringFormatTabStops(nativeFormat, count, firstTabOffset, tabStops));
141 }
142
145 {
146 StringTrimming trimming;
147 SetStatus(DllExports::GdipGetStringFormatTrimming(nativeFormat, &trimming));
148 return trimming;
149 }
150
151 Status
153 {
154 return SetStatus(DllExports::GdipSetStringFormatAlign(nativeFormat, align));
155 }
156
157 Status
159 {
160 return SetStatus(DllExports::GdipSetStringFormatDigitSubstitution(nativeFormat, language, substitute));
161 }
162
163 Status
165 {
166 return SetStatus(DllExports::GdipSetStringFormatFlags(nativeFormat, flags));
167 }
168
169 Status
171 {
172 return SetStatus(DllExports::GdipSetStringFormatHotkeyPrefix(nativeFormat, INT(hotkeyPrefix)));
173 }
174
175 Status
177 {
178 return SetStatus(DllExports::GdipSetStringFormatLineAlign(nativeFormat, align));
179 }
180
181 Status
183 {
184 return SetStatus(DllExports::GdipSetStringFormatMeasurableCharacterRanges(nativeFormat, rangeCount, ranges));
185 }
186
187 Status
188 SetTabStops(REAL firstTabOffset, INT count, const REAL *tabStops)
189 {
190 return SetStatus(DllExports::GdipSetStringFormatTabStops(nativeFormat, firstTabOffset, count, tabStops));
191 }
192
193 Status
195 {
196 return SetStatus(DllExports::GdipSetStringFormatTrimming(nativeFormat, trimming));
197 }
198
199 protected:
202
204 {
205 }
206
207 Status
209 {
210 if (status != Ok)
212 return status;
213 }
214
215 // get native
216 friend inline GpStringFormat *&
218 {
219 return const_cast<StringFormat *>(sf)->nativeFormat;
220 }
221};
222
223#endif /* _GDIPLUSSTRINGFORMAT_H */
INT GetTabStopCount() const
Status GetLastStatus() const
static const StringFormat * GenericDefault()
INT GetMeasurableCharacterRangeCount() const
GpStringFormat * nativeFormat
StringFormat(const StringFormat *format)
Status SetDigitSubstitution(LANGID language, StringDigitSubstitute substitute)
Status GetTabStops(INT count, REAL *firstTabOffset, REAL *tabStops) const
StringFormat * Clone() const
StringFormat(GpStringFormat *format, Status status)
StringAlignment GetAlignment() const
StringFormat(INT formatFlags=0, LANGID language=LANG_NEUTRAL)
INT GetFormatFlags() const
Status SetMeasurableCharacterRanges(INT rangeCount, const CharacterRange *ranges)
Status SetTrimming(StringTrimming trimming)
Status SetHotkeyPrefix(HotkeyPrefix hotkeyPrefix)
Status SetFormatFlags(INT flags)
StringAlignment GetLineAlignment() const
Status SetLineAlignment(StringAlignment align)
StringTrimming GetTrimming() const
Status SetStatus(Status status) const
static const StringFormat * GenericTypographic()
HotkeyPrefix GetHotkeyPrefix() const
Status SetTabStops(REAL firstTabOffset, INT count, const REAL *tabStops)
StringDigitSubstitute GetDigitSubstitutionMethod() const
friend GpStringFormat *& getNat(const StringFormat *sf)
Status SetAlignment(StringAlignment align)
LANGID GetDigitSubstitutionLanguage() const
#define NULL
Definition: types.h:112
float REAL
Definition: types.h:41
int align(int length, int align)
Definition: dsound8.c:36
StringTrimming
Definition: gdiplusenums.h:292
StringAlignment
Definition: gdiplusenums.h:264
StringDigitSubstitute
Definition: gdiplusenums.h:271
HotkeyPrefix
Definition: gdiplusenums.h:312
Status
Definition: gdiplustypes.h:25
@ Ok
Definition: gdiplustypes.h:26
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
GLbitfield flags
Definition: glext.h:7161
USHORT LANGID
Definition: mui.h:9
#define INT
Definition: polytest.cpp:20
#define LANG_NEUTRAL
Definition: nls.h:22
Definition: ps.c:97
int32_t INT
Definition: typedefs.h:58