mshtml: Use heap_alloc_zero in HTMLElementCollection_Create.
[wine/gsoc_dplay.git] / dlls / gdiplus / stringformat.c
blobbd5d6ad0920f5cbe94adc90d43381d0c6064d7dc
1 /*
3 * Copyright (C) 2007 Google (Evan Stade)
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 #include <stdarg.h>
22 #include "windef.h"
23 #include "winbase.h"
24 #include "wingdi.h"
25 #include "winnls.h"
27 #include "objbase.h"
29 #include "gdiplus.h"
30 #include "gdiplus_private.h"
31 #include "wine/debug.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(gdiplus);
35 GpStatus WINGDIPAPI GdipCreateStringFormat(INT attr, LANGID lang,
36 GpStringFormat **format)
38 if(!format)
39 return InvalidParameter;
41 *format = GdipAlloc(sizeof(GpStringFormat));
42 if(!*format) return OutOfMemory;
44 (*format)->attr = attr;
45 (*format)->lang = lang;
46 (*format)->trimming = StringTrimmingCharacter;
48 return Ok;
51 GpStatus WINGDIPAPI GdipDeleteStringFormat(GpStringFormat *format)
53 if(!format)
54 return InvalidParameter;
56 GdipFree(format);
58 return Ok;
61 GpStatus WINGDIPAPI GdipGetStringFormatAlign(GpStringFormat *format,
62 StringAlignment *align)
64 if(!format || !align)
65 return InvalidParameter;
67 *align = format->align;
69 return Ok;
72 GpStatus WINGDIPAPI GdipGetStringFormatHotkeyPrefix(GDIPCONST GpStringFormat
73 *format, INT *hkpx)
75 if(!format || !hkpx)
76 return InvalidParameter;
78 *hkpx = (INT)format->hkprefix;
80 return Ok;
83 GpStatus WINGDIPAPI GdipGetStringFormatLineAlign(GpStringFormat *format,
84 StringAlignment *align)
86 if(!format || !align)
87 return InvalidParameter;
89 *align = format->vertalign;
91 return Ok;
94 GpStatus WINGDIPAPI GdipGetStringFormatTrimming(GpStringFormat *format,
95 StringTrimming *trimming)
97 if(!format || !trimming)
98 return InvalidParameter;
100 *trimming = format->trimming;
102 return Ok;
105 GpStatus WINGDIPAPI GdipSetStringFormatAlign(GpStringFormat *format,
106 StringAlignment align)
108 if(!format)
109 return InvalidParameter;
111 format->align = align;
113 return Ok;
116 GpStatus WINGDIPAPI GdipSetStringFormatHotkeyPrefix(GpStringFormat *format,
117 INT hkpx)
119 if(!format || hkpx < 0 || hkpx > 2)
120 return InvalidParameter;
122 format->hkprefix = (HotkeyPrefix) hkpx;
124 return Ok;
127 GpStatus WINGDIPAPI GdipSetStringFormatLineAlign(GpStringFormat *format,
128 StringAlignment align)
130 if(!format)
131 return InvalidParameter;
133 format->vertalign = align;
135 return Ok;
138 GpStatus WINGDIPAPI GdipSetStringFormatTrimming(GpStringFormat *format,
139 StringTrimming trimming)
141 if(!format)
142 return InvalidParameter;
144 format->trimming = trimming;
146 return Ok;
149 GpStatus WINGDIPAPI GdipSetStringFormatFlags(GDIPCONST GpStringFormat *format, INT flags)
151 FIXME("format (%p) flags (%d)\n", format, flags);
153 return Ok;
156 GpStatus WINGDIPAPI GdipCloneStringFormat(GDIPCONST GpStringFormat *format, GpStringFormat **newFormat)
158 if(!format || !newFormat)
159 return InvalidParameter;
161 *newFormat = GdipAlloc(sizeof(GpStringFormat));
162 if(!*newFormat) return OutOfMemory;
164 **newFormat = *format;
166 TRACE("%p %p\n",format,newFormat);
168 return Ok;