]>
Commit | Line | Data |
---|---|---|
7bf85405 RD |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: gdi.i | |
68bc8549 | 3 | // Purpose: SWIG interface file for wxDC, wxBrush, wxPen, etc. |
7bf85405 RD |
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" |
af309447 | 18 | #include <wx/imaglist.h> |
6d8b4f8d RD |
19 | #include <wx/fontmap.h> |
20 | #include <wx/fontenc.h> | |
21 | #include <wx/fontmap.h> | |
22 | #include <wx/fontutil.h> | |
e9159fe8 | 23 | #include <wx/dcbuffer.h> |
0e9b78ce | 24 | #include <wx/iconbndl.h> |
7bf85405 RD |
25 | %} |
26 | ||
27 | //---------------------------------------------------------------------- | |
28 | ||
29 | %include typemaps.i | |
30 | %include my_typemaps.i | |
31 | ||
32 | // Import some definitions of other classes, etc. | |
33 | %import _defs.i | |
34 | %import misc.i | |
68bc8549 | 35 | %import fonts.i |
7bf85405 | 36 | |
1e4a197e | 37 | %pragma(python) code = "import wx" |
b68dc582 | 38 | |
137b5242 RD |
39 | //--------------------------------------------------------------------------- |
40 | %{ | |
41 | // Put some wx default wxChar* values into wxStrings. | |
42 | static const wxString wxPyEmptyString(wxT("")); | |
43 | %} | |
7bf85405 RD |
44 | //--------------------------------------------------------------------------- |
45 | ||
9416aa89 RD |
46 | class wxGDIObject : public wxObject { |
47 | public: | |
48 | wxGDIObject(); | |
49 | ~wxGDIObject(); | |
50 | ||
51 | bool GetVisible(); | |
52 | void SetVisible( bool visible ); | |
53 | ||
54 | bool IsNull(); | |
55 | ||
56 | }; | |
6999b0d8 RD |
57 | |
58 | //--------------------------------------------------------------------------- | |
59 | ||
9cbf6f6e RD |
60 | |
61 | // TODO: When the API stabalizes and is available on other platforms, add | |
62 | // wrappers for the new wxBitmap, wxRawBitmap, wxDIB stuff... | |
63 | ||
9416aa89 | 64 | class wxBitmap : public wxGDIObject |
5bff6bb8 | 65 | { |
7bf85405 | 66 | public: |
96de41c2 | 67 | wxBitmap(const wxString& name, wxBitmapType type=wxBITMAP_TYPE_ANY); |
7bf85405 RD |
68 | ~wxBitmap(); |
69 | ||
7bf85405 RD |
70 | wxPalette* GetPalette(); |
71 | wxMask* GetMask(); | |
96de41c2 | 72 | bool LoadFile(const wxString& name, wxBitmapType type=wxBITMAP_TYPE_ANY); |
e6056257 | 73 | bool SaveFile(const wxString& name, wxBitmapType type, wxPalette* palette = NULL); |
7bf85405 | 74 | void SetMask(wxMask* mask); |
1e4a197e RD |
75 | %pragma(python) addtoclass = " |
76 | def SetMaskColour(self, colour): | |
77 | mask = wxMaskColour(self, colour) | |
78 | self.SetMask(mask) | |
79 | " | |
fb5e0af0 | 80 | #ifdef __WXMSW__ |
b8b8dda7 | 81 | void SetPalette(wxPalette& palette); |
fb5e0af0 | 82 | #endif |
5bff6bb8 RD |
83 | |
84 | // wxGDIImage methods | |
85 | #ifdef __WXMSW__ | |
86 | long GetHandle(); | |
87 | void SetHandle(long handle); | |
88 | #endif | |
89 | bool Ok(); | |
90 | int GetWidth(); | |
91 | int GetHeight(); | |
92 | int GetDepth(); | |
93 | void SetWidth(int w); | |
94 | void SetHeight(int h); | |
95 | void SetDepth(int d); | |
96 | #ifdef __WXMSW__ | |
97 | void SetSize(const wxSize& size); | |
98 | #endif | |
f6bcfd97 BP |
99 | |
100 | wxBitmap GetSubBitmap( const wxRect& rect ); | |
f6bcfd97 | 101 | bool CopyFromIcon(const wxIcon& icon); |
ecc08ead | 102 | #ifdef __WXMSW__ |
f6bcfd97 BP |
103 | bool CopyFromCursor(const wxCursor& cursor); |
104 | int GetQuality(); | |
105 | void SetQuality(int q); | |
106 | #endif | |
107 | ||
1fded56b | 108 | %pragma(python) addtoclass = "def __nonzero__(self): return self.Ok()" |
7bf85405 RD |
109 | }; |
110 | ||
5bff6bb8 | 111 | |
96bfd053 | 112 | // Declarations of some alternate "constructors" |
7bf85405 | 113 | %new wxBitmap* wxEmptyBitmap(int width, int height, int depth=-1); |
96bfd053 RD |
114 | %new wxBitmap* wxBitmapFromXPMData(PyObject* listOfStrings); |
115 | %new wxBitmap* wxBitmapFromIcon(const wxIcon& icon); | |
3eb221f6 | 116 | %new wxBitmap* wxBitmapFromBits(PyObject* bits, int width, int height, int depth = 1 ); |
9c039d08 | 117 | |
d56cebe7 RD |
118 | // #ifdef __WXMSW__ |
119 | // %new wxBitmap* wxBitmapFromData(PyObject* data, long type, | |
120 | // int width, int height, int depth = 1); | |
121 | // #endif | |
8bf5d46e | 122 | |
96bfd053 RD |
123 | |
124 | ||
125 | %{ // Implementations of some alternate "constructors" | |
126 | ||
7bf85405 RD |
127 | wxBitmap* wxEmptyBitmap(int width, int height, int depth=-1) { |
128 | return new wxBitmap(width, height, depth); | |
129 | } | |
130 | ||
96bfd053 RD |
131 | static char** ConvertListOfStrings(PyObject* listOfStrings) { |
132 | char** cArray = NULL; | |
133 | int count; | |
134 | ||
135 | if (!PyList_Check(listOfStrings)) { | |
136 | PyErr_SetString(PyExc_TypeError, "Expected a list of strings."); | |
137 | return NULL; | |
138 | } | |
139 | count = PyList_Size(listOfStrings); | |
140 | cArray = new char*[count]; | |
141 | ||
142 | for(int x=0; x<count; x++) { | |
143 | // TODO: Need some validation and error checking here | |
144 | cArray[x] = PyString_AsString(PyList_GET_ITEM(listOfStrings, x)); | |
145 | } | |
146 | return cArray; | |
147 | } | |
148 | ||
d56cebe7 | 149 | |
96bfd053 RD |
150 | wxBitmap* wxBitmapFromXPMData(PyObject* listOfStrings) { |
151 | char** cArray = NULL; | |
152 | wxBitmap* bmp; | |
153 | ||
154 | cArray = ConvertListOfStrings(listOfStrings); | |
155 | if (! cArray) | |
156 | return NULL; | |
157 | bmp = new wxBitmap(cArray); | |
158 | delete [] cArray; | |
159 | return bmp; | |
160 | } | |
161 | ||
162 | ||
163 | wxBitmap* wxBitmapFromIcon(const wxIcon& icon) { | |
164 | return new wxBitmap(icon); | |
165 | } | |
166 | ||
167 | ||
3eb221f6 RD |
168 | wxBitmap* wxBitmapFromBits(PyObject* bits, int width, int height, int depth = 1 ) { |
169 | char* buf; | |
170 | int length; | |
171 | PyString_AsStringAndSize(bits, &buf, &length); | |
172 | return new wxBitmap(buf, width, height, depth); | |
d56cebe7 | 173 | } |
926bb76c | 174 | |
4c9993c3 | 175 | |
d56cebe7 RD |
176 | // #ifdef __WXMSW__ |
177 | // wxBitmap* wxBitmapFromData(PyObject* data, long type, | |
178 | // int width, int height, int depth = 1) { | |
179 | // if (! PyString_Check(data)) { | |
180 | // PyErr_SetString(PyExc_TypeError, "Expected string object"); | |
181 | // return NULL; | |
182 | // } | |
183 | // return new wxBitmap((void*)PyString_AsString(data), type, width, height, depth); | |
184 | // } | |
185 | // #endif | |
7bf85405 RD |
186 | %} |
187 | ||
188 | //--------------------------------------------------------------------------- | |
189 | ||
9416aa89 | 190 | class wxMask : public wxObject { |
7bf85405 RD |
191 | public: |
192 | wxMask(const wxBitmap& bitmap); | |
eb715945 | 193 | //~wxMask(); |
96bfd053 RD |
194 | |
195 | %addmethods { void Destroy() { delete self; } } | |
7bf85405 RD |
196 | }; |
197 | ||
198 | %new wxMask* wxMaskColour(const wxBitmap& bitmap, const wxColour& colour); | |
199 | %{ | |
200 | wxMask* wxMaskColour(const wxBitmap& bitmap, const wxColour& colour) { | |
201 | return new wxMask(bitmap, colour); | |
202 | } | |
203 | %} | |
204 | ||
205 | ||
206 | //--------------------------------------------------------------------------- | |
207 | ||
208 | ||
9416aa89 | 209 | class wxIcon : public wxGDIObject |
5bff6bb8 | 210 | { |
7bf85405 | 211 | public: |
fb5e0af0 RD |
212 | wxIcon(const wxString& name, long flags, |
213 | int desiredWidth = -1, int desiredHeight = -1); | |
7bf85405 RD |
214 | ~wxIcon(); |
215 | ||
6abe8375 | 216 | #ifndef __WXMAC__ |
7bf85405 | 217 | bool LoadFile(const wxString& name, long flags); |
6abe8375 | 218 | #endif |
5bff6bb8 RD |
219 | |
220 | // wxGDIImage methods | |
221 | #ifdef __WXMSW__ | |
222 | long GetHandle(); | |
223 | void SetHandle(long handle); | |
224 | #endif | |
225 | bool Ok(); | |
226 | int GetWidth(); | |
227 | int GetHeight(); | |
228 | int GetDepth(); | |
229 | void SetWidth(int w); | |
230 | void SetHeight(int h); | |
231 | void SetDepth(int d); | |
232 | #ifdef __WXMSW__ | |
233 | void SetSize(const wxSize& size); | |
234 | #endif | |
96bfd053 RD |
235 | void CopyFromBitmap(const wxBitmap& bmp); |
236 | ||
1fded56b | 237 | %pragma(python) addtoclass = "def __nonzero__(self): return self.Ok()" |
7bf85405 RD |
238 | }; |
239 | ||
8bf5d46e | 240 | |
96bfd053 RD |
241 | // Declarations of some alternate "constructors" |
242 | %new wxIcon* wxEmptyIcon(); | |
243 | %new wxIcon* wxIconFromXPMData(PyObject* listOfStrings); | |
7248a051 | 244 | %new wxIcon* wxIconFromBitmap(const wxBitmap& bmp); |
96bfd053 RD |
245 | |
246 | %{ // Implementations of some alternate "constructors" | |
247 | wxIcon* wxEmptyIcon() { | |
248 | return new wxIcon(); | |
249 | } | |
250 | ||
251 | wxIcon* wxIconFromXPMData(PyObject* listOfStrings) { | |
252 | char** cArray = NULL; | |
253 | wxIcon* icon; | |
254 | ||
255 | cArray = ConvertListOfStrings(listOfStrings); | |
256 | if (! cArray) | |
257 | return NULL; | |
258 | icon = new wxIcon(cArray); | |
259 | delete [] cArray; | |
260 | return icon; | |
261 | } | |
7248a051 RD |
262 | |
263 | wxIcon* wxIconFromBitmap(const wxBitmap& bmp) { | |
264 | wxIcon* icon = new wxIcon(); | |
265 | icon->CopyFromBitmap(bmp); | |
266 | return icon; | |
267 | } | |
96bfd053 RD |
268 | %} |
269 | ||
7bf85405 RD |
270 | //--------------------------------------------------------------------------- |
271 | ||
0e9b78ce RD |
272 | class wxIconBundle |
273 | { | |
274 | public: | |
275 | // default constructor | |
276 | wxIconBundle(); | |
277 | ||
278 | // initializes the bundle with the icon(s) found in the file | |
279 | %name(wxIconBundleFromFile) wxIconBundle( const wxString& file, long type ); | |
280 | ||
281 | // initializes the bundle with a single icon | |
282 | %name(wxIconBundleFromIcon)wxIconBundle( const wxIcon& icon ); | |
283 | ||
284 | ~wxIconBundle(); | |
285 | ||
286 | // adds the icon to the collection, if the collection already | |
287 | // contains an icon with the same width and height, it is | |
288 | // replaced | |
289 | void AddIcon( const wxIcon& icon ); | |
290 | ||
291 | // adds all the icons contained in the file to the collection, | |
292 | // if the collection already contains icons with the same | |
293 | // width and height, they are replaced | |
294 | %name(AddIconFromFile)void AddIcon( const wxString& file, long type ); | |
295 | ||
296 | // returns the icon with the given size; if no such icon exists, | |
297 | // returns the icon with size wxSYS_ICON_[XY]; if no such icon exists, | |
298 | // returns the first icon in the bundle | |
299 | const wxIcon& GetIcon( const wxSize& size ) const; | |
300 | }; | |
301 | ||
302 | //--------------------------------------------------------------------------- | |
303 | ||
9416aa89 | 304 | class wxCursor : public wxGDIObject |
5bff6bb8 | 305 | { |
7bf85405 | 306 | public: |
1fded56b RD |
307 | %addmethods { |
308 | wxCursor(const wxString* cursorName, long flags, int hotSpotX=0, int hotSpotY=0) { | |
309 | #ifdef __WXGTK__ | |
310 | wxCHECK_MSG(FALSE, NULL, | |
311 | wxT("wxCursor constructor not implemented for wxGTK, use wxStockCursor, wxCursorFromImage, or wxCursorFromBits instead.")); | |
312 | #else | |
313 | return new wxCursor(*cursorName, flags, hotSpotX, hotSpotY); | |
fb5e0af0 | 314 | #endif |
1fded56b RD |
315 | } |
316 | } | |
317 | ||
7bf85405 | 318 | ~wxCursor(); |
5bff6bb8 RD |
319 | |
320 | // wxGDIImage methods | |
321 | #ifdef __WXMSW__ | |
322 | long GetHandle(); | |
323 | void SetHandle(long handle); | |
324 | #endif | |
325 | bool Ok(); | |
326 | #ifdef __WXMSW__ | |
327 | int GetWidth(); | |
328 | int GetHeight(); | |
329 | int GetDepth(); | |
330 | void SetWidth(int w); | |
331 | void SetHeight(int h); | |
332 | void SetDepth(int d); | |
333 | void SetSize(const wxSize& size); | |
334 | #endif | |
1fded56b | 335 | %pragma(python) addtoclass = "def __nonzero__(self): return self.Ok()" |
7bf85405 RD |
336 | }; |
337 | ||
9c039d08 | 338 | %name(wxStockCursor) %new wxCursor* wxPyStockCursor(int id); |
1fded56b RD |
339 | %new wxCursor* wxCursorFromImage(const wxImage& image); |
340 | %new wxCursor* wxCursorFromBits(PyObject* bits, int width, int height, | |
341 | int hotSpotX=-1, int hotSpotY=-1, | |
342 | PyObject* maskBits=0); | |
343 | ||
344 | %{ | |
9c039d08 | 345 | wxCursor* wxPyStockCursor(int id) { |
7bf85405 RD |
346 | return new wxCursor(id); |
347 | } | |
7bf85405 | 348 | |
1e4a197e | 349 | wxCursor* wxCursorFromImage(const wxImage& image) { |
1e4a197e | 350 | return new wxCursor(image); |
1fded56b RD |
351 | } |
352 | ||
353 | wxCursor* wxCursorFromBits(PyObject* bits, int width, int height, | |
354 | int hotSpotX=-1, int hotSpotY=-1, | |
355 | PyObject* maskBits=0) { | |
356 | char* bitsbuf; | |
357 | char* maskbuf = NULL; | |
358 | int length; | |
359 | PyString_AsStringAndSize(bits, &bitsbuf, &length); | |
360 | if (maskBits) | |
361 | PyString_AsStringAndSize(maskBits, &maskbuf, &length); | |
362 | return new wxCursor(bitsbuf, width, height, hotSpotX, hotSpotY, maskbuf); | |
1e4a197e RD |
363 | } |
364 | %} | |
365 | ||
7bf85405 RD |
366 | //---------------------------------------------------------------------- |
367 | ||
9416aa89 | 368 | class wxColour : public wxObject { |
7bf85405 RD |
369 | public: |
370 | wxColour(unsigned char red=0, unsigned char green=0, unsigned char blue=0); | |
371 | ~wxColour(); | |
372 | unsigned char Red(); | |
373 | unsigned char Green(); | |
374 | unsigned char Blue(); | |
375 | bool Ok(); | |
376 | void Set(unsigned char red, unsigned char green, unsigned char blue); | |
377 | %addmethods { | |
378 | PyObject* Get() { | |
379 | PyObject* rv = PyTuple_New(3); | |
1e4a197e RD |
380 | int red = -1; |
381 | int green = -1; | |
382 | int blue = -1; | |
383 | if (self->Ok()) { | |
384 | red = self->Red(); | |
385 | green = self->Green(); | |
386 | blue = self->Blue(); | |
387 | } | |
388 | PyTuple_SetItem(rv, 0, PyInt_FromLong(red)); | |
389 | PyTuple_SetItem(rv, 1, PyInt_FromLong(green)); | |
390 | PyTuple_SetItem(rv, 2, PyInt_FromLong(blue)); | |
7bf85405 RD |
391 | return rv; |
392 | } | |
1e4a197e RD |
393 | bool __eq__(PyObject* obj) { |
394 | wxColour tmp; | |
395 | wxColour* ptr = &tmp; | |
396 | if (obj == Py_None) return FALSE; | |
397 | wxPyBLOCK_THREADS(bool success = wxColour_helper(obj, &ptr); PyErr_Clear()); | |
398 | if (! success) return FALSE; | |
399 | return *self == *ptr; | |
400 | } | |
401 | bool __ne__(PyObject* obj) { | |
402 | wxColour tmp; | |
403 | wxColour* ptr = &tmp; | |
404 | if (obj == Py_None) return TRUE; | |
405 | wxPyBLOCK_THREADS(bool success = wxColour_helper(obj, &ptr); PyErr_Clear()); | |
406 | if (! success) return TRUE; | |
407 | return *self != *ptr; | |
408 | } | |
7bf85405 | 409 | } |
1e4a197e RD |
410 | |
411 | %pragma(python) addtoclass = "asTuple = Get | |
412 | def __str__(self): return str(self.asTuple()) | |
413 | def __repr__(self): return 'wxColour:' + str(self.asTuple()) | |
414 | def __nonzero__(self): return self.Ok() | |
415 | def __getinitargs__(self): return () | |
416 | def __getstate__(self): return self.asTuple() | |
417 | def __setstate__(self, state): self.Set(*state) | |
418 | " | |
9b3d3bc4 | 419 | |
7bf85405 RD |
420 | }; |
421 | ||
422 | %new wxColour* wxNamedColour(const wxString& colorName); | |
de20db99 | 423 | |
7bf85405 RD |
424 | %{ // Alternate 'constructor' |
425 | wxColour* wxNamedColour(const wxString& colorName) { | |
426 | return new wxColour(colorName); | |
427 | } | |
428 | %} | |
429 | ||
430 | ||
7bf85405 | 431 | |
9416aa89 | 432 | class wxColourDatabase : public wxObject { |
7bf85405 | 433 | public: |
0569df0f RD |
434 | |
435 | wxColour *FindColour(const wxString& colour); | |
436 | wxString FindName(const wxColour& colour) const; | |
437 | ||
7bf85405 | 438 | %addmethods { |
0569df0f | 439 | void Append(const wxString& name, int red, int green, int blue) { |
fe40185d RD |
440 | // first see if the name is already there |
441 | wxString cName = name; | |
442 | cName.MakeUpper(); | |
443 | wxString cName2 = cName; | |
a541c325 | 444 | if ( !cName2.Replace(wxT("GRAY"), wxT("GREY")) ) |
fe40185d RD |
445 | cName2.clear(); |
446 | ||
1e4a197e | 447 | wxNode *node = self->GetFirst(); |
fe40185d RD |
448 | while ( node ) { |
449 | const wxChar *key = node->GetKeyString(); | |
450 | if ( cName == key || cName2 == key ) { | |
1e4a197e | 451 | wxColour* c = (wxColour *)node->GetData(); |
fe40185d RD |
452 | c->Set(red, green, blue); |
453 | return; | |
454 | } | |
1e4a197e | 455 | node = node->GetNext(); |
fe40185d RD |
456 | } |
457 | ||
458 | // otherwise append the new colour | |
0569df0f | 459 | self->Append(name.c_str(), new wxColour(red, green, blue)); |
7bf85405 | 460 | } |
7bf85405 | 461 | } |
0569df0f RD |
462 | }; |
463 | ||
464 | ||
465 | //---------------------------------------------------------------------- | |
466 | ||
9416aa89 | 467 | class wxPen : public wxGDIObject { |
0569df0f RD |
468 | public: |
469 | wxPen(wxColour& colour, int width=1, int style=wxSOLID); | |
470 | ~wxPen(); | |
7bf85405 RD |
471 | |
472 | int GetCap(); | |
25832b3f | 473 | wxColour GetColour(); |
7bf85405 | 474 | |
fb5e0af0 | 475 | int GetJoin(); |
7bf85405 RD |
476 | int GetStyle(); |
477 | int GetWidth(); | |
478 | bool Ok(); | |
479 | void SetCap(int cap_style); | |
480 | void SetColour(wxColour& colour); | |
aeeb6a44 RR |
481 | void SetJoin(int join_style); |
482 | void SetStyle(int style); | |
483 | void SetWidth(int width); | |
08127323 | 484 | |
756ed80c | 485 | |
eec92d76 | 486 | void SetDashes(int LCOUNT, wxDash* choices); |
756ed80c RD |
487 | //int GetDashes(wxDash **dashes); |
488 | %addmethods { | |
489 | PyObject* GetDashes() { | |
490 | wxDash* dashes; | |
491 | int count = self->GetDashes(&dashes); | |
492 | wxPyBeginBlockThreads(); | |
493 | PyObject* retval = PyList_New(0); | |
494 | for (int x=0; x<count; x++) | |
495 | PyList_Append(retval, PyInt_FromLong(dashes[x])); | |
496 | wxPyEndBlockThreads(); | |
497 | return retval; | |
498 | } | |
499 | } | |
6999b0d8 RD |
500 | |
501 | #ifdef __WXMSW__ | |
502 | wxBitmap* GetStipple(); | |
b8b8dda7 | 503 | void SetStipple(wxBitmap& stipple); |
fb5e0af0 | 504 | #endif |
1fded56b RD |
505 | |
506 | %pragma(python) addtoclass = "def __nonzero__(self): return self.Ok()" | |
7bf85405 RD |
507 | }; |
508 | ||
0569df0f | 509 | |
ecc08ead | 510 | |
05f30eec RD |
511 | |
512 | // The list of ints for the dashes needs to exist for the life of the pen | |
513 | // so we make it part of the class to save it. wxPyPen is aliased to wxPen | |
514 | // in _extras.py | |
515 | ||
ecc08ead RD |
516 | %{ |
517 | class wxPyPen : public wxPen { | |
518 | public: | |
519 | wxPyPen(wxColour& colour, int width=1, int style=wxSOLID) | |
520 | : wxPen(colour, width, style) | |
521 | { m_dash = NULL; } | |
522 | ~wxPyPen() { | |
523 | if (m_dash) | |
05f30eec | 524 | delete [] m_dash; |
ecc08ead RD |
525 | } |
526 | ||
527 | void SetDashes(int nb_dashes, const wxDash *dash) { | |
05f30eec RD |
528 | if (m_dash) |
529 | delete [] m_dash; | |
ecc08ead | 530 | m_dash = new wxDash[nb_dashes]; |
05f30eec | 531 | for (int i=0; i<nb_dashes; i++) { |
ecc08ead | 532 | m_dash[i] = dash[i]; |
05f30eec | 533 | } |
ecc08ead RD |
534 | wxPen::SetDashes(nb_dashes, m_dash); |
535 | } | |
536 | ||
537 | private: | |
538 | wxDash* m_dash; | |
539 | }; | |
540 | %} | |
541 | ||
542 | ||
ecc08ead RD |
543 | class wxPyPen : public wxPen { |
544 | public: | |
545 | wxPyPen(wxColour& colour, int width=1, int style=wxSOLID); | |
546 | ~wxPyPen(); | |
547 | ||
548 | void SetDashes(int LCOUNT, wxDash* choices); | |
549 | }; | |
550 | ||
551 | ||
552 | ||
05f30eec | 553 | |
9416aa89 | 554 | class wxPenList : public wxObject { |
0569df0f RD |
555 | public: |
556 | ||
557 | void AddPen(wxPen* pen); | |
558 | wxPen* FindOrCreatePen(const wxColour& colour, int width, int style); | |
559 | void RemovePen(wxPen* pen); | |
2f4e9287 RD |
560 | |
561 | int GetCount(); | |
0569df0f RD |
562 | }; |
563 | ||
564 | ||
565 | ||
7bf85405 RD |
566 | //---------------------------------------------------------------------- |
567 | ||
9416aa89 | 568 | class wxBrush : public wxGDIObject { |
7bf85405 | 569 | public: |
0569df0f RD |
570 | wxBrush(const wxColour& colour, int style=wxSOLID); |
571 | ~wxBrush(); | |
26b9cf27 | 572 | |
25832b3f | 573 | wxColour GetColour(); |
7bf85405 RD |
574 | wxBitmap * GetStipple(); |
575 | int GetStyle(); | |
576 | bool Ok(); | |
577 | void SetColour(wxColour &colour); | |
b8b8dda7 | 578 | void SetStipple(wxBitmap& bitmap); |
7bf85405 | 579 | void SetStyle(int style); |
1fded56b RD |
580 | |
581 | #ifdef __WXMAC__ | |
582 | short GetMacTheme(); | |
583 | void SetMacTheme(short macThemeBrush); | |
584 | #endif | |
585 | ||
586 | %pragma(python) addtoclass = "def __nonzero__(self): return self.Ok()" | |
7bf85405 RD |
587 | }; |
588 | ||
0569df0f | 589 | |
6ee2116b | 590 | class wxBrushList : public wxObject { |
0569df0f RD |
591 | public: |
592 | ||
593 | void AddBrush(wxBrush *brush); | |
594 | wxBrush * FindOrCreateBrush(const wxColour& colour, int style); | |
595 | void RemoveBrush(wxBrush *brush); | |
2f4e9287 RD |
596 | |
597 | int GetCount(); | |
0569df0f RD |
598 | }; |
599 | ||
7bf85405 RD |
600 | //---------------------------------------------------------------------- |
601 | ||
602 | ||
9416aa89 | 603 | class wxDC : public wxObject { |
7bf85405 | 604 | public: |
fb5e0af0 | 605 | // wxDC(); **** abstract base class, can't instantiate. |
7bf85405 RD |
606 | ~wxDC(); |
607 | ||
608 | void BeginDrawing(); | |
1e4a197e | 609 | |
efc5f224 | 610 | // %name(BlitXY) |
1e4a197e RD |
611 | bool Blit(wxCoord xdest, wxCoord ydest, |
612 | wxCoord width, wxCoord height, | |
613 | wxDC *source, wxCoord xsrc, wxCoord ysrc, | |
efc5f224 RD |
614 | int logicalFunc = wxCOPY, int useMask = FALSE); |
615 | // bool Blit(const wxPoint& destPt, const wxSize& sz, | |
616 | // wxDC *source, const wxPoint& srcPt, | |
617 | // int logicalFunc = wxCOPY, int useMask = FALSE); | |
618 | ||
7bf85405 | 619 | void Clear(); |
1e4a197e | 620 | void CrossHair(wxCoord x, wxCoord y); |
7bf85405 | 621 | void DestroyClippingRegion(); |
1e4a197e RD |
622 | wxCoord DeviceToLogicalX(wxCoord x); |
623 | wxCoord DeviceToLogicalXRel(wxCoord x); | |
624 | wxCoord DeviceToLogicalY(wxCoord y); | |
625 | wxCoord DeviceToLogicalYRel(wxCoord y); | |
626 | void DrawArc(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord xc, wxCoord yc); | |
627 | void DrawCircle(wxCoord x, wxCoord y, wxCoord radius); | |
628 | void DrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height); | |
629 | void DrawEllipticArc(wxCoord x, wxCoord y, wxCoord width, wxCoord height, wxCoord start, wxCoord end); | |
630 | void DrawIcon(const wxIcon& icon, wxCoord x, wxCoord y); | |
23bed520 RD |
631 | |
632 | void DrawLabel(const wxString& text, const wxRect& rect, | |
633 | int alignment = wxALIGN_LEFT | wxALIGN_TOP, | |
634 | int indexAccel = -1); | |
635 | ||
636 | %addmethods { | |
637 | wxRect DrawImageLabel(const wxString& text, | |
638 | const wxBitmap& image, | |
639 | const wxRect& rect, | |
640 | int alignment = wxALIGN_LEFT | wxALIGN_TOP, | |
641 | int indexAccel = -1) { | |
642 | wxRect rv; | |
643 | self->DrawLabel(text, image, rect, alignment, indexAccel, &rv); | |
644 | return rv; | |
645 | } | |
646 | } | |
647 | ||
1e4a197e RD |
648 | void DrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2); |
649 | void DrawLines(int PCOUNT, wxPoint* points, wxCoord xoffset=0, wxCoord yoffset=0); | |
650 | void DrawPolygon(int PCOUNT, wxPoint* points, wxCoord xoffset=0, wxCoord yoffset=0, | |
7bf85405 | 651 | int fill_style=wxODDEVEN_RULE); |
1e4a197e RD |
652 | void DrawPoint(wxCoord x, wxCoord y); |
653 | void DrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height); | |
33ffdd72 | 654 | %name(DrawRectangleRect)void DrawRectangle(const wxRect& rect); |
6999b0d8 | 655 | void DrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle); |
1e4a197e | 656 | void DrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, wxCoord radius=20); |
eec92d76 | 657 | void DrawSpline(int PCOUNT, wxPoint* points); |
1e4a197e | 658 | void DrawText(const wxString& text, wxCoord x, wxCoord y); |
7bf85405 RD |
659 | void EndDoc(); |
660 | void EndDrawing(); | |
661 | void EndPage(); | |
1e4a197e | 662 | bool FloodFill(wxCoord x, wxCoord y, const wxColour& colour, int style=wxFLOOD_SURFACE); |
c5943253 RD |
663 | wxBrush GetBackground(); |
664 | wxBrush GetBrush(); | |
1e4a197e RD |
665 | wxCoord GetCharHeight(); |
666 | wxCoord GetCharWidth(); | |
667 | void GetClippingBox(wxCoord *OUTPUT, wxCoord *OUTPUT, | |
668 | wxCoord *OUTPUT, wxCoord *OUTPUT); | |
c5943253 | 669 | wxFont GetFont(); |
7bf85405 | 670 | int GetLogicalFunction(); |
eec92d76 | 671 | void GetLogicalScale(double *OUTPUT, double *OUTPUT); |
7bf85405 RD |
672 | int GetMapMode(); |
673 | bool GetOptimization(); | |
c5943253 | 674 | wxPen GetPen(); |
fb5e0af0 | 675 | %addmethods { |
1e4a197e | 676 | %new wxColour* GetPixel(wxCoord x, wxCoord y) { |
fb5e0af0 RD |
677 | wxColour* wc = new wxColour(); |
678 | self->GetPixel(x, y, wc); | |
679 | return wc; | |
680 | } | |
681 | } | |
bb0054cd RD |
682 | %name(GetSizeTuple)void GetSize(int* OUTPUT, int* OUTPUT); |
683 | wxSize GetSize(); | |
eec92d76 | 684 | wxSize GetSizeMM(); |
25832b3f | 685 | wxColour GetTextBackground(); |
1e4a197e | 686 | void GetTextExtent(const wxString& string, wxCoord *OUTPUT, wxCoord *OUTPUT); |
af309447 | 687 | %name(GetFullTextExtent)void GetTextExtent(const wxString& string, |
1e4a197e | 688 | wxCoord *OUTPUT, wxCoord *OUTPUT, wxCoord *OUTPUT, wxCoord* OUTPUT, |
af309447 | 689 | const wxFont* font = NULL); |
1e4a197e RD |
690 | void GetMultiLineTextExtent(const wxString& text, wxCoord *OUTPUT, wxCoord *OUTPUT, wxCoord *OUTPUT, |
691 | wxFont *font = NULL); | |
25832b3f | 692 | wxColour GetTextForeground(); |
eec92d76 | 693 | void GetUserScale(double *OUTPUT, double *OUTPUT); |
1e4a197e RD |
694 | wxCoord LogicalToDeviceX(wxCoord x); |
695 | wxCoord LogicalToDeviceXRel(wxCoord x); | |
696 | wxCoord LogicalToDeviceY(wxCoord y); | |
697 | wxCoord LogicalToDeviceYRel(wxCoord y); | |
698 | wxCoord MaxX(); | |
699 | wxCoord MaxY(); | |
700 | wxCoord MinX(); | |
701 | wxCoord MinY(); | |
7bf85405 | 702 | bool Ok(); |
1e4a197e | 703 | void SetDeviceOrigin(wxCoord x, wxCoord y); |
7bf85405 RD |
704 | void SetBackground(const wxBrush& brush); |
705 | void SetBackgroundMode(int mode); | |
1e4a197e | 706 | void SetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height); |
19a97bd6 | 707 | %name(SetClippingRegionAsRegion) void SetClippingRegion(const wxRegion& region); |
33ffdd72 | 708 | %name(SetClippingRect) void SetClippingRegion(const wxRect& rect); |
7bf85405 RD |
709 | void SetPalette(const wxPalette& colourMap); |
710 | void SetBrush(const wxBrush& brush); | |
711 | void SetFont(const wxFont& font); | |
712 | void SetLogicalFunction(int function); | |
eec92d76 | 713 | void SetLogicalScale(double x, double y); |
7bf85405 RD |
714 | void SetMapMode(int mode); |
715 | void SetOptimization(bool optimize); | |
716 | void SetPen(const wxPen& pen); | |
717 | void SetTextBackground(const wxColour& colour); | |
718 | void SetTextForeground(const wxColour& colour); | |
719 | void SetUserScale(double x_scale, double y_scale); | |
720 | bool StartDoc(const wxString& message); | |
721 | void StartPage(); | |
722 | ||
723 | ||
efc5f224 | 724 | |
1e4a197e | 725 | void DrawBitmap(const wxBitmap& bitmap, wxCoord x, wxCoord y, |
efc5f224 RD |
726 | int useMask = FALSE); |
727 | ||
eec92d76 RD |
728 | bool CanDrawBitmap(); |
729 | bool CanGetTextExtent(); | |
730 | int GetDepth(); | |
731 | wxSize GetPPI(); | |
732 | ||
733 | void GetLogicalOrigin(int *OUTPUT, int *OUTPUT); | |
734 | void SetLogicalOrigin(int x, int y); | |
735 | void GetDeviceOrigin(int *OUTPUT, int *OUTPUT); | |
eec92d76 RD |
736 | void SetAxisOrientation(bool xLeftRight, bool yBottomUp); |
737 | ||
f6bcfd97 BP |
738 | void CalcBoundingBox(int x, int y); |
739 | void ResetBoundingBox(); | |
c7e7022c | 740 | |
9d37f964 RD |
741 | %addmethods { |
742 | void GetBoundingBox(int* OUTPUT, int* OUTPUT, int* OUTPUT, int* OUTPUT); | |
743 | // See below for implementation | |
744 | } | |
745 | ||
1fded56b RD |
746 | %pragma(python) addtoclass = "def __nonzero__(self): return self.Ok()" |
747 | ||
c7e7022c RD |
748 | #ifdef __WXMSW__ |
749 | long GetHDC(); | |
750 | #endif | |
9d37f964 RD |
751 | |
752 | ||
1e4a197e | 753 | %addmethods { // See drawlist.cpp for impplementaion of these... |
9d37f964 | 754 | |
1e4a197e RD |
755 | PyObject* _DrawPointList(PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes) |
756 | { | |
757 | return wxPyDrawXXXList(*self, wxPyDrawXXXPoint, pyCoords, pyPens, pyBrushes); | |
9d37f964 RD |
758 | } |
759 | ||
1e4a197e RD |
760 | PyObject* _DrawLineList(PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes) |
761 | { | |
762 | return wxPyDrawXXXList(*self, wxPyDrawXXXLine, pyCoords, pyPens, pyBrushes); | |
763 | } | |
9d37f964 | 764 | |
1e4a197e RD |
765 | PyObject* _DrawRectangleList(PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes) |
766 | { | |
767 | return wxPyDrawXXXList(*self, wxPyDrawXXXRectangle, pyCoords, pyPens, pyBrushes); | |
768 | } | |
9d37f964 | 769 | |
1e4a197e RD |
770 | PyObject* _DrawEllipseList(PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes) |
771 | { | |
772 | return wxPyDrawXXXList(*self, wxPyDrawXXXEllipse, pyCoords, pyPens, pyBrushes); | |
773 | } | |
fd512ba2 | 774 | |
1e4a197e RD |
775 | PyObject* _DrawPolygonList(PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes) |
776 | { | |
777 | return wxPyDrawXXXList(*self, wxPyDrawXXXPolygon, pyCoords, pyPens, pyBrushes); | |
778 | } | |
fd512ba2 | 779 | |
1e4a197e RD |
780 | PyObject* _DrawTextList(PyObject* textList, PyObject* pyPoints, |
781 | PyObject* foregroundList, PyObject* backgroundList) { | |
782 | return wxPyDrawTextList(*self, textList, pyPoints, foregroundList, backgroundList); | |
9d37f964 RD |
783 | } |
784 | } | |
785 | ||
9d37f964 RD |
786 | %pragma(python) addtoclass = " |
787 | def DrawPointList(self, points, pens=None): | |
788 | if pens is None: | |
789 | pens = [] | |
790 | elif isinstance(pens, wxPenPtr): | |
791 | pens = [pens] | |
792 | elif len(pens) != len(points): | |
793 | raise ValueError('points and pens must have same length') | |
1e4a197e RD |
794 | return self._DrawPointList(points, pens, []) |
795 | ||
9d37f964 RD |
796 | |
797 | def DrawLineList(self, lines, pens=None): | |
798 | if pens is None: | |
799 | pens = [] | |
800 | elif isinstance(pens, wxPenPtr): | |
801 | pens = [pens] | |
802 | elif len(pens) != len(lines): | |
803 | raise ValueError('lines and pens must have same length') | |
1e4a197e RD |
804 | return self._DrawLineList(lines, pens, []) |
805 | ||
806 | ||
807 | def DrawRectangleList(self, rectangles, pens=None, brushes=None): | |
808 | if pens is None: | |
809 | pens = [] | |
810 | elif isinstance(pens, wxPenPtr): | |
811 | pens = [pens] | |
812 | elif len(pens) != len(rectangles): | |
813 | raise ValueError('rectangles and pens must have same length') | |
814 | if brushes is None: | |
815 | brushes = [] | |
816 | elif isinstance(brushes, wxBrushPtr): | |
817 | brushes = [brushes] | |
818 | elif len(brushes) != len(rectangles): | |
819 | raise ValueError('rectangles and brushes must have same length') | |
820 | return self._DrawRectangleList(rectangles, pens, brushes) | |
821 | ||
822 | ||
823 | def DrawEllipseList(self, ellipses, pens=None, brushes=None): | |
824 | if pens is None: | |
825 | pens = [] | |
826 | elif isinstance(pens, wxPenPtr): | |
827 | pens = [pens] | |
828 | elif len(pens) != len(ellipses): | |
829 | raise ValueError('ellipses and pens must have same length') | |
830 | if brushes is None: | |
831 | brushes = [] | |
832 | elif isinstance(brushes, wxBrushPtr): | |
833 | brushes = [brushes] | |
834 | elif len(brushes) != len(ellipses): | |
835 | raise ValueError('ellipses and brushes must have same length') | |
836 | return self._DrawEllipseList(ellipses, pens, brushes) | |
837 | ||
838 | ||
839 | def DrawPolygonList(self, polygons, pens=None, brushes=None): | |
840 | ## Note: This does not currently support fill style or offset | |
841 | ## you can always use the non-List version if need be. | |
842 | ## I really would like to support fill-style, however, | |
843 | ## but wxODDEVEN_RULE does not appear to be defined at the Python level | |
844 | ## [It's in wx.py... --Robin] | |
845 | if pens is None: | |
846 | pens = [] | |
847 | elif isinstance(pens, wxPenPtr): | |
848 | pens = [pens] | |
849 | elif len(pens) != len(polygons): | |
850 | raise ValueError('polygons and pens must have same length') | |
851 | if brushes is None: | |
852 | brushes = [] | |
853 | elif isinstance(brushes, wxBrushPtr): | |
854 | brushes = [brushes] | |
855 | elif len(brushes) != len(polygons): | |
856 | raise ValueError('polygons and brushes must have same length') | |
857 | return self._DrawPolygonList(polygons, pens, brushes) | |
858 | ||
859 | ||
860 | def DrawTextList(self, textList, coords, foregrounds = None, backgrounds = None, fonts = None): | |
861 | ## NOTE: this does not currently support changing the font | |
862 | ## Make sure you set Background mode to wxSolid (DC.SetBackgroundMode) | |
863 | ## If you want backgounds to do anything. | |
864 | if type(textList) == type(''): | |
865 | textList = [textList] | |
866 | elif len(textList) != len(coords): | |
867 | raise ValueError('textlist and coords must have same length') | |
868 | if foregrounds is None: | |
869 | foregrounds = [] | |
870 | elif isinstance(foregrounds, wxColourPtr): | |
871 | foregrounds = [foregrounds] | |
872 | elif len(foregrounds) != len(coords): | |
873 | raise ValueError('foregrounds and coords must have same length') | |
874 | if backgrounds is None: | |
875 | backgrounds = [] | |
876 | elif isinstance(backgrounds, wxColourPtr): | |
877 | backgrounds = [backgrounds] | |
878 | elif len(backgrounds) != len(coords): | |
879 | raise ValueError('backgrounds and coords must have same length') | |
880 | return self._DrawTextList(textList, coords, foregrounds, backgrounds) | |
9d37f964 RD |
881 | " |
882 | ||
883 | ||
7bf85405 RD |
884 | }; |
885 | ||
886 | ||
9d37f964 RD |
887 | |
888 | %{ | |
889 | static void wxDC_GetBoundingBox(wxDC* dc, int* x1, int* y1, int* x2, int* y2) { | |
890 | *x1 = dc->MinX(); | |
891 | *y1 = dc->MinY(); | |
892 | *x2 = dc->MaxX(); | |
893 | *y2 = dc->MaxY(); | |
894 | } | |
895 | %} | |
896 | ||
7bf85405 RD |
897 | //---------------------------------------------------------------------- |
898 | ||
899 | class wxMemoryDC : public wxDC { | |
900 | public: | |
901 | wxMemoryDC(); | |
902 | ||
903 | void SelectObject(const wxBitmap& bitmap); | |
904 | } | |
905 | ||
906 | %new wxMemoryDC* wxMemoryDCFromDC(wxDC* oldDC); | |
907 | %{ // Alternate 'constructor' | |
908 | wxMemoryDC* wxMemoryDCFromDC(wxDC* oldDC) { | |
909 | return new wxMemoryDC(oldDC); | |
910 | } | |
911 | %} | |
912 | ||
913 | ||
e9159fe8 RD |
914 | //--------------------------------------------------------------------------- |
915 | ||
916 | class wxBufferedDC : public wxMemoryDC { | |
917 | public: | |
918 | // Construct a wxBufferedDC using a user supplied buffer. | |
919 | wxBufferedDC( wxDC *dc, const wxBitmap &buffer ); | |
920 | ||
921 | // Construct a wxBufferedDC with an internal buffer of 'area' | |
922 | // (where area is usually something like the size of the window | |
923 | // being buffered) | |
924 | %name(wxBufferedDCInternalBuffer)wxBufferedDC( wxDC *dc, const wxSize &area ); | |
d3bfec74 RD |
925 | |
926 | // Blits the buffer to the dc, and detaches the dc from | |
927 | // the buffer. Usually called in the dtor or by the dtor | |
928 | // of derived classes if the BufferedDC must blit before | |
929 | // the derived class (which may own the dc it's blitting | |
930 | // to) is destroyed. | |
931 | void UnMask(); | |
932 | ||
933 | ||
934 | %pragma(python) addtomethod = | |
935 | "__init__:self._dc = _args[0] # save a ref so the other dc won't be deleted before self" | |
936 | %pragma(python) addtomethod = | |
937 | "wxBufferedDCInternalBuffer:val._dc = _args[0] # save a ref so the other dc won't be deleted before self" | |
e9159fe8 RD |
938 | }; |
939 | ||
940 | ||
941 | class wxBufferedPaintDC : public wxBufferedDC | |
942 | { | |
943 | public: | |
944 | wxBufferedPaintDC( wxWindow *window, const wxBitmap &buffer = wxNullBitmap ); | |
945 | }; | |
946 | ||
7bf85405 RD |
947 | //--------------------------------------------------------------------------- |
948 | ||
949 | class wxScreenDC : public wxDC { | |
950 | public: | |
951 | wxScreenDC(); | |
952 | ||
26b9cf27 RD |
953 | %name(StartDrawingOnTopWin) bool StartDrawingOnTop(wxWindow* window); |
954 | bool StartDrawingOnTop(wxRect* rect = NULL); | |
7bf85405 RD |
955 | bool EndDrawingOnTop(); |
956 | }; | |
957 | ||
958 | //--------------------------------------------------------------------------- | |
959 | ||
960 | class wxClientDC : public wxDC { | |
961 | public: | |
962 | wxClientDC(wxWindow* win); | |
963 | }; | |
964 | ||
965 | //--------------------------------------------------------------------------- | |
966 | ||
967 | class wxPaintDC : public wxDC { | |
968 | public: | |
969 | wxPaintDC(wxWindow* win); | |
970 | }; | |
971 | ||
972 | //--------------------------------------------------------------------------- | |
973 | ||
b639c3c5 RD |
974 | class wxWindowDC : public wxDC { |
975 | public: | |
976 | wxWindowDC(wxWindow* win); | |
977 | }; | |
b639c3c5 RD |
978 | |
979 | //--------------------------------------------------------------------------- | |
980 | ||
7bf85405 | 981 | |
d063802f | 982 | #ifdef __WXMSW__ |
17c0e08c RD |
983 | |
984 | %{ | |
985 | #include <wx/metafile.h> | |
986 | %} | |
987 | ||
988 | class wxMetaFile : public wxObject { | |
989 | public: | |
137b5242 | 990 | wxMetaFile(const wxString& filename = wxPyEmptyString); |
17c0e08c RD |
991 | ~wxMetaFile(); |
992 | ||
993 | bool Ok(); | |
994 | bool SetClipboard(int width = 0, int height = 0); | |
995 | ||
996 | wxSize GetSize(); | |
997 | int GetWidth(); | |
998 | int GetHeight(); | |
999 | ||
1000 | const wxString& GetFileName() const { return m_filename; } | |
1001 | ||
1fded56b | 1002 | %pragma(python) addtoclass = "def __nonzero__(self): return self.Ok()" |
17c0e08c RD |
1003 | }; |
1004 | ||
1005 | // bool wxMakeMetaFilePlaceable(const wxString& filename, | |
1006 | // int minX, int minY, int maxX, int maxY, float scale=1.0); | |
1007 | ||
1008 | ||
7bf85405 RD |
1009 | class wxMetaFileDC : public wxDC { |
1010 | public: | |
137b5242 | 1011 | wxMetaFileDC(const wxString& filename = wxPyEmptyString, |
17c0e08c | 1012 | int width = 0, int height = 0, |
137b5242 | 1013 | const wxString& description = wxPyEmptyString); |
7bf85405 RD |
1014 | wxMetaFile* Close(); |
1015 | }; | |
17c0e08c | 1016 | |
fb5e0af0 | 1017 | #endif |
7bf85405 | 1018 | |
b639c3c5 RD |
1019 | //--------------------------------------------------------------------------- |
1020 | ||
9416aa89 | 1021 | class wxPalette : public wxGDIObject { |
b639c3c5 | 1022 | public: |
eec92d76 | 1023 | wxPalette(int LCOUNT, byte* choices, byte* choices, byte* choices); |
b639c3c5 RD |
1024 | ~wxPalette(); |
1025 | ||
1026 | int GetPixel(byte red, byte green, byte blue); | |
1027 | bool GetRGB(int pixel, byte* OUTPUT, byte* OUTPUT, byte* OUTPUT); | |
1028 | bool Ok(); | |
1fded56b RD |
1029 | |
1030 | %pragma(python) addtoclass = "def __nonzero__(self): return self.Ok()" | |
b639c3c5 RD |
1031 | }; |
1032 | ||
1033 | //--------------------------------------------------------------------------- | |
1034 | ||
af309447 RD |
1035 | enum { |
1036 | wxIMAGELIST_DRAW_NORMAL , | |
1037 | wxIMAGELIST_DRAW_TRANSPARENT, | |
1038 | wxIMAGELIST_DRAW_SELECTED, | |
1039 | wxIMAGELIST_DRAW_FOCUSED, | |
1040 | wxIMAGE_LIST_NORMAL, | |
1041 | wxIMAGE_LIST_SMALL, | |
1042 | wxIMAGE_LIST_STATE | |
1043 | }; | |
1044 | ||
9416aa89 | 1045 | class wxImageList : public wxObject { |
af309447 | 1046 | public: |
dcd38683 | 1047 | wxImageList(int width, int height, int mask=TRUE, int initialCount=1); |
af309447 RD |
1048 | ~wxImageList(); |
1049 | ||
1050 | int Add(const wxBitmap& bitmap, const wxBitmap& mask = wxNullBitmap); | |
1051 | %name(AddWithColourMask)int Add(const wxBitmap& bitmap, const wxColour& maskColour); | |
1052 | %name(AddIcon)int Add(const wxIcon& icon); | |
f6bcfd97 | 1053 | #ifdef __WXMSW__ |
b57bdb5a | 1054 | bool Replace(int index, const wxBitmap& bitmap, const wxBitmap& mask = wxNullBitmap); |
b57bdb5a | 1055 | #else |
f6bcfd97 BP |
1056 | // %name(ReplaceIcon)bool Replace(int index, const wxIcon& icon); |
1057 | // int Add(const wxBitmap& bitmap); | |
b57bdb5a RD |
1058 | bool Replace(int index, const wxBitmap& bitmap); |
1059 | #endif | |
af309447 RD |
1060 | |
1061 | bool Draw(int index, wxDC& dc, int x, int x, int flags = wxIMAGELIST_DRAW_NORMAL, | |
1062 | const bool solidBackground = FALSE); | |
1063 | ||
1064 | int GetImageCount(); | |
1065 | bool Remove(int index); | |
1066 | bool RemoveAll(); | |
f6bcfd97 | 1067 | void GetSize(int index, int& OUTPUT, int& OUTPUT); |
af309447 RD |
1068 | }; |
1069 | ||
b639c3c5 | 1070 | |
9416aa89 RD |
1071 | //--------------------------------------------------------------------------- |
1072 | // Regions, etc. | |
1073 | ||
1074 | enum wxRegionContain { | |
1075 | wxOutRegion, wxPartRegion, wxInRegion | |
1076 | }; | |
1077 | ||
1078 | ||
1079 | class wxRegion : public wxGDIObject { | |
1080 | public: | |
1e4a197e | 1081 | wxRegion(wxCoord x=0, wxCoord y=0, wxCoord width=0, wxCoord height=0); |
8038a802 | 1082 | #ifndef __WXMAC__ |
3de0866e | 1083 | %name(wxRegionFromPoints)wxRegion(int PCOUNT, wxPoint* points, int fillStyle = wxWINDING_RULE); |
8038a802 | 1084 | #endif |
1542ea39 RD |
1085 | %name(wxRegionFromBitmap)wxRegion(const wxBitmap& bmp, |
1086 | const wxColour& transColour = wxNullColour, | |
1087 | int tolerance = 0); | |
9416aa89 RD |
1088 | ~wxRegion(); |
1089 | ||
1542ea39 | 1090 | |
9416aa89 | 1091 | void Clear(); |
d063802f | 1092 | #ifndef __WXMAC__ |
23bed520 | 1093 | bool Offset(wxCoord x, wxCoord y); |
d063802f | 1094 | #endif |
23bed520 | 1095 | |
1e4a197e | 1096 | wxRegionContain Contains(wxCoord x, wxCoord y); |
9416aa89 RD |
1097 | %name(ContainsPoint)wxRegionContain Contains(const wxPoint& pt); |
1098 | %name(ContainsRect)wxRegionContain Contains(const wxRect& rect); | |
1e4a197e | 1099 | %name(ContainsRectDim)wxRegionContain Contains(wxCoord x, wxCoord y, wxCoord w, wxCoord h); |
9416aa89 RD |
1100 | |
1101 | wxRect GetBox(); | |
1102 | ||
1e4a197e | 1103 | bool Intersect(wxCoord x, wxCoord y, wxCoord width, wxCoord height); |
9416aa89 RD |
1104 | %name(IntersectRect)bool Intersect(const wxRect& rect); |
1105 | %name(IntersectRegion)bool Intersect(const wxRegion& region); | |
1106 | ||
1107 | bool IsEmpty(); | |
1108 | ||
1e4a197e | 1109 | bool Union(wxCoord x, wxCoord y, wxCoord width, wxCoord height); |
9416aa89 RD |
1110 | %name(UnionRect)bool Union(const wxRect& rect); |
1111 | %name(UnionRegion)bool Union(const wxRegion& region); | |
1112 | ||
1e4a197e | 1113 | bool Subtract(wxCoord x, wxCoord y, wxCoord width, wxCoord height); |
9416aa89 RD |
1114 | %name(SubtractRect)bool Subtract(const wxRect& rect); |
1115 | %name(SubtractRegion)bool Subtract(const wxRegion& region); | |
1116 | ||
1e4a197e | 1117 | bool Xor(wxCoord x, wxCoord y, wxCoord width, wxCoord height); |
9416aa89 RD |
1118 | %name(XorRect)bool Xor(const wxRect& rect); |
1119 | %name(XorRegion)bool Xor(const wxRegion& region); | |
1542ea39 | 1120 | |
1fded56b | 1121 | // Convert the region to a B&W bitmap with the white pixels being inside |
1542ea39 RD |
1122 | // the region. |
1123 | wxBitmap ConvertToBitmap(); | |
1124 | ||
1125 | // Use the non-transparent pixels of a wxBitmap for the region to combine | |
1126 | // with this region. If the bitmap has a mask then it will be used, | |
1127 | // otherwise the colour to be treated as transparent may be specified, | |
1128 | // along with an optional tolerance value. | |
1129 | %name(UnionBitmap)bool Union(const wxBitmap& bmp, | |
1130 | const wxColour& transColour = wxNullColour, | |
1131 | int tolerance = 0); | |
9416aa89 RD |
1132 | }; |
1133 | ||
1134 | ||
1135 | ||
1136 | class wxRegionIterator : public wxObject { | |
1137 | public: | |
1138 | wxRegionIterator(const wxRegion& region); | |
1139 | ~wxRegionIterator(); | |
1140 | ||
1e4a197e RD |
1141 | wxCoord GetX(); |
1142 | wxCoord GetY(); | |
1143 | wxCoord GetW(); | |
1144 | wxCoord GetWidth(); | |
1145 | wxCoord GetH(); | |
1146 | wxCoord GetHeight(); | |
9416aa89 RD |
1147 | wxRect GetRect(); |
1148 | bool HaveRects(); | |
1149 | void Reset(); | |
1150 | ||
1151 | %addmethods { | |
1152 | void Next() { | |
1153 | (*self) ++; | |
1154 | } | |
1155 | }; | |
1156 | }; | |
1157 | ||
1158 | ||
7bf85405 RD |
1159 | //--------------------------------------------------------------------------- |
1160 | ||
1542ea39 | 1161 | |
c5943253 RD |
1162 | %readonly |
1163 | %{ | |
1164 | #if 0 | |
1165 | %} | |
1166 | ||
1167 | extern wxFont *wxNORMAL_FONT; | |
1168 | extern wxFont *wxSMALL_FONT; | |
1169 | extern wxFont *wxITALIC_FONT; | |
1170 | extern wxFont *wxSWISS_FONT; | |
1171 | ||
1172 | extern wxPen *wxRED_PEN; | |
1173 | extern wxPen *wxCYAN_PEN; | |
1174 | extern wxPen *wxGREEN_PEN; | |
1175 | extern wxPen *wxBLACK_PEN; | |
1176 | extern wxPen *wxWHITE_PEN; | |
1177 | extern wxPen *wxTRANSPARENT_PEN; | |
1178 | extern wxPen *wxBLACK_DASHED_PEN; | |
1179 | extern wxPen *wxGREY_PEN; | |
1180 | extern wxPen *wxMEDIUM_GREY_PEN; | |
1181 | extern wxPen *wxLIGHT_GREY_PEN; | |
1182 | ||
1183 | extern wxBrush *wxBLUE_BRUSH; | |
1184 | extern wxBrush *wxGREEN_BRUSH; | |
1185 | extern wxBrush *wxWHITE_BRUSH; | |
1186 | extern wxBrush *wxBLACK_BRUSH; | |
1187 | extern wxBrush *wxTRANSPARENT_BRUSH; | |
1188 | extern wxBrush *wxCYAN_BRUSH; | |
1189 | extern wxBrush *wxRED_BRUSH; | |
1190 | extern wxBrush *wxGREY_BRUSH; | |
1191 | extern wxBrush *wxMEDIUM_GREY_BRUSH; | |
1192 | extern wxBrush *wxLIGHT_GREY_BRUSH; | |
1193 | ||
1194 | extern wxColour *wxBLACK; | |
1195 | extern wxColour *wxWHITE; | |
1196 | extern wxColour *wxRED; | |
1197 | extern wxColour *wxBLUE; | |
1198 | extern wxColour *wxGREEN; | |
1199 | extern wxColour *wxCYAN; | |
1200 | extern wxColour *wxLIGHT_GREY; | |
1201 | ||
1202 | extern wxCursor *wxSTANDARD_CURSOR; | |
1203 | extern wxCursor *wxHOURGLASS_CURSOR; | |
1204 | extern wxCursor *wxCROSS_CURSOR; | |
1205 | ||
1206 | ||
1207 | extern wxBitmap wxNullBitmap; | |
1208 | extern wxIcon wxNullIcon; | |
1209 | extern wxCursor wxNullCursor; | |
1210 | extern wxPen wxNullPen; | |
1211 | extern wxBrush wxNullBrush; | |
1212 | extern wxPalette wxNullPalette; | |
1213 | extern wxFont wxNullFont; | |
1214 | extern wxColour wxNullColour; | |
1215 | ||
1216 | ||
1217 | extern wxFontList* wxTheFontList; | |
1218 | extern wxPenList* wxThePenList; | |
1219 | extern wxBrushList* wxTheBrushList; | |
1220 | extern wxColourDatabase* wxTheColourDatabase; | |
1221 | ||
1222 | ||
1223 | %readwrite | |
1224 | %{ | |
1225 | #endif | |
1226 | %} | |
1227 | ||
1228 | //--------------------------------------------------------------------------- | |
1229 | //--------------------------------------------------------------------------- | |
1230 |