]>
Commit | Line | Data |
---|---|---|
7bf85405 RD |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: gdi.i | |
3 | // Purpose: SWIG interface file for wxDC, wxBrush, wxPen, wxFont, etc. | |
4 | // | |
5 | // Author: Robin Dunn | |
6 | // | |
7 | // Created: 7/7/97 | |
8 | // RCS-ID: $Id$ | |
9 | // Copyright: (c) 1998 by Total Control Software | |
10 | // Licence: wxWindows license | |
11 | ///////////////////////////////////////////////////////////////////////////// | |
12 | ||
13 | ||
03e9bead RD |
14 | %module gdi |
15 | ||
16 | %{ | |
7bf85405 | 17 | #include "helpers.h" |
7bf85405 | 18 | #include <wx/metafile.h> |
af309447 | 19 | #include <wx/imaglist.h> |
105e45b9 | 20 | #ifndef __WXMSW__ |
08127323 | 21 | #include <wx/dcps.h> |
105e45b9 | 22 | #endif |
7bf85405 RD |
23 | %} |
24 | ||
25 | //---------------------------------------------------------------------- | |
26 | ||
27 | %include typemaps.i | |
28 | %include my_typemaps.i | |
29 | ||
30 | // Import some definitions of other classes, etc. | |
31 | %import _defs.i | |
32 | %import misc.i | |
33 | ||
b68dc582 RD |
34 | %{ |
35 | static wxString wxPyEmptyStr(""); | |
36 | %} | |
37 | ||
7bf85405 RD |
38 | //--------------------------------------------------------------------------- |
39 | ||
9416aa89 RD |
40 | class wxGDIObject : public wxObject { |
41 | public: | |
42 | wxGDIObject(); | |
43 | ~wxGDIObject(); | |
44 | ||
45 | bool GetVisible(); | |
46 | void SetVisible( bool visible ); | |
47 | ||
48 | bool IsNull(); | |
49 | ||
50 | }; | |
6999b0d8 RD |
51 | |
52 | //--------------------------------------------------------------------------- | |
53 | ||
9416aa89 | 54 | class wxBitmap : public wxGDIObject |
5bff6bb8 | 55 | { |
7bf85405 | 56 | public: |
0a651eb8 | 57 | wxBitmap(const wxString& name, wxBitmapType type); |
7bf85405 RD |
58 | ~wxBitmap(); |
59 | ||
7bf85405 RD |
60 | wxPalette* GetPalette(); |
61 | wxMask* GetMask(); | |
7bf85405 | 62 | bool LoadFile(const wxString& name, long flags); |
7bf85405 | 63 | bool SaveFile(const wxString& name, int type, wxPalette* palette = NULL); |
7bf85405 | 64 | void SetMask(wxMask* mask); |
fb5e0af0 | 65 | #ifdef __WXMSW__ |
b8b8dda7 | 66 | void SetPalette(wxPalette& palette); |
fb5e0af0 | 67 | #endif |
5bff6bb8 RD |
68 | |
69 | // wxGDIImage methods | |
70 | #ifdef __WXMSW__ | |
71 | long GetHandle(); | |
72 | void SetHandle(long handle); | |
73 | #endif | |
74 | bool Ok(); | |
75 | int GetWidth(); | |
76 | int GetHeight(); | |
77 | int GetDepth(); | |
78 | void SetWidth(int w); | |
79 | void SetHeight(int h); | |
80 | void SetDepth(int d); | |
81 | #ifdef __WXMSW__ | |
82 | void SetSize(const wxSize& size); | |
83 | #endif | |
f6bcfd97 BP |
84 | |
85 | wxBitmap GetSubBitmap( const wxRect& rect ); | |
86 | #ifdef __WXMSW__ | |
87 | bool CopyFromIcon(const wxIcon& icon); | |
88 | bool CopyFromCursor(const wxCursor& cursor); | |
89 | int GetQuality(); | |
90 | void SetQuality(int q); | |
91 | #endif | |
92 | ||
93 | %pragma(python) addtoclass = " | |
94 | def __del__(self,gdic=gdic): | |
95 | try: | |
96 | if self.thisown == 1 : | |
97 | gdic.delete_wxBitmap(self) | |
98 | except: | |
99 | pass | |
100 | " | |
7bf85405 RD |
101 | }; |
102 | ||
5bff6bb8 | 103 | |
96bfd053 | 104 | // Declarations of some alternate "constructors" |
7bf85405 | 105 | %new wxBitmap* wxEmptyBitmap(int width, int height, int depth=-1); |
96bfd053 RD |
106 | %new wxBitmap* wxBitmapFromXPMData(PyObject* listOfStrings); |
107 | %new wxBitmap* wxBitmapFromIcon(const wxIcon& icon); | |
9c039d08 | 108 | |
8bf5d46e | 109 | #ifdef __WXMSW__ |
4c9993c3 | 110 | %new wxBitmap* wxBitmapFromData(PyObject* data, long type, |
8bf5d46e RD |
111 | int width, int height, int depth = 1); |
112 | #endif | |
113 | ||
96bfd053 RD |
114 | |
115 | ||
116 | %{ // Implementations of some alternate "constructors" | |
117 | ||
7bf85405 RD |
118 | wxBitmap* wxEmptyBitmap(int width, int height, int depth=-1) { |
119 | return new wxBitmap(width, height, depth); | |
120 | } | |
121 | ||
96bfd053 RD |
122 | static char** ConvertListOfStrings(PyObject* listOfStrings) { |
123 | char** cArray = NULL; | |
124 | int count; | |
125 | ||
126 | if (!PyList_Check(listOfStrings)) { | |
127 | PyErr_SetString(PyExc_TypeError, "Expected a list of strings."); | |
128 | return NULL; | |
129 | } | |
130 | count = PyList_Size(listOfStrings); | |
131 | cArray = new char*[count]; | |
132 | ||
133 | for(int x=0; x<count; x++) { | |
134 | // TODO: Need some validation and error checking here | |
135 | cArray[x] = PyString_AsString(PyList_GET_ITEM(listOfStrings, x)); | |
136 | } | |
137 | return cArray; | |
138 | } | |
139 | ||
140 | wxBitmap* wxBitmapFromXPMData(PyObject* listOfStrings) { | |
141 | char** cArray = NULL; | |
142 | wxBitmap* bmp; | |
143 | ||
144 | cArray = ConvertListOfStrings(listOfStrings); | |
145 | if (! cArray) | |
146 | return NULL; | |
147 | bmp = new wxBitmap(cArray); | |
148 | delete [] cArray; | |
149 | return bmp; | |
150 | } | |
151 | ||
152 | ||
153 | wxBitmap* wxBitmapFromIcon(const wxIcon& icon) { | |
154 | return new wxBitmap(icon); | |
155 | } | |
156 | ||
157 | ||
926bb76c | 158 | |
8bf5d46e | 159 | #ifdef __WXMSW__ |
4c9993c3 | 160 | wxBitmap* wxBitmapFromData(PyObject* data, long type, |
8bf5d46e | 161 | int width, int height, int depth = 1) { |
4c9993c3 RD |
162 | if (! PyString_Check(data)) { |
163 | PyErr_SetString(PyExc_TypeError, "Expected string object"); | |
164 | return NULL; | |
165 | } | |
166 | ||
167 | return new wxBitmap((void*)PyString_AsString(data), type, width, height, depth); | |
8bf5d46e RD |
168 | } |
169 | #endif | |
7bf85405 RD |
170 | %} |
171 | ||
172 | //--------------------------------------------------------------------------- | |
173 | ||
9416aa89 | 174 | class wxMask : public wxObject { |
7bf85405 RD |
175 | public: |
176 | wxMask(const wxBitmap& bitmap); | |
eb715945 | 177 | //~wxMask(); |
96bfd053 RD |
178 | |
179 | %addmethods { void Destroy() { delete self; } } | |
7bf85405 RD |
180 | }; |
181 | ||
182 | %new wxMask* wxMaskColour(const wxBitmap& bitmap, const wxColour& colour); | |
183 | %{ | |
184 | wxMask* wxMaskColour(const wxBitmap& bitmap, const wxColour& colour) { | |
185 | return new wxMask(bitmap, colour); | |
186 | } | |
187 | %} | |
188 | ||
189 | ||
190 | //--------------------------------------------------------------------------- | |
191 | ||
192 | ||
9416aa89 | 193 | class wxIcon : public wxGDIObject |
5bff6bb8 | 194 | { |
7bf85405 | 195 | public: |
fb5e0af0 RD |
196 | wxIcon(const wxString& name, long flags, |
197 | int desiredWidth = -1, int desiredHeight = -1); | |
7bf85405 RD |
198 | ~wxIcon(); |
199 | ||
7bf85405 | 200 | bool LoadFile(const wxString& name, long flags); |
5bff6bb8 RD |
201 | |
202 | // wxGDIImage methods | |
203 | #ifdef __WXMSW__ | |
204 | long GetHandle(); | |
205 | void SetHandle(long handle); | |
206 | #endif | |
207 | bool Ok(); | |
208 | int GetWidth(); | |
209 | int GetHeight(); | |
210 | int GetDepth(); | |
211 | void SetWidth(int w); | |
212 | void SetHeight(int h); | |
213 | void SetDepth(int d); | |
214 | #ifdef __WXMSW__ | |
215 | void SetSize(const wxSize& size); | |
216 | #endif | |
96bfd053 RD |
217 | void CopyFromBitmap(const wxBitmap& bmp); |
218 | ||
f6bcfd97 BP |
219 | %pragma(python) addtoclass = " |
220 | def __del__(self,gdic=gdic): | |
221 | try: | |
222 | if self.thisown == 1 : | |
223 | gdic.delete_wxIcon(self) | |
224 | except: | |
225 | pass | |
226 | " | |
7bf85405 RD |
227 | }; |
228 | ||
8bf5d46e | 229 | |
96bfd053 RD |
230 | // Declarations of some alternate "constructors" |
231 | %new wxIcon* wxEmptyIcon(); | |
232 | %new wxIcon* wxIconFromXPMData(PyObject* listOfStrings); | |
233 | ||
234 | %{ // Implementations of some alternate "constructors" | |
235 | wxIcon* wxEmptyIcon() { | |
236 | return new wxIcon(); | |
237 | } | |
238 | ||
239 | wxIcon* wxIconFromXPMData(PyObject* listOfStrings) { | |
240 | char** cArray = NULL; | |
241 | wxIcon* icon; | |
242 | ||
243 | cArray = ConvertListOfStrings(listOfStrings); | |
244 | if (! cArray) | |
245 | return NULL; | |
246 | icon = new wxIcon(cArray); | |
247 | delete [] cArray; | |
248 | return icon; | |
249 | } | |
250 | %} | |
251 | ||
7bf85405 RD |
252 | //--------------------------------------------------------------------------- |
253 | ||
9416aa89 | 254 | class wxCursor : public wxGDIObject |
5bff6bb8 | 255 | { |
7bf85405 | 256 | public: |
fb5e0af0 | 257 | #ifdef __WXMSW__ |
7bf85405 | 258 | wxCursor(const wxString& cursorName, long flags, int hotSpotX=0, int hotSpotY=0); |
fb5e0af0 | 259 | #endif |
7bf85405 | 260 | ~wxCursor(); |
5bff6bb8 RD |
261 | |
262 | // wxGDIImage methods | |
263 | #ifdef __WXMSW__ | |
264 | long GetHandle(); | |
265 | void SetHandle(long handle); | |
266 | #endif | |
267 | bool Ok(); | |
268 | #ifdef __WXMSW__ | |
269 | int GetWidth(); | |
270 | int GetHeight(); | |
271 | int GetDepth(); | |
272 | void SetWidth(int w); | |
273 | void SetHeight(int h); | |
274 | void SetDepth(int d); | |
275 | void SetSize(const wxSize& size); | |
276 | #endif | |
7bf85405 RD |
277 | }; |
278 | ||
9c039d08 | 279 | %name(wxStockCursor) %new wxCursor* wxPyStockCursor(int id); |
7bf85405 | 280 | %{ // Alternate 'constructor' |
9c039d08 | 281 | wxCursor* wxPyStockCursor(int id) { |
7bf85405 RD |
282 | return new wxCursor(id); |
283 | } | |
284 | %} | |
285 | ||
286 | //---------------------------------------------------------------------- | |
287 | ||
f0261a72 RD |
288 | |
289 | enum wxFontEncoding | |
290 | { | |
291 | wxFONTENCODING_SYSTEM = -1, // system default | |
292 | wxFONTENCODING_DEFAULT, // current default encoding | |
293 | ||
294 | // ISO8859 standard defines a number of single-byte charsets | |
295 | wxFONTENCODING_ISO8859_1, // West European (Latin1) | |
296 | wxFONTENCODING_ISO8859_2, // Central and East European (Latin2) | |
297 | wxFONTENCODING_ISO8859_3, // Esperanto (Latin3) | |
298 | wxFONTENCODING_ISO8859_4, // Baltic languages (Estonian) (Latin4) | |
299 | wxFONTENCODING_ISO8859_5, // Cyrillic | |
300 | wxFONTENCODING_ISO8859_6, // Arabic | |
301 | wxFONTENCODING_ISO8859_7, // Greek | |
302 | wxFONTENCODING_ISO8859_8, // Hebrew | |
303 | wxFONTENCODING_ISO8859_9, // Turkish (Latin5) | |
304 | wxFONTENCODING_ISO8859_10, // Variation of Latin4 (Latin6) | |
305 | wxFONTENCODING_ISO8859_11, // Thai | |
306 | wxFONTENCODING_ISO8859_12, // doesn't exist currently, but put it | |
307 | // here anyhow to make all ISO8859 | |
308 | // consecutive numbers | |
309 | wxFONTENCODING_ISO8859_13, // Latin7 | |
310 | wxFONTENCODING_ISO8859_14, // Latin8 | |
311 | wxFONTENCODING_ISO8859_15, // Latin9 (a.k.a. Latin0, includes euro) | |
312 | ||
313 | // Cyrillic charset soup (see http://czyborra.com/charsets/cyrillic.html) | |
314 | wxFONTENCODING_KOI8, // we don't support any of KOI8 variants | |
315 | wxFONTENCODING_ALTERNATIVE, // same as MS-DOS CP866 | |
316 | wxFONTENCODING_BULGARIAN, // used under Linux in Bulgaria | |
317 | ||
318 | // what would we do without Microsoft? They have their own encodings | |
319 | // for DOS | |
320 | wxFONTENCODING_CP437, // original MS-DOS codepage | |
321 | wxFONTENCODING_CP850, // CP437 merged with Latin1 | |
322 | wxFONTENCODING_CP852, // CP437 merged with Latin2 | |
323 | wxFONTENCODING_CP855, // another cyrillic encoding | |
324 | wxFONTENCODING_CP866, // and another one | |
325 | // and for Windows | |
326 | wxFONTENCODING_CP1250, // WinLatin2 | |
327 | wxFONTENCODING_CP1251, // WinCyrillic | |
328 | wxFONTENCODING_CP1252, // WinLatin1 | |
329 | ||
330 | wxFONTENCODING_MAX | |
331 | }; | |
332 | ||
0569df0f | 333 | |
9416aa89 | 334 | class wxFont : public wxGDIObject { |
7bf85405 | 335 | public: |
0569df0f RD |
336 | wxFont( int pointSize, int family, int style, int weight, |
337 | int underline=FALSE, char* faceName = "", | |
338 | wxFontEncoding encoding=wxFONTENCODING_DEFAULT); | |
339 | ~wxFont(); | |
7bf85405 | 340 | |
694759cf | 341 | bool Ok(); |
7bf85405 RD |
342 | wxString GetFaceName(); |
343 | int GetFamily(); | |
08127323 | 344 | #ifdef __WXMSW__ |
7bf85405 | 345 | int GetFontId(); |
08127323 | 346 | #endif |
7bf85405 RD |
347 | int GetPointSize(); |
348 | int GetStyle(); | |
349 | bool GetUnderlined(); | |
350 | int GetWeight(); | |
f0261a72 | 351 | wxFontEncoding GetEncoding(); |
7bf85405 RD |
352 | void SetFaceName(const wxString& faceName); |
353 | void SetFamily(int family); | |
354 | void SetPointSize(int pointSize); | |
355 | void SetStyle(int style); | |
356 | void SetUnderlined(bool underlined); | |
357 | void SetWeight(int weight); | |
f0261a72 RD |
358 | void SetEncoding(wxFontEncoding encoding); |
359 | wxString GetFamilyString(); | |
360 | wxString GetStyleString(); | |
361 | wxString GetWeightString(); | |
7bf85405 RD |
362 | }; |
363 | ||
f0261a72 RD |
364 | %inline %{ |
365 | wxFontEncoding wxFont_GetDefaultEncoding() { | |
366 | return wxFont::GetDefaultEncoding(); | |
367 | } | |
368 | ||
369 | void wxFont_SetDefaultEncoding(wxFontEncoding encoding) { | |
370 | wxFont::SetDefaultEncoding(encoding); | |
371 | } | |
372 | %} | |
373 | ||
0569df0f | 374 | |
9416aa89 | 375 | class wxFontList : public wxObject { |
0569df0f RD |
376 | public: |
377 | ||
378 | void AddFont(wxFont* font); | |
379 | wxFont * FindOrCreateFont(int point_size, int family, int style, int weight, | |
380 | bool underline = FALSE, const char* facename = NULL, | |
381 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT); | |
382 | void RemoveFont(wxFont *font); | |
383 | }; | |
384 | ||
385 | ||
7bf85405 RD |
386 | //---------------------------------------------------------------------- |
387 | ||
9416aa89 | 388 | class wxColour : public wxObject { |
7bf85405 RD |
389 | public: |
390 | wxColour(unsigned char red=0, unsigned char green=0, unsigned char blue=0); | |
391 | ~wxColour(); | |
392 | unsigned char Red(); | |
393 | unsigned char Green(); | |
394 | unsigned char Blue(); | |
395 | bool Ok(); | |
396 | void Set(unsigned char red, unsigned char green, unsigned char blue); | |
397 | %addmethods { | |
398 | PyObject* Get() { | |
399 | PyObject* rv = PyTuple_New(3); | |
400 | PyTuple_SetItem(rv, 0, PyInt_FromLong(self->Red())); | |
401 | PyTuple_SetItem(rv, 1, PyInt_FromLong(self->Green())); | |
402 | PyTuple_SetItem(rv, 2, PyInt_FromLong(self->Blue())); | |
403 | return rv; | |
404 | } | |
405 | } | |
9b3d3bc4 RD |
406 | %pragma(python) addtoclass = "asTuple = Get" |
407 | %pragma(python) addtoclass = "def __str__(self): return str(self.asTuple())" | |
408 | %pragma(python) addtoclass = "def __repr__(self): return str(self.asTuple())" | |
409 | ||
7bf85405 RD |
410 | }; |
411 | ||
412 | %new wxColour* wxNamedColour(const wxString& colorName); | |
de20db99 | 413 | |
7bf85405 RD |
414 | %{ // Alternate 'constructor' |
415 | wxColour* wxNamedColour(const wxString& colorName) { | |
416 | return new wxColour(colorName); | |
417 | } | |
418 | %} | |
419 | ||
420 | ||
7bf85405 | 421 | |
9416aa89 | 422 | class wxColourDatabase : public wxObject { |
7bf85405 | 423 | public: |
0569df0f RD |
424 | |
425 | wxColour *FindColour(const wxString& colour); | |
426 | wxString FindName(const wxColour& colour) const; | |
427 | ||
7bf85405 | 428 | %addmethods { |
0569df0f RD |
429 | void Append(const wxString& name, int red, int green, int blue) { |
430 | self->Append(name.c_str(), new wxColour(red, green, blue)); | |
7bf85405 | 431 | } |
7bf85405 | 432 | } |
0569df0f RD |
433 | }; |
434 | ||
435 | ||
436 | //---------------------------------------------------------------------- | |
437 | ||
438 | ||
9416aa89 | 439 | class wxPen : public wxGDIObject { |
0569df0f RD |
440 | public: |
441 | wxPen(wxColour& colour, int width=1, int style=wxSOLID); | |
442 | ~wxPen(); | |
7bf85405 RD |
443 | |
444 | int GetCap(); | |
445 | wxColour& GetColour(); | |
446 | ||
fb5e0af0 | 447 | int GetJoin(); |
7bf85405 RD |
448 | int GetStyle(); |
449 | int GetWidth(); | |
450 | bool Ok(); | |
451 | void SetCap(int cap_style); | |
452 | void SetColour(wxColour& colour); | |
aeeb6a44 RR |
453 | void SetJoin(int join_style); |
454 | void SetStyle(int style); | |
455 | void SetWidth(int width); | |
08127323 | 456 | |
aeeb6a44 RR |
457 | // **** This one needs to return a list of ints (wxDash) |
458 | int GetDashes(wxDash **dashes); | |
eec92d76 | 459 | void SetDashes(int LCOUNT, wxDash* choices); |
6999b0d8 RD |
460 | |
461 | #ifdef __WXMSW__ | |
462 | wxBitmap* GetStipple(); | |
b8b8dda7 | 463 | void SetStipple(wxBitmap& stipple); |
fb5e0af0 | 464 | #endif |
7bf85405 RD |
465 | }; |
466 | ||
0569df0f | 467 | |
9416aa89 | 468 | class wxPenList : public wxObject { |
0569df0f RD |
469 | public: |
470 | ||
471 | void AddPen(wxPen* pen); | |
472 | wxPen* FindOrCreatePen(const wxColour& colour, int width, int style); | |
473 | void RemovePen(wxPen* pen); | |
474 | }; | |
475 | ||
476 | ||
477 | ||
7bf85405 RD |
478 | //---------------------------------------------------------------------- |
479 | ||
9416aa89 | 480 | class wxBrush : public wxGDIObject { |
7bf85405 | 481 | public: |
0569df0f RD |
482 | wxBrush(const wxColour& colour, int style=wxSOLID); |
483 | ~wxBrush(); | |
26b9cf27 | 484 | |
7bf85405 RD |
485 | wxColour& GetColour(); |
486 | wxBitmap * GetStipple(); | |
487 | int GetStyle(); | |
488 | bool Ok(); | |
489 | void SetColour(wxColour &colour); | |
b8b8dda7 | 490 | void SetStipple(wxBitmap& bitmap); |
7bf85405 RD |
491 | void SetStyle(int style); |
492 | }; | |
493 | ||
0569df0f RD |
494 | |
495 | class wxBrushList { | |
496 | public: | |
497 | ||
498 | void AddBrush(wxBrush *brush); | |
499 | wxBrush * FindOrCreateBrush(const wxColour& colour, int style); | |
500 | void RemoveBrush(wxBrush *brush); | |
501 | }; | |
502 | ||
7bf85405 RD |
503 | //---------------------------------------------------------------------- |
504 | ||
505 | ||
506 | ||
9416aa89 | 507 | class wxDC : public wxObject { |
7bf85405 | 508 | public: |
fb5e0af0 | 509 | // wxDC(); **** abstract base class, can't instantiate. |
7bf85405 RD |
510 | ~wxDC(); |
511 | ||
512 | void BeginDrawing(); | |
efc5f224 RD |
513 | // %name(BlitXY) |
514 | bool Blit(long xdest, long ydest, | |
515 | long width, long height, | |
516 | wxDC *source, long xsrc, long ysrc, | |
517 | int logicalFunc = wxCOPY, int useMask = FALSE); | |
518 | // bool Blit(const wxPoint& destPt, const wxSize& sz, | |
519 | // wxDC *source, const wxPoint& srcPt, | |
520 | // int logicalFunc = wxCOPY, int useMask = FALSE); | |
521 | ||
7bf85405 RD |
522 | void Clear(); |
523 | void CrossHair(long x, long y); | |
524 | void DestroyClippingRegion(); | |
525 | long DeviceToLogicalX(long x); | |
526 | long DeviceToLogicalXRel(long x); | |
527 | long DeviceToLogicalY(long y); | |
528 | long DeviceToLogicalYRel(long y); | |
529 | void DrawArc(long x1, long y1, long x2, long y2, long xc, long yc); | |
bb0054cd | 530 | void DrawCircle(long x, long y, long radius); |
7bf85405 RD |
531 | void DrawEllipse(long x, long y, long width, long height); |
532 | void DrawEllipticArc(long x, long y, long width, long height, long start, long end); | |
533 | void DrawIcon(const wxIcon& icon, long x, long y); | |
534 | void DrawLine(long x1, long y1, long x2, long y2); | |
eec92d76 RD |
535 | void DrawLines(int PCOUNT, wxPoint* points, long xoffset=0, long yoffset=0); |
536 | void DrawPolygon(int PCOUNT, wxPoint* points, long xoffset=0, long yoffset=0, | |
7bf85405 RD |
537 | int fill_style=wxODDEVEN_RULE); |
538 | void DrawPoint(long x, long y); | |
539 | void DrawRectangle(long x, long y, long width, long height); | |
6999b0d8 | 540 | void DrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle); |
7bf85405 | 541 | void DrawRoundedRectangle(long x, long y, long width, long height, long radius=20); |
eec92d76 | 542 | void DrawSpline(int PCOUNT, wxPoint* points); |
7bf85405 RD |
543 | void DrawText(const wxString& text, long x, long y); |
544 | void EndDoc(); | |
545 | void EndDrawing(); | |
546 | void EndPage(); | |
547 | void FloodFill(long x, long y, const wxColour& colour, int style=wxFLOOD_SURFACE); | |
b8b8dda7 RD |
548 | wxBrush& GetBackground(); |
549 | wxBrush& GetBrush(); | |
7bf85405 RD |
550 | long GetCharHeight(); |
551 | long GetCharWidth(); | |
552 | void GetClippingBox(long *OUTPUT, long *OUTPUT, | |
553 | long *OUTPUT, long *OUTPUT); | |
b8b8dda7 | 554 | wxFont& GetFont(); |
7bf85405 | 555 | int GetLogicalFunction(); |
eec92d76 | 556 | void GetLogicalScale(double *OUTPUT, double *OUTPUT); |
7bf85405 RD |
557 | int GetMapMode(); |
558 | bool GetOptimization(); | |
b8b8dda7 | 559 | wxPen& GetPen(); |
fb5e0af0 RD |
560 | %addmethods { |
561 | %new wxColour* GetPixel(long x, long y) { | |
562 | wxColour* wc = new wxColour(); | |
563 | self->GetPixel(x, y, wc); | |
564 | return wc; | |
565 | } | |
566 | } | |
bb0054cd RD |
567 | %name(GetSizeTuple)void GetSize(int* OUTPUT, int* OUTPUT); |
568 | wxSize GetSize(); | |
eec92d76 | 569 | wxSize GetSizeMM(); |
7bf85405 | 570 | wxColour& GetTextBackground(); |
af309447 RD |
571 | void GetTextExtent(const wxString& string, long *OUTPUT, long *OUTPUT); |
572 | %name(GetFullTextExtent)void GetTextExtent(const wxString& string, | |
573 | long *OUTPUT, long *OUTPUT, long *OUTPUT, long* OUTPUT, | |
574 | const wxFont* font = NULL); | |
7bf85405 | 575 | wxColour& GetTextForeground(); |
eec92d76 | 576 | void GetUserScale(double *OUTPUT, double *OUTPUT); |
7bf85405 RD |
577 | long LogicalToDeviceX(long x); |
578 | long LogicalToDeviceXRel(long x); | |
579 | long LogicalToDeviceY(long y); | |
580 | long LogicalToDeviceYRel(long y); | |
581 | long MaxX(); | |
582 | long MaxY(); | |
583 | long MinX(); | |
584 | long MinY(); | |
585 | bool Ok(); | |
586 | void SetDeviceOrigin(long x, long y); | |
587 | void SetBackground(const wxBrush& brush); | |
588 | void SetBackgroundMode(int mode); | |
589 | void SetClippingRegion(long x, long y, long width, long height); | |
590 | void SetPalette(const wxPalette& colourMap); | |
591 | void SetBrush(const wxBrush& brush); | |
592 | void SetFont(const wxFont& font); | |
593 | void SetLogicalFunction(int function); | |
eec92d76 | 594 | void SetLogicalScale(double x, double y); |
7bf85405 RD |
595 | void SetMapMode(int mode); |
596 | void SetOptimization(bool optimize); | |
597 | void SetPen(const wxPen& pen); | |
598 | void SetTextBackground(const wxColour& colour); | |
599 | void SetTextForeground(const wxColour& colour); | |
600 | void SetUserScale(double x_scale, double y_scale); | |
601 | bool StartDoc(const wxString& message); | |
602 | void StartPage(); | |
603 | ||
604 | ||
efc5f224 RD |
605 | |
606 | void DrawBitmap(const wxBitmap& bitmap, long x, long y, | |
607 | int useMask = FALSE); | |
608 | ||
eec92d76 RD |
609 | bool CanDrawBitmap(); |
610 | bool CanGetTextExtent(); | |
611 | int GetDepth(); | |
612 | wxSize GetPPI(); | |
613 | ||
614 | void GetLogicalOrigin(int *OUTPUT, int *OUTPUT); | |
615 | void SetLogicalOrigin(int x, int y); | |
616 | void GetDeviceOrigin(int *OUTPUT, int *OUTPUT); | |
eec92d76 RD |
617 | void SetAxisOrientation(bool xLeftRight, bool yBottomUp); |
618 | ||
f6bcfd97 BP |
619 | void CalcBoundingBox(int x, int y); |
620 | void ResetBoundingBox(); | |
7bf85405 RD |
621 | }; |
622 | ||
623 | ||
624 | //---------------------------------------------------------------------- | |
625 | ||
626 | class wxMemoryDC : public wxDC { | |
627 | public: | |
628 | wxMemoryDC(); | |
629 | ||
630 | void SelectObject(const wxBitmap& bitmap); | |
631 | } | |
632 | ||
633 | %new wxMemoryDC* wxMemoryDCFromDC(wxDC* oldDC); | |
634 | %{ // Alternate 'constructor' | |
635 | wxMemoryDC* wxMemoryDCFromDC(wxDC* oldDC) { | |
636 | return new wxMemoryDC(oldDC); | |
637 | } | |
638 | %} | |
639 | ||
640 | ||
641 | //--------------------------------------------------------------------------- | |
642 | ||
643 | class wxScreenDC : public wxDC { | |
644 | public: | |
645 | wxScreenDC(); | |
646 | ||
26b9cf27 RD |
647 | %name(StartDrawingOnTopWin) bool StartDrawingOnTop(wxWindow* window); |
648 | bool StartDrawingOnTop(wxRect* rect = NULL); | |
7bf85405 RD |
649 | bool EndDrawingOnTop(); |
650 | }; | |
651 | ||
652 | //--------------------------------------------------------------------------- | |
653 | ||
654 | class wxClientDC : public wxDC { | |
655 | public: | |
656 | wxClientDC(wxWindow* win); | |
657 | }; | |
658 | ||
659 | //--------------------------------------------------------------------------- | |
660 | ||
661 | class wxPaintDC : public wxDC { | |
662 | public: | |
663 | wxPaintDC(wxWindow* win); | |
664 | }; | |
665 | ||
666 | //--------------------------------------------------------------------------- | |
667 | ||
b639c3c5 RD |
668 | class wxWindowDC : public wxDC { |
669 | public: | |
670 | wxWindowDC(wxWindow* win); | |
671 | }; | |
b639c3c5 RD |
672 | |
673 | //--------------------------------------------------------------------------- | |
674 | ||
be4d9c1f | 675 | #ifndef __WXMSW__ |
7bf85405 RD |
676 | class wxPostScriptDC : public wxDC { |
677 | public: | |
678 | wxPostScriptDC(const wxString& output, bool interactive = TRUE, wxWindow* win = NULL); | |
679 | }; | |
be4d9c1f | 680 | #endif |
7bf85405 RD |
681 | |
682 | //--------------------------------------------------------------------------- | |
683 | ||
7bf85405 | 684 | |
fb5e0af0 | 685 | #ifdef __WXMSW__ |
7bf85405 RD |
686 | class wxMetaFileDC : public wxDC { |
687 | public: | |
688 | wxMetaFileDC(const wxString& filename = wxPyEmptyStr); | |
689 | wxMetaFile* Close(); | |
690 | }; | |
fb5e0af0 | 691 | #endif |
7bf85405 RD |
692 | |
693 | //--------------------------------------------------------------------------- | |
694 | //--------------------------------------------------------------------------- | |
695 | ||
696 | ||
697 | %readonly | |
af309447 RD |
698 | %{ |
699 | #if 0 | |
700 | %} | |
7bf85405 RD |
701 | extern wxFont *wxNORMAL_FONT; |
702 | extern wxFont *wxSMALL_FONT; | |
703 | extern wxFont *wxITALIC_FONT; | |
704 | extern wxFont *wxSWISS_FONT; | |
7bf85405 | 705 | |
1afc06c2 | 706 | extern wxPen *wxRED_PEN; |
7bf85405 RD |
707 | extern wxPen *wxCYAN_PEN; |
708 | extern wxPen *wxGREEN_PEN; | |
709 | extern wxPen *wxBLACK_PEN; | |
710 | extern wxPen *wxWHITE_PEN; | |
711 | extern wxPen *wxTRANSPARENT_PEN; | |
712 | extern wxPen *wxBLACK_DASHED_PEN; | |
713 | extern wxPen *wxGREY_PEN; | |
714 | extern wxPen *wxMEDIUM_GREY_PEN; | |
715 | extern wxPen *wxLIGHT_GREY_PEN; | |
716 | ||
717 | extern wxBrush *wxBLUE_BRUSH; | |
718 | extern wxBrush *wxGREEN_BRUSH; | |
719 | extern wxBrush *wxWHITE_BRUSH; | |
720 | extern wxBrush *wxBLACK_BRUSH; | |
721 | extern wxBrush *wxTRANSPARENT_BRUSH; | |
722 | extern wxBrush *wxCYAN_BRUSH; | |
723 | extern wxBrush *wxRED_BRUSH; | |
724 | extern wxBrush *wxGREY_BRUSH; | |
725 | extern wxBrush *wxMEDIUM_GREY_BRUSH; | |
726 | extern wxBrush *wxLIGHT_GREY_BRUSH; | |
727 | ||
728 | extern wxColour *wxBLACK; | |
729 | extern wxColour *wxWHITE; | |
730 | extern wxColour *wxRED; | |
731 | extern wxColour *wxBLUE; | |
732 | extern wxColour *wxGREEN; | |
733 | extern wxColour *wxCYAN; | |
734 | extern wxColour *wxLIGHT_GREY; | |
735 | ||
736 | extern wxCursor *wxSTANDARD_CURSOR; | |
737 | extern wxCursor *wxHOURGLASS_CURSOR; | |
738 | extern wxCursor *wxCROSS_CURSOR; | |
739 | ||
740 | extern wxBitmap wxNullBitmap; | |
741 | extern wxIcon wxNullIcon; | |
742 | extern wxCursor wxNullCursor; | |
743 | extern wxPen wxNullPen; | |
744 | extern wxBrush wxNullBrush; | |
745 | extern wxPalette wxNullPalette; | |
746 | extern wxFont wxNullFont; | |
747 | extern wxColour wxNullColour; | |
748 | ||
0569df0f RD |
749 | |
750 | extern wxFontList* wxTheFontList; | |
751 | extern wxPenList* wxThePenList; | |
752 | extern wxBrushlist* wxTheBrushList; | |
753 | extern wxColourDatabase* wxTheColourDatabase; | |
754 | ||
755 | ||
af309447 RD |
756 | %readwrite |
757 | %{ | |
758 | #endif | |
759 | %} | |
760 | ||
b639c3c5 RD |
761 | //--------------------------------------------------------------------------- |
762 | ||
9416aa89 | 763 | class wxPalette : public wxGDIObject { |
b639c3c5 | 764 | public: |
eec92d76 | 765 | wxPalette(int LCOUNT, byte* choices, byte* choices, byte* choices); |
b639c3c5 RD |
766 | ~wxPalette(); |
767 | ||
768 | int GetPixel(byte red, byte green, byte blue); | |
769 | bool GetRGB(int pixel, byte* OUTPUT, byte* OUTPUT, byte* OUTPUT); | |
770 | bool Ok(); | |
771 | }; | |
772 | ||
773 | //--------------------------------------------------------------------------- | |
774 | ||
af309447 RD |
775 | enum { |
776 | wxIMAGELIST_DRAW_NORMAL , | |
777 | wxIMAGELIST_DRAW_TRANSPARENT, | |
778 | wxIMAGELIST_DRAW_SELECTED, | |
779 | wxIMAGELIST_DRAW_FOCUSED, | |
780 | wxIMAGE_LIST_NORMAL, | |
781 | wxIMAGE_LIST_SMALL, | |
782 | wxIMAGE_LIST_STATE | |
783 | }; | |
784 | ||
9416aa89 | 785 | class wxImageList : public wxObject { |
af309447 | 786 | public: |
dcd38683 | 787 | wxImageList(int width, int height, int mask=TRUE, int initialCount=1); |
af309447 RD |
788 | ~wxImageList(); |
789 | ||
790 | int Add(const wxBitmap& bitmap, const wxBitmap& mask = wxNullBitmap); | |
791 | %name(AddWithColourMask)int Add(const wxBitmap& bitmap, const wxColour& maskColour); | |
792 | %name(AddIcon)int Add(const wxIcon& icon); | |
f6bcfd97 | 793 | #ifdef __WXMSW__ |
b57bdb5a | 794 | bool Replace(int index, const wxBitmap& bitmap, const wxBitmap& mask = wxNullBitmap); |
b57bdb5a | 795 | #else |
f6bcfd97 BP |
796 | // %name(ReplaceIcon)bool Replace(int index, const wxIcon& icon); |
797 | // int Add(const wxBitmap& bitmap); | |
b57bdb5a RD |
798 | bool Replace(int index, const wxBitmap& bitmap); |
799 | #endif | |
af309447 RD |
800 | |
801 | bool Draw(int index, wxDC& dc, int x, int x, int flags = wxIMAGELIST_DRAW_NORMAL, | |
802 | const bool solidBackground = FALSE); | |
803 | ||
804 | int GetImageCount(); | |
805 | bool Remove(int index); | |
806 | bool RemoveAll(); | |
f6bcfd97 | 807 | void GetSize(int index, int& OUTPUT, int& OUTPUT); |
af309447 RD |
808 | }; |
809 | ||
b639c3c5 | 810 | |
9416aa89 RD |
811 | //--------------------------------------------------------------------------- |
812 | // Regions, etc. | |
813 | ||
814 | enum wxRegionContain { | |
815 | wxOutRegion, wxPartRegion, wxInRegion | |
816 | }; | |
817 | ||
818 | ||
819 | class wxRegion : public wxGDIObject { | |
820 | public: | |
821 | wxRegion(long x=0, long y=0, long width=0, long height=0); | |
822 | ~wxRegion(); | |
823 | ||
824 | void Clear(); | |
825 | wxRegionContain Contains(long x, long y); | |
826 | %name(ContainsPoint)wxRegionContain Contains(const wxPoint& pt); | |
827 | %name(ContainsRect)wxRegionContain Contains(const wxRect& rect); | |
828 | %name(ContainsRectDim)wxRegionContain Contains(long x, long y, long w, long h); | |
829 | ||
830 | wxRect GetBox(); | |
831 | ||
832 | bool Intersect(long x, long y, long width, long height); | |
833 | %name(IntersectRect)bool Intersect(const wxRect& rect); | |
834 | %name(IntersectRegion)bool Intersect(const wxRegion& region); | |
835 | ||
836 | bool IsEmpty(); | |
837 | ||
838 | bool Union(long x, long y, long width, long height); | |
839 | %name(UnionRect)bool Union(const wxRect& rect); | |
840 | %name(UnionRegion)bool Union(const wxRegion& region); | |
841 | ||
842 | bool Subtract(long x, long y, long width, long height); | |
843 | %name(SubtractRect)bool Subtract(const wxRect& rect); | |
844 | %name(SubtractRegion)bool Subtract(const wxRegion& region); | |
845 | ||
846 | bool Xor(long x, long y, long width, long height); | |
847 | %name(XorRect)bool Xor(const wxRect& rect); | |
848 | %name(XorRegion)bool Xor(const wxRegion& region); | |
849 | }; | |
850 | ||
851 | ||
852 | ||
853 | class wxRegionIterator : public wxObject { | |
854 | public: | |
855 | wxRegionIterator(const wxRegion& region); | |
856 | ~wxRegionIterator(); | |
857 | ||
858 | long GetX(); | |
859 | long GetY(); | |
860 | long GetW(); | |
861 | long GetWidth(); | |
862 | long GetH(); | |
863 | long GetHeight(); | |
864 | wxRect GetRect(); | |
865 | bool HaveRects(); | |
866 | void Reset(); | |
867 | ||
868 | %addmethods { | |
869 | void Next() { | |
870 | (*self) ++; | |
871 | } | |
872 | }; | |
873 | }; | |
874 | ||
875 | ||
7bf85405 RD |
876 | //--------------------------------------------------------------------------- |
877 |