gdiplus: Added GdipLoadImageFromFileICM (no icm yet).
[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 #include "wine/debug.h"
32
33 WINE_DEFAULT_DEBUG_CHANNEL(gdiplus);
34
35 GpStatus WINGDIPAPI GdipCreateStringFormat(INT attr, LANGID lang,
36     GpStringFormat **format)
37 {
38     if(!format)
39         return InvalidParameter;
40
41     *format = GdipAlloc(sizeof(GpStringFormat));
42     if(!*format)   return OutOfMemory;
43
44     (*format)->attr = attr;
45     (*format)->lang = lang;
46     (*format)->trimming = StringTrimmingCharacter;
47
48     return Ok;
49 }
50
51 GpStatus WINGDIPAPI GdipDeleteStringFormat(GpStringFormat *format)
52 {
53     if(!format)
54         return InvalidParameter;
55
56     GdipFree(format);
57
58     return Ok;
59 }
60
61 GpStatus WINGDIPAPI GdipGetStringFormatAlign(GpStringFormat *format,
62     StringAlignment *align)
63 {
64     if(!format || !align)
65         return InvalidParameter;
66
67     *align = format->align;
68
69     return Ok;
70 }
71
72 GpStatus WINGDIPAPI GdipGetStringFormatHotkeyPrefix(GDIPCONST GpStringFormat
73     *format, INT *hkpx)
74 {
75     if(!format || !hkpx)
76         return InvalidParameter;
77
78     *hkpx = (INT)format->hkprefix;
79
80     return Ok;
81 }
82
83 GpStatus WINGDIPAPI GdipGetStringFormatLineAlign(GpStringFormat *format,
84     StringAlignment *align)
85 {
86     if(!format || !align)
87         return InvalidParameter;
88
89     *align = format->vertalign;
90
91     return Ok;
92 }
93
94 GpStatus WINGDIPAPI GdipGetStringFormatTrimming(GpStringFormat *format,
95     StringTrimming *trimming)
96 {
97     if(!format || !trimming)
98         return InvalidParameter;
99
100     *trimming = format->trimming;
101
102     return Ok;
103 }
104
105 GpStatus WINGDIPAPI GdipSetStringFormatAlign(GpStringFormat *format,
106     StringAlignment align)
107 {
108     if(!format)
109         return InvalidParameter;
110
111     format->align = align;
112
113     return Ok;
114 }
115
116 GpStatus WINGDIPAPI GdipSetStringFormatHotkeyPrefix(GpStringFormat *format,
117     INT hkpx)
118 {
119     if(!format || hkpx < 0 || hkpx > 2)
120         return InvalidParameter;
121
122     format->hkprefix = (HotkeyPrefix) hkpx;
123
124     return Ok;
125 }
126
127 GpStatus WINGDIPAPI GdipSetStringFormatLineAlign(GpStringFormat *format,
128     StringAlignment align)
129 {
130     if(!format)
131         return InvalidParameter;
132
133     format->vertalign = align;
134
135     return Ok;
136 }
137
138 GpStatus WINGDIPAPI GdipSetStringFormatTrimming(GpStringFormat *format,
139     StringTrimming trimming)
140 {
141     if(!format)
142         return InvalidParameter;
143
144     format->trimming = trimming;
145
146     return Ok;
147 }
148
149 GpStatus WINGDIPAPI GdipSetStringFormatFlags(GDIPCONST GpStringFormat *format, INT flags)
150 {
151     FIXME("format (%p) flags (%d)\n", format, flags);
152
153     return Ok;
154 }
155
156 GpStatus WINGDIPAPI GdipCloneStringFormat(GDIPCONST GpStringFormat *format, GpStringFormat **newFormat)
157 {
158     if(!format || !newFormat)
159         return InvalidParameter;
160
161     *newFormat = GdipAlloc(sizeof(GpStringFormat));
162     if(!*newFormat)    return OutOfMemory;
163
164     **newFormat = *format;
165
166     TRACE("%p %p\n",format,newFormat);
167
168     return Ok;
169 }