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