d3d9: Remove a few more incorrect D3DLOCK_DISCARDs.
[wine] / dlls / gdiplus / stringformat.c
1 /*
2  *
3  * Copyright (C) 2007 Google (Evan Stade)
4  *
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.
9  *
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.
14  *
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
18  */
19
20 #include <stdarg.h>
21
22 #include "windef.h"
23 #include "winbase.h"
24 #include "wingdi.h"
25 #include "winnls.h"
26
27 #include "objbase.h"
28
29 #include "gdiplus.h"
30 #include "gdiplus_private.h"
31
32 GpStatus WINGDIPAPI GdipCreateStringFormat(INT attr, LANGID lang,
33     GpStringFormat **format)
34 {
35     if(!format)
36         return InvalidParameter;
37
38     *format = GdipAlloc(sizeof(GpStringFormat));
39     if(!*format)   return OutOfMemory;
40
41     (*format)->attr = attr;
42     (*format)->lang = lang;
43     (*format)->trimming = StringTrimmingCharacter;
44
45     return Ok;
46 }
47
48 GpStatus WINGDIPAPI GdipDeleteStringFormat(GpStringFormat *format)
49 {
50     if(!format)
51         return InvalidParameter;
52
53     GdipFree(format);
54
55     return Ok;
56 }
57
58 GpStatus WINGDIPAPI GdipGetStringFormatAlign(GpStringFormat *format,
59     StringAlignment *align)
60 {
61     if(!format || !align)
62         return InvalidParameter;
63
64     *align = format->align;
65
66     return Ok;
67 }
68
69 GpStatus WINGDIPAPI GdipGetStringFormatHotkeyPrefix(GDIPCONST GpStringFormat
70     *format, INT *hkpx)
71 {
72     if(!format || !hkpx)
73         return InvalidParameter;
74
75     *hkpx = (INT)format->hkprefix;
76
77     return Ok;
78 }
79
80 GpStatus WINGDIPAPI GdipGetStringFormatLineAlign(GpStringFormat *format,
81     StringAlignment *align)
82 {
83     if(!format || !align)
84         return InvalidParameter;
85
86     *align = format->vertalign;
87
88     return Ok;
89 }
90
91 GpStatus WINGDIPAPI GdipGetStringFormatTrimming(GpStringFormat *format,
92     StringTrimming *trimming)
93 {
94     if(!format || !trimming)
95         return InvalidParameter;
96
97     *trimming = format->trimming;
98
99     return Ok;
100 }
101
102 GpStatus WINGDIPAPI GdipSetStringFormatAlign(GpStringFormat *format,
103     StringAlignment align)
104 {
105     if(!format)
106         return InvalidParameter;
107
108     format->align = align;
109
110     return Ok;
111 }
112
113 GpStatus WINGDIPAPI GdipSetStringFormatHotkeyPrefix(GpStringFormat *format,
114     INT hkpx)
115 {
116     if(!format || hkpx < 0 || hkpx > 2)
117         return InvalidParameter;
118
119     format->hkprefix = (HotkeyPrefix) hkpx;
120
121     return Ok;
122 }
123
124 GpStatus WINGDIPAPI GdipSetStringFormatLineAlign(GpStringFormat *format,
125     StringAlignment align)
126 {
127     if(!format)
128         return InvalidParameter;
129
130     format->vertalign = align;
131
132     return Ok;
133 }
134
135 GpStatus WINGDIPAPI GdipSetStringFormatTrimming(GpStringFormat *format,
136     StringTrimming trimming)
137 {
138     if(!format)
139         return InvalidParameter;
140
141     format->trimming = trimming;
142
143     return Ok;
144 }