]>
Commit | Line | Data |
---|---|---|
7bf85405 RD |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: gdi.i | |
3 | // Purpose: SWIG interface file for wxDC, wxBrush, wxPen, wxFont, etc. | |
4 | // | |
5 | // Author: Robin Dunn | |
6 | // | |
7 | // Created: 7/7/97 | |
8 | // RCS-ID: $Id$ | |
9 | // Copyright: (c) 1998 by Total Control Software | |
10 | // Licence: wxWindows license | |
11 | ///////////////////////////////////////////////////////////////////////////// | |
12 | ||
13 | ||
03e9bead RD |
14 | %module gdi |
15 | ||
16 | %{ | |
7bf85405 | 17 | #include "helpers.h" |
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> | |
7bf85405 RD |
23 | %} |
24 | ||
25 | //---------------------------------------------------------------------- | |
26 | ||
27 | %include typemaps.i | |
28 | %include my_typemaps.i | |
29 | ||
30 | // Import some definitions of other classes, etc. | |
31 | %import _defs.i | |
32 | %import misc.i | |
33 | ||
b68dc582 RD |
34 | %{ |
35 | static wxString wxPyEmptyStr(""); | |
36 | %} | |
37 | ||
7bf85405 RD |
38 | //--------------------------------------------------------------------------- |
39 | ||
9416aa89 RD |
40 | class wxGDIObject : public wxObject { |
41 | public: | |
42 | wxGDIObject(); | |
43 | ~wxGDIObject(); | |
44 | ||
45 | bool GetVisible(); | |
46 | void SetVisible( bool visible ); | |
47 | ||
48 | bool IsNull(); | |
49 | ||
50 | }; | |
6999b0d8 RD |
51 | |
52 | //--------------------------------------------------------------------------- | |
53 | ||
9416aa89 | 54 | class wxBitmap : public wxGDIObject |
5bff6bb8 | 55 | { |
7bf85405 | 56 | public: |
e6056257 | 57 | wxBitmap(const wxString& name, wxBitmapType type=wxBITMAP_TYPE_BMP); |
7bf85405 RD |
58 | ~wxBitmap(); |
59 | ||
7bf85405 RD |
60 | wxPalette* GetPalette(); |
61 | wxMask* GetMask(); | |
e6056257 RD |
62 | bool LoadFile(const wxString& name, wxBitmapType type=wxBITMAP_TYPE_BMP); |
63 | bool SaveFile(const wxString& name, wxBitmapType type, wxPalette* palette = NULL); | |
7bf85405 | 64 | void SetMask(wxMask* mask); |
fb5e0af0 | 65 | #ifdef __WXMSW__ |
b8b8dda7 | 66 | void SetPalette(wxPalette& palette); |
fb5e0af0 | 67 | #endif |
5bff6bb8 RD |
68 | |
69 | // wxGDIImage methods | |
70 | #ifdef __WXMSW__ | |
71 | long GetHandle(); | |
72 | void SetHandle(long handle); | |
73 | #endif | |
74 | bool Ok(); | |
75 | int GetWidth(); | |
76 | int GetHeight(); | |
77 | int GetDepth(); | |
78 | void SetWidth(int w); | |
79 | void SetHeight(int h); | |
80 | void SetDepth(int d); | |
81 | #ifdef __WXMSW__ | |
82 | void SetSize(const wxSize& size); | |
83 | #endif | |
f6bcfd97 BP |
84 | |
85 | wxBitmap GetSubBitmap( const wxRect& rect ); | |
f6bcfd97 | 86 | bool CopyFromIcon(const wxIcon& icon); |
ecc08ead | 87 | #ifdef __WXMSW__ |
f6bcfd97 BP |
88 | bool CopyFromCursor(const wxCursor& cursor); |
89 | int GetQuality(); | |
90 | void SetQuality(int q); | |
91 | #endif | |
92 | ||
93 | %pragma(python) addtoclass = " | |
94 | def __del__(self,gdic=gdic): | |
95 | try: | |
96 | if self.thisown == 1 : | |
97 | gdic.delete_wxBitmap(self) | |
98 | except: | |
99 | pass | |
100 | " | |
7bf85405 RD |
101 | }; |
102 | ||
5bff6bb8 | 103 | |
96bfd053 | 104 | // Declarations of some alternate "constructors" |
7bf85405 | 105 | %new wxBitmap* wxEmptyBitmap(int width, int height, int depth=-1); |
96bfd053 RD |
106 | %new wxBitmap* wxBitmapFromXPMData(PyObject* listOfStrings); |
107 | %new wxBitmap* wxBitmapFromIcon(const wxIcon& icon); | |
d56cebe7 | 108 | %new wxBitmap* wxBitmapFromBits(char* bits, int width, int height, int depth = 1 ); |
9c039d08 | 109 | |
d56cebe7 RD |
110 | // #ifdef __WXMSW__ |
111 | // %new wxBitmap* wxBitmapFromData(PyObject* data, long type, | |
112 | // int width, int height, int depth = 1); | |
113 | // #endif | |
8bf5d46e | 114 | |
96bfd053 RD |
115 | |
116 | ||
117 | %{ // Implementations of some alternate "constructors" | |
118 | ||
7bf85405 RD |
119 | wxBitmap* wxEmptyBitmap(int width, int height, int depth=-1) { |
120 | return new wxBitmap(width, height, depth); | |
121 | } | |
122 | ||
96bfd053 RD |
123 | static char** ConvertListOfStrings(PyObject* listOfStrings) { |
124 | char** cArray = NULL; | |
125 | int count; | |
126 | ||
127 | if (!PyList_Check(listOfStrings)) { | |
128 | PyErr_SetString(PyExc_TypeError, "Expected a list of strings."); | |
129 | return NULL; | |
130 | } | |
131 | count = PyList_Size(listOfStrings); | |
132 | cArray = new char*[count]; | |
133 | ||
134 | for(int x=0; x<count; x++) { | |
135 | // TODO: Need some validation and error checking here | |
136 | cArray[x] = PyString_AsString(PyList_GET_ITEM(listOfStrings, x)); | |
137 | } | |
138 | return cArray; | |
139 | } | |
140 | ||
d56cebe7 | 141 | |
96bfd053 RD |
142 | wxBitmap* wxBitmapFromXPMData(PyObject* listOfStrings) { |
143 | char** cArray = NULL; | |
144 | wxBitmap* bmp; | |
145 | ||
146 | cArray = ConvertListOfStrings(listOfStrings); | |
147 | if (! cArray) | |
148 | return NULL; | |
149 | bmp = new wxBitmap(cArray); | |
150 | delete [] cArray; | |
151 | return bmp; | |
152 | } | |
153 | ||
154 | ||
155 | wxBitmap* wxBitmapFromIcon(const wxIcon& icon) { | |
156 | return new wxBitmap(icon); | |
157 | } | |
158 | ||
159 | ||
d56cebe7 RD |
160 | wxBitmap* wxBitmapFromBits(char* bits, int width, int height, int depth = 1 ) { |
161 | return new wxBitmap(bits, width, height, depth); | |
162 | } | |
926bb76c | 163 | |
4c9993c3 | 164 | |
d56cebe7 RD |
165 | // #ifdef __WXMSW__ |
166 | // wxBitmap* wxBitmapFromData(PyObject* data, long type, | |
167 | // int width, int height, int depth = 1) { | |
168 | // if (! PyString_Check(data)) { | |
169 | // PyErr_SetString(PyExc_TypeError, "Expected string object"); | |
170 | // return NULL; | |
171 | // } | |
172 | // return new wxBitmap((void*)PyString_AsString(data), type, width, height, depth); | |
173 | // } | |
174 | // #endif | |
7bf85405 RD |
175 | %} |
176 | ||
177 | //--------------------------------------------------------------------------- | |
178 | ||
9416aa89 | 179 | class wxMask : public wxObject { |
7bf85405 RD |
180 | public: |
181 | wxMask(const wxBitmap& bitmap); | |
eb715945 | 182 | //~wxMask(); |
96bfd053 RD |
183 | |
184 | %addmethods { void Destroy() { delete self; } } | |
7bf85405 RD |
185 | }; |
186 | ||
187 | %new wxMask* wxMaskColour(const wxBitmap& bitmap, const wxColour& colour); | |
188 | %{ | |
189 | wxMask* wxMaskColour(const wxBitmap& bitmap, const wxColour& colour) { | |
190 | return new wxMask(bitmap, colour); | |
191 | } | |
192 | %} | |
193 | ||
194 | ||
195 | //--------------------------------------------------------------------------- | |
196 | ||
197 | ||
9416aa89 | 198 | class wxIcon : public wxGDIObject |
5bff6bb8 | 199 | { |
7bf85405 | 200 | public: |
fb5e0af0 RD |
201 | wxIcon(const wxString& name, long flags, |
202 | int desiredWidth = -1, int desiredHeight = -1); | |
7bf85405 RD |
203 | ~wxIcon(); |
204 | ||
7bf85405 | 205 | bool LoadFile(const wxString& name, long flags); |
5bff6bb8 RD |
206 | |
207 | // wxGDIImage methods | |
208 | #ifdef __WXMSW__ | |
209 | long GetHandle(); | |
210 | void SetHandle(long handle); | |
211 | #endif | |
212 | bool Ok(); | |
213 | int GetWidth(); | |
214 | int GetHeight(); | |
215 | int GetDepth(); | |
216 | void SetWidth(int w); | |
217 | void SetHeight(int h); | |
218 | void SetDepth(int d); | |
219 | #ifdef __WXMSW__ | |
220 | void SetSize(const wxSize& size); | |
221 | #endif | |
96bfd053 RD |
222 | void CopyFromBitmap(const wxBitmap& bmp); |
223 | ||
f6bcfd97 BP |
224 | %pragma(python) addtoclass = " |
225 | def __del__(self,gdic=gdic): | |
226 | try: | |
227 | if self.thisown == 1 : | |
228 | gdic.delete_wxIcon(self) | |
229 | except: | |
230 | pass | |
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); | |
238 | ||
239 | %{ // Implementations of some alternate "constructors" | |
240 | wxIcon* wxEmptyIcon() { | |
241 | return new wxIcon(); | |
242 | } | |
243 | ||
244 | wxIcon* wxIconFromXPMData(PyObject* listOfStrings) { | |
245 | char** cArray = NULL; | |
246 | wxIcon* icon; | |
247 | ||
248 | cArray = ConvertListOfStrings(listOfStrings); | |
249 | if (! cArray) | |
250 | return NULL; | |
251 | icon = new wxIcon(cArray); | |
252 | delete [] cArray; | |
253 | return icon; | |
254 | } | |
255 | %} | |
256 | ||
7bf85405 RD |
257 | //--------------------------------------------------------------------------- |
258 | ||
9416aa89 | 259 | class wxCursor : public wxGDIObject |
5bff6bb8 | 260 | { |
7bf85405 | 261 | public: |
fb5e0af0 | 262 | #ifdef __WXMSW__ |
7bf85405 | 263 | wxCursor(const wxString& cursorName, long flags, int hotSpotX=0, int hotSpotY=0); |
fb5e0af0 | 264 | #endif |
7bf85405 | 265 | ~wxCursor(); |
5bff6bb8 RD |
266 | |
267 | // wxGDIImage methods | |
268 | #ifdef __WXMSW__ | |
269 | long GetHandle(); | |
270 | void SetHandle(long handle); | |
271 | #endif | |
272 | bool Ok(); | |
273 | #ifdef __WXMSW__ | |
274 | int GetWidth(); | |
275 | int GetHeight(); | |
276 | int GetDepth(); | |
277 | void SetWidth(int w); | |
278 | void SetHeight(int h); | |
279 | void SetDepth(int d); | |
280 | void SetSize(const wxSize& size); | |
281 | #endif | |
7bf85405 RD |
282 | }; |
283 | ||
9c039d08 | 284 | %name(wxStockCursor) %new wxCursor* wxPyStockCursor(int id); |
7bf85405 | 285 | %{ // Alternate 'constructor' |
9c039d08 | 286 | wxCursor* wxPyStockCursor(int id) { |
7bf85405 RD |
287 | return new wxCursor(id); |
288 | } | |
289 | %} | |
290 | ||
291 | //---------------------------------------------------------------------- | |
292 | ||
f0261a72 | 293 | |
6d8b4f8d RD |
294 | enum wxFontFamily |
295 | { | |
296 | wxFONTFAMILY_DEFAULT = wxDEFAULT, | |
297 | wxFONTFAMILY_DECORATIVE = wxDECORATIVE, | |
298 | wxFONTFAMILY_ROMAN = wxROMAN, | |
299 | wxFONTFAMILY_SCRIPT = wxSCRIPT, | |
300 | wxFONTFAMILY_SWISS = wxSWISS, | |
301 | wxFONTFAMILY_MODERN = wxMODERN, | |
302 | wxFONTFAMILY_TELETYPE = wxTELETYPE, | |
303 | wxFONTFAMILY_MAX | |
304 | }; | |
305 | ||
306 | // font styles | |
307 | enum wxFontStyle | |
308 | { | |
309 | wxFONTSTYLE_NORMAL = wxNORMAL, | |
310 | wxFONTSTYLE_ITALIC = wxITALIC, | |
311 | wxFONTSTYLE_SLANT = wxSLANT, | |
312 | wxFONTSTYLE_MAX | |
313 | }; | |
314 | ||
315 | // font weights | |
316 | enum wxFontWeight | |
317 | { | |
318 | wxFONTWEIGHT_NORMAL = wxNORMAL, | |
319 | wxFONTWEIGHT_LIGHT = wxLIGHT, | |
320 | wxFONTWEIGHT_BOLD = wxBOLD, | |
321 | wxFONTWEIGHT_MAX | |
322 | }; | |
323 | ||
324 | ||
325 | // font encodings | |
f0261a72 RD |
326 | enum wxFontEncoding |
327 | { | |
328 | wxFONTENCODING_SYSTEM = -1, // system default | |
329 | wxFONTENCODING_DEFAULT, // current default encoding | |
330 | ||
331 | // ISO8859 standard defines a number of single-byte charsets | |
332 | wxFONTENCODING_ISO8859_1, // West European (Latin1) | |
333 | wxFONTENCODING_ISO8859_2, // Central and East European (Latin2) | |
334 | wxFONTENCODING_ISO8859_3, // Esperanto (Latin3) | |
6d8b4f8d | 335 | wxFONTENCODING_ISO8859_4, // Baltic (old) (Latin4) |
f0261a72 RD |
336 | wxFONTENCODING_ISO8859_5, // Cyrillic |
337 | wxFONTENCODING_ISO8859_6, // Arabic | |
338 | wxFONTENCODING_ISO8859_7, // Greek | |
339 | wxFONTENCODING_ISO8859_8, // Hebrew | |
340 | wxFONTENCODING_ISO8859_9, // Turkish (Latin5) | |
341 | wxFONTENCODING_ISO8859_10, // Variation of Latin4 (Latin6) | |
342 | wxFONTENCODING_ISO8859_11, // Thai | |
343 | wxFONTENCODING_ISO8859_12, // doesn't exist currently, but put it | |
344 | // here anyhow to make all ISO8859 | |
345 | // consecutive numbers | |
6d8b4f8d | 346 | wxFONTENCODING_ISO8859_13, // Baltic (Latin7) |
f0261a72 RD |
347 | wxFONTENCODING_ISO8859_14, // Latin8 |
348 | wxFONTENCODING_ISO8859_15, // Latin9 (a.k.a. Latin0, includes euro) | |
6d8b4f8d | 349 | wxFONTENCODING_ISO8859_MAX, |
f0261a72 RD |
350 | |
351 | // Cyrillic charset soup (see http://czyborra.com/charsets/cyrillic.html) | |
352 | wxFONTENCODING_KOI8, // we don't support any of KOI8 variants | |
353 | wxFONTENCODING_ALTERNATIVE, // same as MS-DOS CP866 | |
354 | wxFONTENCODING_BULGARIAN, // used under Linux in Bulgaria | |
355 | ||
356 | // what would we do without Microsoft? They have their own encodings | |
357 | // for DOS | |
358 | wxFONTENCODING_CP437, // original MS-DOS codepage | |
359 | wxFONTENCODING_CP850, // CP437 merged with Latin1 | |
360 | wxFONTENCODING_CP852, // CP437 merged with Latin2 | |
361 | wxFONTENCODING_CP855, // another cyrillic encoding | |
362 | wxFONTENCODING_CP866, // and another one | |
363 | // and for Windows | |
6d8b4f8d | 364 | wxFONTENCODING_CP874, // WinThai |
98624b49 RD |
365 | wxFONTENCODING_CP932, // Japanese (shift-JIS) |
366 | wxFONTENCODING_CP936, // Chiniese simplified (GB) | |
367 | wxFONTENCODING_CP949, // Korean (Hangul charset) | |
368 | wxFONTENCODING_CP950, // Chinese (traditional - Big5) | |
f0261a72 RD |
369 | wxFONTENCODING_CP1250, // WinLatin2 |
370 | wxFONTENCODING_CP1251, // WinCyrillic | |
371 | wxFONTENCODING_CP1252, // WinLatin1 | |
6d8b4f8d RD |
372 | wxFONTENCODING_CP1253, // WinGreek (8859-7) |
373 | wxFONTENCODING_CP1254, // WinTurkish | |
374 | wxFONTENCODING_CP1255, // WinHebrew | |
375 | wxFONTENCODING_CP1256, // WinArabic | |
376 | wxFONTENCODING_CP1257, // WinBaltic (same as Latin 7) | |
377 | wxFONTENCODING_CP12_MAX, | |
378 | ||
379 | wxFONTENCODING_UTF7, // UTF-7 Unicode encoding | |
380 | wxFONTENCODING_UTF8, // UTF-8 Unicode encoding | |
381 | ||
382 | wxFONTENCODING_UNICODE, // Unicode - currently used only by | |
383 | // wxEncodingConverter class | |
f0261a72 RD |
384 | |
385 | wxFONTENCODING_MAX | |
386 | }; | |
387 | ||
0569df0f | 388 | |
6d8b4f8d RD |
389 | |
390 | // wxNativeFontInfo is platform-specific font representation: this struct | |
391 | // should be considered as opaque font description only used by the native | |
392 | // functions, the user code can only get the objects of this type from | |
393 | // somewhere and pass it somewhere else (possibly save them somewhere using | |
394 | // ToString() and restore them using FromString()) | |
395 | struct wxNativeFontInfo | |
396 | { | |
397 | // it is important to be able to serialize wxNativeFontInfo objects to be | |
398 | // able to store them (in config file, for example) | |
399 | bool FromString(const wxString& s); | |
400 | wxString ToString() const; | |
401 | ||
402 | %addmethods { | |
403 | wxString __str__() { | |
404 | return self->ToString(); | |
405 | } | |
406 | } | |
407 | }; | |
408 | ||
409 | ||
410 | // wxFontMapper manages user-definable correspondence between logical font | |
411 | // names and the fonts present on the machine. | |
412 | // | |
413 | // The default implementations of all functions will ask the user if they are | |
414 | // not capable of finding the answer themselves and store the answer in a | |
415 | // config file (configurable via SetConfigXXX functions). This behaviour may | |
416 | // be disabled by giving the value of FALSE to "interactive" parameter. | |
417 | // However, the functions will always consult the config file to allow the | |
418 | // user-defined values override the default logic and there is no way to | |
419 | // disable this - which shouldn't be ever needed because if "interactive" was | |
420 | // never TRUE, the config file is never created anyhow. | |
421 | class wxFontMapper | |
422 | { | |
423 | public: | |
424 | wxFontMapper(); | |
425 | ~wxFontMapper(); | |
426 | ||
427 | ||
428 | // find an alternative for the given encoding (which is supposed to not be | |
429 | // available on this system). If successful, return TRUE and rwxFontEcoding | |
430 | // that can be used it wxFont ctor otherwise return FALSE | |
431 | //bool GetAltForEncoding(wxFontEncoding encoding, | |
432 | // wxFontEncoding *alt_encoding, | |
433 | // const wxString& facename = wxEmptyString, | |
434 | // bool interactive = TRUE); | |
435 | ||
436 | ||
437 | // Find an alternative for the given encoding (which is supposed to not be | |
438 | // available on this system). If successful, returns the encoding otherwise | |
439 | // returns None. | |
440 | %addmethods { | |
441 | PyObject* GetAltForEncoding(wxFontEncoding encoding, | |
442 | const wxString& facename = wxEmptyString, | |
443 | bool interactive = TRUE) { | |
444 | wxFontEncoding alt_enc; | |
445 | if (self->GetAltForEncoding(encoding, &alt_enc, facename, interactive)) | |
446 | return PyInt_FromLong(alt_enc); | |
447 | else { | |
448 | Py_INCREF(Py_None); | |
449 | return Py_None; | |
450 | } | |
451 | } | |
452 | } | |
453 | ||
454 | ||
455 | // checks whether given encoding is available in given face or not. | |
456 | // If no facename is given, | |
457 | bool IsEncodingAvailable(wxFontEncoding encoding, | |
458 | const wxString& facename = wxEmptyString); | |
459 | ||
460 | // returns the encoding for the given charset (in the form of RFC 2046) or | |
461 | // wxFONTENCODING_SYSTEM if couldn't decode it | |
462 | wxFontEncoding CharsetToEncoding(const wxString& charset, | |
463 | bool interactive = TRUE); | |
464 | ||
465 | // return internal string identifier for the encoding (see also | |
466 | // GetEncodingDescription()) | |
467 | static wxString GetEncodingName(wxFontEncoding encoding); | |
468 | ||
469 | // return user-readable string describing the given encoding | |
470 | // | |
471 | // NB: hard-coded now, but might change later (read it from config?) | |
472 | static wxString GetEncodingDescription(wxFontEncoding encoding); | |
473 | ||
474 | // the parent window for modal dialogs | |
475 | void SetDialogParent(wxWindow *parent); | |
476 | ||
477 | // the title for the dialogs (note that default is quite reasonable) | |
478 | void SetDialogTitle(const wxString& title); | |
479 | ||
480 | // functions which allow to configure the config object used: by default, | |
481 | // the global one (from wxConfigBase::Get() will be used) and the default | |
482 | // root path for the config settings is the string returned by | |
483 | // GetDefaultConfigPath() | |
484 | ||
485 | ||
486 | // set the config object to use (may be NULL to use default) | |
487 | void SetConfig(wxConfigBase *config); | |
488 | ||
489 | // set the root config path to use (should be an absolute path) | |
490 | void SetConfigPath(const wxString& prefix); | |
491 | ||
492 | // return default config path | |
493 | static const wxChar *GetDefaultConfigPath(); | |
494 | }; | |
495 | ||
496 | ||
497 | ||
498 | ||
9416aa89 | 499 | class wxFont : public wxGDIObject { |
7bf85405 | 500 | public: |
0569df0f RD |
501 | wxFont( int pointSize, int family, int style, int weight, |
502 | int underline=FALSE, char* faceName = "", | |
503 | wxFontEncoding encoding=wxFONTENCODING_DEFAULT); | |
6d8b4f8d RD |
504 | |
505 | %name(wxFontFromNativeInfo)wxFont(const wxNativeFontInfo& info); | |
506 | ||
0569df0f | 507 | ~wxFont(); |
7bf85405 | 508 | |
6d8b4f8d RD |
509 | bool Ok() const; |
510 | int GetPointSize() const; | |
511 | int GetFamily() const; | |
512 | int GetStyle() const; | |
513 | int GetWeight() const; | |
514 | bool GetUnderlined() const; | |
515 | wxString GetFaceName() const; | |
516 | wxFontEncoding GetEncoding() const; | |
517 | wxNativeFontInfo* GetNativeFontInfo() const; | |
518 | ||
7bf85405 | 519 | void SetPointSize(int pointSize); |
6d8b4f8d | 520 | void SetFamily(int family); |
7bf85405 | 521 | void SetStyle(int style); |
7bf85405 | 522 | void SetWeight(int weight); |
6d8b4f8d RD |
523 | void SetFaceName(const wxString& faceName); |
524 | void SetUnderlined(bool underlined); | |
f0261a72 | 525 | void SetEncoding(wxFontEncoding encoding); |
6d8b4f8d | 526 | void SetNativeFontInfo(const wxNativeFontInfo& info); |
7bf85405 | 527 | |
6d8b4f8d RD |
528 | wxString GetFamilyString() const; |
529 | wxString GetStyleString() const; | |
530 | wxString GetWeightString() const; | |
f0261a72 | 531 | |
6d8b4f8d RD |
532 | static wxFontEncoding GetDefaultEncoding(); |
533 | static void SetDefaultEncoding(wxFontEncoding encoding); | |
534 | ||
535 | }; | |
f0261a72 | 536 | |
0569df0f | 537 | |
9416aa89 | 538 | class wxFontList : public wxObject { |
0569df0f RD |
539 | public: |
540 | ||
541 | void AddFont(wxFont* font); | |
542 | wxFont * FindOrCreateFont(int point_size, int family, int style, int weight, | |
543 | bool underline = FALSE, const char* facename = NULL, | |
544 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT); | |
545 | void RemoveFont(wxFont *font); | |
2f4e9287 RD |
546 | |
547 | int GetCount(); | |
0569df0f RD |
548 | }; |
549 | ||
550 | ||
7bf85405 RD |
551 | //---------------------------------------------------------------------- |
552 | ||
9416aa89 | 553 | class wxColour : public wxObject { |
7bf85405 RD |
554 | public: |
555 | wxColour(unsigned char red=0, unsigned char green=0, unsigned char blue=0); | |
556 | ~wxColour(); | |
557 | unsigned char Red(); | |
558 | unsigned char Green(); | |
559 | unsigned char Blue(); | |
560 | bool Ok(); | |
561 | void Set(unsigned char red, unsigned char green, unsigned char blue); | |
562 | %addmethods { | |
563 | PyObject* Get() { | |
564 | PyObject* rv = PyTuple_New(3); | |
565 | PyTuple_SetItem(rv, 0, PyInt_FromLong(self->Red())); | |
566 | PyTuple_SetItem(rv, 1, PyInt_FromLong(self->Green())); | |
567 | PyTuple_SetItem(rv, 2, PyInt_FromLong(self->Blue())); | |
568 | return rv; | |
569 | } | |
570 | } | |
9b3d3bc4 RD |
571 | %pragma(python) addtoclass = "asTuple = Get" |
572 | %pragma(python) addtoclass = "def __str__(self): return str(self.asTuple())" | |
573 | %pragma(python) addtoclass = "def __repr__(self): return str(self.asTuple())" | |
574 | ||
7bf85405 RD |
575 | }; |
576 | ||
577 | %new wxColour* wxNamedColour(const wxString& colorName); | |
de20db99 | 578 | |
7bf85405 RD |
579 | %{ // Alternate 'constructor' |
580 | wxColour* wxNamedColour(const wxString& colorName) { | |
581 | return new wxColour(colorName); | |
582 | } | |
583 | %} | |
584 | ||
585 | ||
7bf85405 | 586 | |
9416aa89 | 587 | class wxColourDatabase : public wxObject { |
7bf85405 | 588 | public: |
0569df0f RD |
589 | |
590 | wxColour *FindColour(const wxString& colour); | |
591 | wxString FindName(const wxColour& colour) const; | |
592 | ||
7bf85405 | 593 | %addmethods { |
0569df0f RD |
594 | void Append(const wxString& name, int red, int green, int blue) { |
595 | self->Append(name.c_str(), new wxColour(red, green, blue)); | |
7bf85405 | 596 | } |
7bf85405 | 597 | } |
0569df0f RD |
598 | }; |
599 | ||
600 | ||
601 | //---------------------------------------------------------------------- | |
602 | ||
9416aa89 | 603 | class wxPen : public wxGDIObject { |
0569df0f RD |
604 | public: |
605 | wxPen(wxColour& colour, int width=1, int style=wxSOLID); | |
606 | ~wxPen(); | |
7bf85405 RD |
607 | |
608 | int GetCap(); | |
25832b3f | 609 | wxColour GetColour(); |
7bf85405 | 610 | |
fb5e0af0 | 611 | int GetJoin(); |
7bf85405 RD |
612 | int GetStyle(); |
613 | int GetWidth(); | |
614 | bool Ok(); | |
615 | void SetCap(int cap_style); | |
616 | void SetColour(wxColour& colour); | |
aeeb6a44 RR |
617 | void SetJoin(int join_style); |
618 | void SetStyle(int style); | |
619 | void SetWidth(int width); | |
08127323 | 620 | |
aeeb6a44 | 621 | // **** This one needs to return a list of ints (wxDash) |
ecc08ead | 622 | //int GetDashes(wxDash **dashes); |
eec92d76 | 623 | void SetDashes(int LCOUNT, wxDash* choices); |
6999b0d8 RD |
624 | |
625 | #ifdef __WXMSW__ | |
626 | wxBitmap* GetStipple(); | |
b8b8dda7 | 627 | void SetStipple(wxBitmap& stipple); |
fb5e0af0 | 628 | #endif |
7bf85405 RD |
629 | }; |
630 | ||
0569df0f | 631 | |
ecc08ead | 632 | |
05f30eec RD |
633 | |
634 | // The list of ints for the dashes needs to exist for the life of the pen | |
635 | // so we make it part of the class to save it. wxPyPen is aliased to wxPen | |
636 | // in _extras.py | |
637 | ||
ecc08ead RD |
638 | %{ |
639 | class wxPyPen : public wxPen { | |
640 | public: | |
641 | wxPyPen(wxColour& colour, int width=1, int style=wxSOLID) | |
642 | : wxPen(colour, width, style) | |
643 | { m_dash = NULL; } | |
644 | ~wxPyPen() { | |
645 | if (m_dash) | |
05f30eec | 646 | delete [] m_dash; |
ecc08ead RD |
647 | } |
648 | ||
649 | void SetDashes(int nb_dashes, const wxDash *dash) { | |
05f30eec RD |
650 | if (m_dash) |
651 | delete [] m_dash; | |
ecc08ead | 652 | m_dash = new wxDash[nb_dashes]; |
05f30eec | 653 | for (int i=0; i<nb_dashes; i++) { |
ecc08ead | 654 | m_dash[i] = dash[i]; |
05f30eec | 655 | } |
ecc08ead RD |
656 | wxPen::SetDashes(nb_dashes, m_dash); |
657 | } | |
658 | ||
659 | private: | |
660 | wxDash* m_dash; | |
661 | }; | |
662 | %} | |
663 | ||
664 | ||
ecc08ead RD |
665 | class wxPyPen : public wxPen { |
666 | public: | |
667 | wxPyPen(wxColour& colour, int width=1, int style=wxSOLID); | |
668 | ~wxPyPen(); | |
669 | ||
670 | void SetDashes(int LCOUNT, wxDash* choices); | |
671 | }; | |
672 | ||
673 | ||
674 | ||
05f30eec | 675 | |
9416aa89 | 676 | class wxPenList : public wxObject { |
0569df0f RD |
677 | public: |
678 | ||
679 | void AddPen(wxPen* pen); | |
680 | wxPen* FindOrCreatePen(const wxColour& colour, int width, int style); | |
681 | void RemovePen(wxPen* pen); | |
2f4e9287 RD |
682 | |
683 | int GetCount(); | |
0569df0f RD |
684 | }; |
685 | ||
686 | ||
687 | ||
7bf85405 RD |
688 | //---------------------------------------------------------------------- |
689 | ||
9416aa89 | 690 | class wxBrush : public wxGDIObject { |
7bf85405 | 691 | public: |
0569df0f RD |
692 | wxBrush(const wxColour& colour, int style=wxSOLID); |
693 | ~wxBrush(); | |
26b9cf27 | 694 | |
25832b3f | 695 | wxColour GetColour(); |
7bf85405 RD |
696 | wxBitmap * GetStipple(); |
697 | int GetStyle(); | |
698 | bool Ok(); | |
699 | void SetColour(wxColour &colour); | |
b8b8dda7 | 700 | void SetStipple(wxBitmap& bitmap); |
7bf85405 RD |
701 | void SetStyle(int style); |
702 | }; | |
703 | ||
0569df0f | 704 | |
6ee2116b | 705 | class wxBrushList : public wxObject { |
0569df0f RD |
706 | public: |
707 | ||
708 | void AddBrush(wxBrush *brush); | |
709 | wxBrush * FindOrCreateBrush(const wxColour& colour, int style); | |
710 | void RemoveBrush(wxBrush *brush); | |
2f4e9287 RD |
711 | |
712 | int GetCount(); | |
0569df0f RD |
713 | }; |
714 | ||
7bf85405 RD |
715 | //---------------------------------------------------------------------- |
716 | ||
717 | ||
718 | ||
9416aa89 | 719 | class wxDC : public wxObject { |
7bf85405 | 720 | public: |
fb5e0af0 | 721 | // wxDC(); **** abstract base class, can't instantiate. |
7bf85405 RD |
722 | ~wxDC(); |
723 | ||
724 | void BeginDrawing(); | |
efc5f224 RD |
725 | // %name(BlitXY) |
726 | bool Blit(long xdest, long ydest, | |
727 | long width, long height, | |
728 | wxDC *source, long xsrc, long ysrc, | |
729 | int logicalFunc = wxCOPY, int useMask = FALSE); | |
730 | // bool Blit(const wxPoint& destPt, const wxSize& sz, | |
731 | // wxDC *source, const wxPoint& srcPt, | |
732 | // int logicalFunc = wxCOPY, int useMask = FALSE); | |
733 | ||
7bf85405 RD |
734 | void Clear(); |
735 | void CrossHair(long x, long y); | |
736 | void DestroyClippingRegion(); | |
737 | long DeviceToLogicalX(long x); | |
738 | long DeviceToLogicalXRel(long x); | |
739 | long DeviceToLogicalY(long y); | |
740 | long DeviceToLogicalYRel(long y); | |
741 | void DrawArc(long x1, long y1, long x2, long y2, long xc, long yc); | |
bb0054cd | 742 | void DrawCircle(long x, long y, long radius); |
7bf85405 RD |
743 | void DrawEllipse(long x, long y, long width, long height); |
744 | void DrawEllipticArc(long x, long y, long width, long height, long start, long end); | |
745 | void DrawIcon(const wxIcon& icon, long x, long y); | |
746 | void DrawLine(long x1, long y1, long x2, long y2); | |
eec92d76 RD |
747 | void DrawLines(int PCOUNT, wxPoint* points, long xoffset=0, long yoffset=0); |
748 | void DrawPolygon(int PCOUNT, wxPoint* points, long xoffset=0, long yoffset=0, | |
7bf85405 RD |
749 | int fill_style=wxODDEVEN_RULE); |
750 | void DrawPoint(long x, long y); | |
751 | void DrawRectangle(long x, long y, long width, long height); | |
6999b0d8 | 752 | void DrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle); |
7bf85405 | 753 | void DrawRoundedRectangle(long x, long y, long width, long height, long radius=20); |
eec92d76 | 754 | void DrawSpline(int PCOUNT, wxPoint* points); |
7bf85405 RD |
755 | void DrawText(const wxString& text, long x, long y); |
756 | void EndDoc(); | |
757 | void EndDrawing(); | |
758 | void EndPage(); | |
759 | void FloodFill(long x, long y, const wxColour& colour, int style=wxFLOOD_SURFACE); | |
c5943253 RD |
760 | wxBrush GetBackground(); |
761 | wxBrush GetBrush(); | |
7bf85405 RD |
762 | long GetCharHeight(); |
763 | long GetCharWidth(); | |
764 | void GetClippingBox(long *OUTPUT, long *OUTPUT, | |
765 | long *OUTPUT, long *OUTPUT); | |
c5943253 | 766 | wxFont GetFont(); |
7bf85405 | 767 | int GetLogicalFunction(); |
eec92d76 | 768 | void GetLogicalScale(double *OUTPUT, double *OUTPUT); |
7bf85405 RD |
769 | int GetMapMode(); |
770 | bool GetOptimization(); | |
c5943253 | 771 | wxPen GetPen(); |
fb5e0af0 RD |
772 | %addmethods { |
773 | %new wxColour* GetPixel(long x, long y) { | |
774 | wxColour* wc = new wxColour(); | |
775 | self->GetPixel(x, y, wc); | |
776 | return wc; | |
777 | } | |
778 | } | |
bb0054cd RD |
779 | %name(GetSizeTuple)void GetSize(int* OUTPUT, int* OUTPUT); |
780 | wxSize GetSize(); | |
eec92d76 | 781 | wxSize GetSizeMM(); |
25832b3f | 782 | wxColour GetTextBackground(); |
af309447 RD |
783 | void GetTextExtent(const wxString& string, long *OUTPUT, long *OUTPUT); |
784 | %name(GetFullTextExtent)void GetTextExtent(const wxString& string, | |
785 | long *OUTPUT, long *OUTPUT, long *OUTPUT, long* OUTPUT, | |
786 | const wxFont* font = NULL); | |
25832b3f | 787 | wxColour GetTextForeground(); |
eec92d76 | 788 | void GetUserScale(double *OUTPUT, double *OUTPUT); |
7bf85405 RD |
789 | long LogicalToDeviceX(long x); |
790 | long LogicalToDeviceXRel(long x); | |
791 | long LogicalToDeviceY(long y); | |
792 | long LogicalToDeviceYRel(long y); | |
793 | long MaxX(); | |
794 | long MaxY(); | |
795 | long MinX(); | |
796 | long MinY(); | |
797 | bool Ok(); | |
798 | void SetDeviceOrigin(long x, long y); | |
799 | void SetBackground(const wxBrush& brush); | |
800 | void SetBackgroundMode(int mode); | |
801 | void SetClippingRegion(long x, long y, long width, long height); | |
19a97bd6 | 802 | %name(SetClippingRegionAsRegion) void SetClippingRegion(const wxRegion& region); |
7bf85405 RD |
803 | void SetPalette(const wxPalette& colourMap); |
804 | void SetBrush(const wxBrush& brush); | |
805 | void SetFont(const wxFont& font); | |
806 | void SetLogicalFunction(int function); | |
eec92d76 | 807 | void SetLogicalScale(double x, double y); |
7bf85405 RD |
808 | void SetMapMode(int mode); |
809 | void SetOptimization(bool optimize); | |
810 | void SetPen(const wxPen& pen); | |
811 | void SetTextBackground(const wxColour& colour); | |
812 | void SetTextForeground(const wxColour& colour); | |
813 | void SetUserScale(double x_scale, double y_scale); | |
814 | bool StartDoc(const wxString& message); | |
815 | void StartPage(); | |
816 | ||
817 | ||
efc5f224 RD |
818 | |
819 | void DrawBitmap(const wxBitmap& bitmap, long x, long y, | |
820 | int useMask = FALSE); | |
821 | ||
eec92d76 RD |
822 | bool CanDrawBitmap(); |
823 | bool CanGetTextExtent(); | |
824 | int GetDepth(); | |
825 | wxSize GetPPI(); | |
826 | ||
827 | void GetLogicalOrigin(int *OUTPUT, int *OUTPUT); | |
828 | void SetLogicalOrigin(int x, int y); | |
829 | void GetDeviceOrigin(int *OUTPUT, int *OUTPUT); | |
eec92d76 RD |
830 | void SetAxisOrientation(bool xLeftRight, bool yBottomUp); |
831 | ||
f6bcfd97 BP |
832 | void CalcBoundingBox(int x, int y); |
833 | void ResetBoundingBox(); | |
c7e7022c | 834 | |
9d37f964 RD |
835 | %addmethods { |
836 | void GetBoundingBox(int* OUTPUT, int* OUTPUT, int* OUTPUT, int* OUTPUT); | |
837 | // See below for implementation | |
838 | } | |
839 | ||
c7e7022c RD |
840 | #ifdef __WXMSW__ |
841 | long GetHDC(); | |
842 | #endif | |
9d37f964 RD |
843 | |
844 | ||
845 | %addmethods { | |
76e280e7 | 846 | // NOTE: These methods are VERY SIMILAR in implentation. It would be |
17c0e08c | 847 | // nice to factor out common code and or turn them into a set of |
76e280e7 RD |
848 | // template-like macros. |
849 | ||
9d37f964 RD |
850 | // Draw a point for every set of coordinants in pyPoints, optionally |
851 | // setting a new pen for each | |
852 | PyObject* _DrawPointList(PyObject* pyPoints, PyObject* pyPens) { | |
853 | bool isFastSeq = PyList_Check(pyPoints) || PyTuple_Check(pyPoints); | |
854 | bool isFastPens = PyList_Check(pyPens) || PyTuple_Check(pyPens); | |
855 | int numObjs = 0; | |
856 | int numPens = 0; | |
857 | wxPen* pen; | |
858 | PyObject* obj; | |
859 | int x1, y1; | |
860 | int i = 0; | |
861 | ||
862 | if (!PySequence_Check(pyPoints)) { | |
863 | goto err0; | |
864 | } | |
865 | if (!PySequence_Check(pyPens)) { | |
866 | goto err1; | |
867 | } | |
868 | numObjs = PySequence_Length(pyPoints); | |
869 | numPens = PySequence_Length(pyPens); | |
870 | ||
871 | for (i = 0; i < numObjs; i++) { | |
872 | // Use a new pen? | |
873 | if (i < numPens) { | |
874 | if (isFastPens) { | |
875 | obj = PySequence_Fast_GET_ITEM(pyPens, i); | |
876 | } | |
877 | else { | |
878 | obj = PySequence_GetItem(pyPens, i); | |
879 | } | |
880 | if (SWIG_GetPtrObj(obj, (void **) &pen, "_wxPen_p")) { | |
76e280e7 RD |
881 | if (!isFastPens) |
882 | Py_DECREF(obj); | |
9d37f964 RD |
883 | goto err1; |
884 | } | |
885 | ||
886 | self->SetPen(*pen); | |
887 | if (!isFastPens) | |
888 | Py_DECREF(obj); | |
889 | } | |
890 | ||
891 | // Get the point coordinants | |
892 | if (isFastSeq) { | |
893 | obj = PySequence_Fast_GET_ITEM(pyPoints, i); | |
894 | } | |
895 | else { | |
896 | obj = PySequence_GetItem(pyPoints, i); | |
897 | } | |
898 | if (! _2int_seq_helper(obj, &x1, &y1)) { | |
76e280e7 RD |
899 | if (!isFastPens) |
900 | Py_DECREF(obj); | |
9d37f964 RD |
901 | goto err0; |
902 | } | |
903 | ||
904 | // Now draw the point | |
905 | self->DrawPoint(x1, y1); | |
906 | ||
907 | if (!isFastSeq) | |
908 | Py_DECREF(obj); | |
909 | } | |
910 | ||
911 | Py_INCREF(Py_None); | |
912 | return Py_None; | |
913 | ||
914 | err1: | |
915 | PyErr_SetString(PyExc_TypeError, "Expected a sequence of wxPens"); | |
916 | return NULL; | |
917 | err0: | |
918 | PyErr_SetString(PyExc_TypeError, "Expected a sequence of (x,y) sequences."); | |
919 | return NULL; | |
920 | } | |
921 | ||
922 | ||
923 | // Draw a line for every set of coordinants in pyLines, optionally | |
924 | // setting a new pen for each | |
925 | PyObject* _DrawLineList(PyObject* pyLines, PyObject* pyPens) { | |
926 | bool isFastSeq = PyList_Check(pyLines) || PyTuple_Check(pyLines); | |
927 | bool isFastPens = PyList_Check(pyPens) || PyTuple_Check(pyPens); | |
928 | int numObjs = 0; | |
929 | int numPens = 0; | |
930 | wxPen* pen; | |
931 | PyObject* obj; | |
932 | int x1, y1, x2, y2; | |
933 | int i = 0; | |
934 | ||
935 | if (!PySequence_Check(pyLines)) { | |
936 | goto err0; | |
937 | } | |
938 | if (!PySequence_Check(pyPens)) { | |
939 | goto err1; | |
940 | } | |
941 | numObjs = PySequence_Length(pyLines); | |
942 | numPens = PySequence_Length(pyPens); | |
943 | ||
944 | for (i = 0; i < numObjs; i++) { | |
945 | // Use a new pen? | |
946 | if (i < numPens) { | |
947 | if (isFastPens) { | |
948 | obj = PySequence_Fast_GET_ITEM(pyPens, i); | |
949 | } | |
950 | else { | |
951 | obj = PySequence_GetItem(pyPens, i); | |
952 | } | |
953 | if (SWIG_GetPtrObj(obj, (void **) &pen, "_wxPen_p")) { | |
76e280e7 RD |
954 | if (!isFastPens) |
955 | Py_DECREF(obj); | |
9d37f964 RD |
956 | goto err1; |
957 | } | |
958 | ||
959 | self->SetPen(*pen); | |
960 | if (!isFastPens) | |
961 | Py_DECREF(obj); | |
962 | } | |
963 | ||
964 | // Get the line coordinants | |
965 | if (isFastSeq) { | |
966 | obj = PySequence_Fast_GET_ITEM(pyLines, i); | |
967 | } | |
968 | else { | |
969 | obj = PySequence_GetItem(pyLines, i); | |
970 | } | |
971 | if (! _4int_seq_helper(obj, &x1, &y1, &x2, &y2)) { | |
76e280e7 RD |
972 | if (!isFastPens) |
973 | Py_DECREF(obj); | |
9d37f964 RD |
974 | goto err0; |
975 | } | |
976 | ||
977 | // Now draw the line | |
978 | self->DrawLine(x1, y1, x2, y2); | |
979 | ||
980 | if (!isFastSeq) | |
981 | Py_DECREF(obj); | |
982 | } | |
983 | ||
984 | Py_INCREF(Py_None); | |
985 | return Py_None; | |
986 | ||
987 | err1: | |
988 | PyErr_SetString(PyExc_TypeError, "Expected a sequence of wxPens"); | |
989 | return NULL; | |
990 | err0: | |
991 | PyErr_SetString(PyExc_TypeError, "Expected a sequence of (x1,y1, x2,y2) sequences."); | |
992 | return NULL; | |
993 | } | |
994 | } | |
995 | ||
996 | ||
997 | %pragma(python) addtoclass = " | |
998 | def DrawPointList(self, points, pens=None): | |
999 | if pens is None: | |
1000 | pens = [] | |
1001 | elif isinstance(pens, wxPenPtr): | |
1002 | pens = [pens] | |
1003 | elif len(pens) != len(points): | |
1004 | raise ValueError('points and pens must have same length') | |
1005 | return self._DrawPointList(points, pens) | |
1006 | ||
1007 | def DrawLineList(self, lines, pens=None): | |
1008 | if pens is None: | |
1009 | pens = [] | |
1010 | elif isinstance(pens, wxPenPtr): | |
1011 | pens = [pens] | |
1012 | elif len(pens) != len(lines): | |
1013 | raise ValueError('lines and pens must have same length') | |
1014 | return self._DrawLineList(lines, pens) | |
1015 | " | |
1016 | ||
1017 | ||
7bf85405 RD |
1018 | }; |
1019 | ||
1020 | ||
9d37f964 RD |
1021 | |
1022 | %{ | |
1023 | static void wxDC_GetBoundingBox(wxDC* dc, int* x1, int* y1, int* x2, int* y2) { | |
1024 | *x1 = dc->MinX(); | |
1025 | *y1 = dc->MinY(); | |
1026 | *x2 = dc->MaxX(); | |
1027 | *y2 = dc->MaxY(); | |
1028 | } | |
1029 | %} | |
1030 | ||
7bf85405 RD |
1031 | //---------------------------------------------------------------------- |
1032 | ||
1033 | class wxMemoryDC : public wxDC { | |
1034 | public: | |
1035 | wxMemoryDC(); | |
1036 | ||
1037 | void SelectObject(const wxBitmap& bitmap); | |
1038 | } | |
1039 | ||
1040 | %new wxMemoryDC* wxMemoryDCFromDC(wxDC* oldDC); | |
1041 | %{ // Alternate 'constructor' | |
1042 | wxMemoryDC* wxMemoryDCFromDC(wxDC* oldDC) { | |
1043 | return new wxMemoryDC(oldDC); | |
1044 | } | |
1045 | %} | |
1046 | ||
1047 | ||
1048 | //--------------------------------------------------------------------------- | |
1049 | ||
1050 | class wxScreenDC : public wxDC { | |
1051 | public: | |
1052 | wxScreenDC(); | |
1053 | ||
26b9cf27 RD |
1054 | %name(StartDrawingOnTopWin) bool StartDrawingOnTop(wxWindow* window); |
1055 | bool StartDrawingOnTop(wxRect* rect = NULL); | |
7bf85405 RD |
1056 | bool EndDrawingOnTop(); |
1057 | }; | |
1058 | ||
1059 | //--------------------------------------------------------------------------- | |
1060 | ||
1061 | class wxClientDC : public wxDC { | |
1062 | public: | |
1063 | wxClientDC(wxWindow* win); | |
1064 | }; | |
1065 | ||
1066 | //--------------------------------------------------------------------------- | |
1067 | ||
1068 | class wxPaintDC : public wxDC { | |
1069 | public: | |
1070 | wxPaintDC(wxWindow* win); | |
1071 | }; | |
1072 | ||
1073 | //--------------------------------------------------------------------------- | |
1074 | ||
b639c3c5 RD |
1075 | class wxWindowDC : public wxDC { |
1076 | public: | |
1077 | wxWindowDC(wxWindow* win); | |
1078 | }; | |
b639c3c5 RD |
1079 | |
1080 | //--------------------------------------------------------------------------- | |
1081 | ||
7bf85405 | 1082 | |
fb5e0af0 | 1083 | #ifdef __WXMSW__ |
17c0e08c RD |
1084 | |
1085 | %{ | |
1086 | #include <wx/metafile.h> | |
1087 | %} | |
1088 | ||
1089 | class wxMetaFile : public wxObject { | |
1090 | public: | |
1091 | wxMetaFile(const wxString& filename = wxPyEmptyStr); | |
1092 | ~wxMetaFile(); | |
1093 | ||
1094 | bool Ok(); | |
1095 | bool SetClipboard(int width = 0, int height = 0); | |
1096 | ||
1097 | wxSize GetSize(); | |
1098 | int GetWidth(); | |
1099 | int GetHeight(); | |
1100 | ||
1101 | const wxString& GetFileName() const { return m_filename; } | |
1102 | ||
1103 | }; | |
1104 | ||
1105 | // bool wxMakeMetaFilePlaceable(const wxString& filename, | |
1106 | // int minX, int minY, int maxX, int maxY, float scale=1.0); | |
1107 | ||
1108 | ||
7bf85405 RD |
1109 | class wxMetaFileDC : public wxDC { |
1110 | public: | |
17c0e08c RD |
1111 | wxMetaFileDC(const wxString& filename = wxPyEmptyStr, |
1112 | int width = 0, int height = 0, | |
1113 | const wxString& description = wxPyEmptyStr); | |
7bf85405 RD |
1114 | wxMetaFile* Close(); |
1115 | }; | |
17c0e08c | 1116 | |
fb5e0af0 | 1117 | #endif |
7bf85405 | 1118 | |
b639c3c5 RD |
1119 | //--------------------------------------------------------------------------- |
1120 | ||
9416aa89 | 1121 | class wxPalette : public wxGDIObject { |
b639c3c5 | 1122 | public: |
eec92d76 | 1123 | wxPalette(int LCOUNT, byte* choices, byte* choices, byte* choices); |
b639c3c5 RD |
1124 | ~wxPalette(); |
1125 | ||
1126 | int GetPixel(byte red, byte green, byte blue); | |
1127 | bool GetRGB(int pixel, byte* OUTPUT, byte* OUTPUT, byte* OUTPUT); | |
1128 | bool Ok(); | |
1129 | }; | |
1130 | ||
1131 | //--------------------------------------------------------------------------- | |
1132 | ||
af309447 RD |
1133 | enum { |
1134 | wxIMAGELIST_DRAW_NORMAL , | |
1135 | wxIMAGELIST_DRAW_TRANSPARENT, | |
1136 | wxIMAGELIST_DRAW_SELECTED, | |
1137 | wxIMAGELIST_DRAW_FOCUSED, | |
1138 | wxIMAGE_LIST_NORMAL, | |
1139 | wxIMAGE_LIST_SMALL, | |
1140 | wxIMAGE_LIST_STATE | |
1141 | }; | |
1142 | ||
9416aa89 | 1143 | class wxImageList : public wxObject { |
af309447 | 1144 | public: |
dcd38683 | 1145 | wxImageList(int width, int height, int mask=TRUE, int initialCount=1); |
af309447 RD |
1146 | ~wxImageList(); |
1147 | ||
1148 | int Add(const wxBitmap& bitmap, const wxBitmap& mask = wxNullBitmap); | |
1149 | %name(AddWithColourMask)int Add(const wxBitmap& bitmap, const wxColour& maskColour); | |
1150 | %name(AddIcon)int Add(const wxIcon& icon); | |
f6bcfd97 | 1151 | #ifdef __WXMSW__ |
b57bdb5a | 1152 | bool Replace(int index, const wxBitmap& bitmap, const wxBitmap& mask = wxNullBitmap); |
b57bdb5a | 1153 | #else |
f6bcfd97 BP |
1154 | // %name(ReplaceIcon)bool Replace(int index, const wxIcon& icon); |
1155 | // int Add(const wxBitmap& bitmap); | |
b57bdb5a RD |
1156 | bool Replace(int index, const wxBitmap& bitmap); |
1157 | #endif | |
af309447 RD |
1158 | |
1159 | bool Draw(int index, wxDC& dc, int x, int x, int flags = wxIMAGELIST_DRAW_NORMAL, | |
1160 | const bool solidBackground = FALSE); | |
1161 | ||
1162 | int GetImageCount(); | |
1163 | bool Remove(int index); | |
1164 | bool RemoveAll(); | |
f6bcfd97 | 1165 | void GetSize(int index, int& OUTPUT, int& OUTPUT); |
af309447 RD |
1166 | }; |
1167 | ||
b639c3c5 | 1168 | |
9416aa89 RD |
1169 | //--------------------------------------------------------------------------- |
1170 | // Regions, etc. | |
1171 | ||
1172 | enum wxRegionContain { | |
1173 | wxOutRegion, wxPartRegion, wxInRegion | |
1174 | }; | |
1175 | ||
1176 | ||
1177 | class wxRegion : public wxGDIObject { | |
1178 | public: | |
1179 | wxRegion(long x=0, long y=0, long width=0, long height=0); | |
1180 | ~wxRegion(); | |
1181 | ||
1182 | void Clear(); | |
1183 | wxRegionContain Contains(long x, long y); | |
1184 | %name(ContainsPoint)wxRegionContain Contains(const wxPoint& pt); | |
1185 | %name(ContainsRect)wxRegionContain Contains(const wxRect& rect); | |
1186 | %name(ContainsRectDim)wxRegionContain Contains(long x, long y, long w, long h); | |
1187 | ||
1188 | wxRect GetBox(); | |
1189 | ||
1190 | bool Intersect(long x, long y, long width, long height); | |
1191 | %name(IntersectRect)bool Intersect(const wxRect& rect); | |
1192 | %name(IntersectRegion)bool Intersect(const wxRegion& region); | |
1193 | ||
1194 | bool IsEmpty(); | |
1195 | ||
1196 | bool Union(long x, long y, long width, long height); | |
1197 | %name(UnionRect)bool Union(const wxRect& rect); | |
1198 | %name(UnionRegion)bool Union(const wxRegion& region); | |
1199 | ||
1200 | bool Subtract(long x, long y, long width, long height); | |
1201 | %name(SubtractRect)bool Subtract(const wxRect& rect); | |
1202 | %name(SubtractRegion)bool Subtract(const wxRegion& region); | |
1203 | ||
1204 | bool Xor(long x, long y, long width, long height); | |
1205 | %name(XorRect)bool Xor(const wxRect& rect); | |
1206 | %name(XorRegion)bool Xor(const wxRegion& region); | |
1207 | }; | |
1208 | ||
1209 | ||
1210 | ||
1211 | class wxRegionIterator : public wxObject { | |
1212 | public: | |
1213 | wxRegionIterator(const wxRegion& region); | |
1214 | ~wxRegionIterator(); | |
1215 | ||
1216 | long GetX(); | |
1217 | long GetY(); | |
1218 | long GetW(); | |
1219 | long GetWidth(); | |
1220 | long GetH(); | |
1221 | long GetHeight(); | |
1222 | wxRect GetRect(); | |
1223 | bool HaveRects(); | |
1224 | void Reset(); | |
1225 | ||
1226 | %addmethods { | |
1227 | void Next() { | |
1228 | (*self) ++; | |
1229 | } | |
1230 | }; | |
1231 | }; | |
1232 | ||
1233 | ||
7bf85405 RD |
1234 | //--------------------------------------------------------------------------- |
1235 | ||
c5943253 RD |
1236 | %readonly |
1237 | %{ | |
1238 | #if 0 | |
1239 | %} | |
1240 | ||
1241 | extern wxFont *wxNORMAL_FONT; | |
1242 | extern wxFont *wxSMALL_FONT; | |
1243 | extern wxFont *wxITALIC_FONT; | |
1244 | extern wxFont *wxSWISS_FONT; | |
1245 | ||
1246 | extern wxPen *wxRED_PEN; | |
1247 | extern wxPen *wxCYAN_PEN; | |
1248 | extern wxPen *wxGREEN_PEN; | |
1249 | extern wxPen *wxBLACK_PEN; | |
1250 | extern wxPen *wxWHITE_PEN; | |
1251 | extern wxPen *wxTRANSPARENT_PEN; | |
1252 | extern wxPen *wxBLACK_DASHED_PEN; | |
1253 | extern wxPen *wxGREY_PEN; | |
1254 | extern wxPen *wxMEDIUM_GREY_PEN; | |
1255 | extern wxPen *wxLIGHT_GREY_PEN; | |
1256 | ||
1257 | extern wxBrush *wxBLUE_BRUSH; | |
1258 | extern wxBrush *wxGREEN_BRUSH; | |
1259 | extern wxBrush *wxWHITE_BRUSH; | |
1260 | extern wxBrush *wxBLACK_BRUSH; | |
1261 | extern wxBrush *wxTRANSPARENT_BRUSH; | |
1262 | extern wxBrush *wxCYAN_BRUSH; | |
1263 | extern wxBrush *wxRED_BRUSH; | |
1264 | extern wxBrush *wxGREY_BRUSH; | |
1265 | extern wxBrush *wxMEDIUM_GREY_BRUSH; | |
1266 | extern wxBrush *wxLIGHT_GREY_BRUSH; | |
1267 | ||
1268 | extern wxColour *wxBLACK; | |
1269 | extern wxColour *wxWHITE; | |
1270 | extern wxColour *wxRED; | |
1271 | extern wxColour *wxBLUE; | |
1272 | extern wxColour *wxGREEN; | |
1273 | extern wxColour *wxCYAN; | |
1274 | extern wxColour *wxLIGHT_GREY; | |
1275 | ||
1276 | extern wxCursor *wxSTANDARD_CURSOR; | |
1277 | extern wxCursor *wxHOURGLASS_CURSOR; | |
1278 | extern wxCursor *wxCROSS_CURSOR; | |
1279 | ||
1280 | ||
1281 | extern wxBitmap wxNullBitmap; | |
1282 | extern wxIcon wxNullIcon; | |
1283 | extern wxCursor wxNullCursor; | |
1284 | extern wxPen wxNullPen; | |
1285 | extern wxBrush wxNullBrush; | |
1286 | extern wxPalette wxNullPalette; | |
1287 | extern wxFont wxNullFont; | |
1288 | extern wxColour wxNullColour; | |
1289 | ||
1290 | ||
1291 | extern wxFontList* wxTheFontList; | |
1292 | extern wxPenList* wxThePenList; | |
1293 | extern wxBrushList* wxTheBrushList; | |
1294 | extern wxColourDatabase* wxTheColourDatabase; | |
1295 | ||
1296 | ||
1297 | %readwrite | |
1298 | %{ | |
1299 | #endif | |
1300 | %} | |
1301 | ||
1302 | //--------------------------------------------------------------------------- | |
1303 | //--------------------------------------------------------------------------- | |
1304 |