]> git.saurik.com Git - wxWidgets.git/blob - contrib/include/wx/ogl/mfutils.h
added support for colour cursors in wxGTK (patch 1655576)
[wxWidgets.git] / contrib / include / wx / ogl / mfutils.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: mfutils.h
3 // Purpose: Metafile utilities: reading a placeable metafile independently
4 // of Windows.
5 // Author: Julian Smart
6 // Modified by:
7 // Created: 12/07/98
8 // RCS-ID: $Id$
9 // Copyright: (c) Julian Smart
10 // Licence: wxWindows licence
11 /////////////////////////////////////////////////////////////////////////////
12
13 #ifndef _MFUTILS_H_
14 #define _MFUTILS_H_
15
16
17 #include "wx/metafile.h"
18
19 #ifndef GetRValue
20 #define GetRValue(rgb) ((unsigned char)(rgb))
21 #define GetGValue(rgb) ((unsigned char)(((int)(rgb)) >> 8))
22 #define GetBValue(rgb) ((unsigned char)((rgb)>>16))
23 #endif
24
25 /* Metafile Functions */
26 // some compilers have them in their include files
27
28 #ifndef META_SETBKCOLOR
29 #define META_SETBKCOLOR 0x0201
30 #endif
31 #ifndef META_SETBKMODE
32 #define META_SETBKMODE 0x0102
33 #endif
34 #ifndef META_SETMAPMODE
35 #define META_SETMAPMODE 0x0103
36 #endif
37 #ifndef META_SETROP2
38 #define META_SETROP2 0x0104
39 #endif
40 #ifndef META_SETRELABS
41 #define META_SETRELABS 0x0105
42 #endif
43 #ifndef META_SETPOLYFILLMODE
44 #define META_SETPOLYFILLMODE 0x0106
45 #endif
46 #ifndef META_SETSTRETCHBLTMODE
47 #define META_SETSTRETCHBLTMODE 0x0107
48 #endif
49 #ifndef META_SETTEXTCHAREXTRA
50 #define META_SETTEXTCHAREXTRA 0x0108
51 #endif
52 #ifndef META_SETTEXTCOLOR
53 #define META_SETTEXTCOLOR 0x0209
54 #endif
55 #ifndef META_SETTEXTJUSTIFICATION
56 #define META_SETTEXTJUSTIFICATION 0x020A
57 #endif
58 #ifndef META_SETWINDOWORG
59 #define META_SETWINDOWORG 0x020B
60 #endif
61 #ifndef META_SETWINDOWEXT
62 #define META_SETWINDOWEXT 0x020C
63 #endif
64 #ifndef META_SETVIEWPORTORG
65 #define META_SETVIEWPORTORG 0x020D
66 #endif
67 #ifndef META_SETVIEWPORTEXT
68 #define META_SETVIEWPORTEXT 0x020E
69 #endif
70 #ifndef META_OFFSETWINDOWORG
71 #define META_OFFSETWINDOWORG 0x020F
72 #endif
73 #ifndef META_SCALEWINDOWEXT
74 #define META_SCALEWINDOWEXT 0x0410
75 #endif
76 #ifndef META_OFFSETVIEWPORTORG
77 #define META_OFFSETVIEWPORTORG 0x0211
78 #endif
79 #ifndef META_SCALEVIEWPORTEXT
80 #define META_SCALEVIEWPORTEXT 0x0412
81 #endif
82 #ifndef META_LINETO
83 #define META_LINETO 0x0213
84 #endif
85 #ifndef META_MOVETO
86 #define META_MOVETO 0x0214
87 #endif
88 #ifndef META_EXCLUDECLIPRECT
89 #define META_EXCLUDECLIPRECT 0x0415
90 #endif
91 #ifndef META_INTERSECTCLIPRECT
92 #define META_INTERSECTCLIPRECT 0x0416
93 #endif
94 #ifndef META_ARC
95 #define META_ARC 0x0817
96 #endif
97 #ifndef META_ELLIPSE
98 #define META_ELLIPSE 0x0418
99 #endif
100 #ifndef META_FLOODFILL
101 #define META_FLOODFILL 0x0419
102 #endif
103 #ifndef META_PIE
104 #define META_PIE 0x081A
105 #endif
106 #ifndef META_RECTANGLE
107 #define META_RECTANGLE 0x041B
108 #endif
109 #ifndef META_ROUNDRECT
110 #define META_ROUNDRECT 0x061C
111 #endif
112 #ifndef META_PATBLT
113 #define META_PATBLT 0x061D
114 #endif
115 #ifndef META_SAVEDC
116 #define META_SAVEDC 0x001E
117 #endif
118 #ifndef META_SETPIXEL
119 #define META_SETPIXEL 0x041F
120 #endif
121 #ifndef META_OFFSETCLIPRGN
122 #define META_OFFSETCLIPRGN 0x0220
123 #endif
124 #ifndef META_TEXTOUT
125 #define META_TEXTOUT 0x0521
126 #endif
127 #ifndef META_BITBLT
128 #define META_BITBLT 0x0922
129 #endif
130 #ifndef META_STRETCHBLT
131 #define META_STRETCHBLT 0x0B23
132 #endif
133 #ifndef META_POLYGON
134 #define META_POLYGON 0x0324
135 #endif
136 #ifndef META_POLYLINE
137 #define META_POLYLINE 0x0325
138 #endif
139 #ifndef META_ESCAPE
140 #define META_ESCAPE 0x0626
141 #endif
142 #ifndef META_RESTOREDC
143 #define META_RESTOREDC 0x0127
144 #endif
145 #ifndef META_FILLREGION
146 #define META_FILLREGION 0x0228
147 #endif
148 #ifndef META_FRAMEREGION
149 #define META_FRAMEREGION 0x0429
150 #endif
151 #ifndef META_INVERTREGION
152 #define META_INVERTREGION 0x012A
153 #endif
154 #ifndef META_PAINTREGION
155 #define META_PAINTREGION 0x012B
156 #endif
157 #ifndef META_SELECTCLIPREGION
158 #define META_SELECTCLIPREGION 0x012C
159 #endif
160 #ifndef META_SELECTOBJECT
161 #define META_SELECTOBJECT 0x012D
162 #endif
163 #ifndef META_SETTEXTALIGN
164 #define META_SETTEXTALIGN 0x012E
165 #endif
166 #ifndef META_DRAWTEXT
167 #define META_DRAWTEXT 0x062F
168 #endif
169
170 #ifndef META_CHORD
171 #define META_CHORD 0x0830
172 #endif
173 #ifndef META_SETMAPPERFLAGS
174 #define META_SETMAPPERFLAGS 0x0231
175 #endif
176 #ifndef META_EXTTEXTOUT
177 #define META_EXTTEXTOUT 0x0a32
178 #endif
179 #ifndef META_SETDIBTODEV
180 #define META_SETDIBTODEV 0x0d33
181 #endif
182 #ifndef META_SELECTPALETTE
183 #define META_SELECTPALETTE 0x0234
184 #endif
185 #ifndef META_REALIZEPALETTE
186 #define META_REALIZEPALETTE 0x0035
187 #endif
188 #ifndef META_ANIMATEPALETTE
189 #define META_ANIMATEPALETTE 0x0436
190 #endif
191 #ifndef META_SETPALENTRIES
192 #define META_SETPALENTRIES 0x0037
193 #endif
194 #ifndef META_POLYPOLYGON
195 #define META_POLYPOLYGON 0x0538
196 #endif
197 #ifndef META_RESIZEPALETTE
198 #define META_RESIZEPALETTE 0x0139
199 #endif
200
201 #ifndef META_DIBBITBLT
202 #define META_DIBBITBLT 0x0940
203 #endif
204 #ifndef META_DIBSTRETCHBLT
205 #define META_DIBSTRETCHBLT 0x0b41
206 #endif
207 #ifndef META_DIBCREATEPATTERNBRUSH
208 #define META_DIBCREATEPATTERNBRUSH 0x0142
209 #endif
210 #ifndef META_STRETCHDIB
211 #define META_STRETCHDIB 0x0f43
212 #endif
213
214 #ifndef META_EXTFLOODFILL
215 #define META_EXTFLOODFILL 0x0548
216 #endif
217
218 #ifndef META_RESETDC
219 #define META_RESETDC 0x014C
220 #endif
221 #ifndef META_STARTDOC
222 #define META_STARTDOC 0x014D
223 #endif
224 #ifndef META_STARTPAGE
225 #define META_STARTPAGE 0x004F
226 #endif
227 #ifndef META_ENDPAGE
228 #define META_ENDPAGE 0x0050
229 #endif
230 #ifndef META_ABORTDOC
231 #define META_ABORTDOC 0x0052
232 #endif
233 #ifndef META_ENDDOC
234 #define META_ENDDOC 0x005E
235 #endif
236
237 #ifndef META_DELETEOBJECT
238 #define META_DELETEOBJECT 0x01f0
239 #endif
240
241 #ifndef META_CREATEPALETTE
242 #define META_CREATEPALETTE 0x00f7
243 #endif
244 #ifndef META_CREATEBRUSH
245 #define META_CREATEBRUSH 0x00F8
246 #endif
247 #ifndef META_CREATEPATTERNBRUSH
248 #define META_CREATEPATTERNBRUSH 0x01F9
249 #endif
250 #ifndef META_CREATEPENINDIRECT
251 #define META_CREATEPENINDIRECT 0x02FA
252 #endif
253 #ifndef META_CREATEFONTINDIRECT
254 #define META_CREATEFONTINDIRECT 0x02FB
255 #endif
256 #ifndef META_CREATEBRUSHINDIRECT
257 #define META_CREATEBRUSHINDIRECT 0x02FC
258 #endif
259 #ifndef META_CREATEBITMAPINDIRECT
260 #define META_CREATEBITMAPINDIRECT 0x02FD
261 #endif
262 #ifndef META_CREATEBITMAP
263 #define META_CREATEBITMAP 0x06FE
264 #endif
265 #ifndef META_CREATEREGION
266 #define META_CREATEREGION 0x06FF
267 #endif
268
269 /* Background Modes */
270 #ifndef TRANSPARENT
271 #define TRANSPARENT 1
272 #endif
273 #ifndef OPAQUE
274 #define OPAQUE 2
275 #endif
276
277 /* Pen Styles */
278 #ifndef PS_SOLID
279 #define PS_SOLID 0
280 #endif
281 #ifndef PS_DASH
282 #define PS_DASH 1
283 #endif
284 #ifndef PS_DOT
285 #define PS_DOT 2
286 #endif
287 #ifndef PS_DASHDOT
288 #define PS_DASHDOT 3
289 #endif
290 #ifndef PS_DASHDOTDOT
291 #define PS_DASHDOTDOT 4
292 #endif
293 #ifndef PS_NULL
294 #define PS_NULL 5
295 #endif
296 #ifndef PS_INSIDEFRAME
297 #define PS_INSIDEFRAME 6
298 #endif
299
300 /* PitchAndFamily family values (high 4 bits) */
301 #ifndef FF_DONTCARE
302 #define FF_DONTCARE 0x00
303 #endif
304 #ifndef FF_ROMAN
305 #define FF_ROMAN 0x10
306 #endif
307 #ifndef FF_SWISS
308 #define FF_SWISS 0x20
309 #endif
310 #ifndef FF_MODERN
311 #define FF_MODERN 0x30
312 #endif
313 #ifndef FF_SCRIPT
314 #define FF_SCRIPT 0x40
315 #endif
316 #ifndef FF_DECORATIVE
317 #define FF_DECORATIVE 0x50
318 #endif
319
320 /* Brush Styles */
321 #ifndef BS_SOLID
322 #define BS_SOLID 0
323 #endif
324 #ifndef BS_NULL
325 #define BS_NULL 1
326 #endif
327 #ifndef BS_HOLLOW
328 #define BS_HOLLOW BS_NULL
329 #endif
330 #ifndef BS_HATCHED
331 #define BS_HATCHED 2
332 #endif
333 #ifndef BS_PATTERN
334 #define BS_PATTERN 3
335 #endif
336 #ifndef BS_INDEXED
337 #define BS_INDEXED 4
338 #endif
339 #ifndef BS_DIBPATTERN
340 #define BS_DIBPATTERN 5
341 #endif
342
343 /* Hatch Styles */
344 #ifndef HS_HORIZONTAL
345 #define HS_HORIZONTAL 0
346 #endif
347 #ifndef HS_VERTICAL
348 #define HS_VERTICAL 1
349 #endif
350 #ifndef HS_FDIAGONAL
351 #define HS_FDIAGONAL 2
352 #endif
353 #ifndef HS_BDIAGONAL
354 #define HS_BDIAGONAL 3
355 #endif
356 #ifndef HS_CROSS
357 #define HS_CROSS 4
358 #endif
359 #ifndef HS_DIAGCROSS
360 #define HS_DIAGCROSS 5
361 #endif
362
363 class WXDLLIMPEXP_OGL wxMetaRecord: public wxObject
364 {
365 public:
366 int metaFunction;
367 long param1;
368 long param2;
369 long param3;
370 long param4;
371 long param5;
372 long param6;
373 long param7;
374 long param8;
375 wxChar *stringParam;
376 wxRealPoint *points;
377
378 wxMetaRecord(int fun)
379 {
380 metaFunction = fun; points = NULL; stringParam = NULL;
381 param1 = 0;
382 }
383 ~wxMetaRecord(void);
384 };
385
386 class WXDLLIMPEXP_OGL wxXMetaFile: public wxObject
387 {
388 public:
389 double lastX;
390 double lastY;
391 bool ok;
392
393 double left;
394 double top;
395 double right;
396 double bottom;
397
398 wxList metaRecords;
399 wxList gdiObjects; // List of wxMetaRecord objects created with Create...,
400 // referenced by position in list by SelectObject
401 wxXMetaFile(const wxChar* file = NULL);
402 ~wxXMetaFile(void);
403
404 // After this is called, the metafile cannot be used for anything
405 // since it is now owned by the clipboard.
406 bool SetClipboard(int width = 0, int height = 0);
407
408 bool Play(wxDC *dc);
409 inline bool Ok(void) const { return ok; }
410 bool ReadFile(const wxChar *file);
411 };
412
413 #endif
414 // _MFUTILS_H_