]>
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); | |
546 | }; | |
547 | ||
548 | ||
7bf85405 RD |
549 | //---------------------------------------------------------------------- |
550 | ||
9416aa89 | 551 | class wxColour : public wxObject { |
7bf85405 RD |
552 | public: |
553 | wxColour(unsigned char red=0, unsigned char green=0, unsigned char blue=0); | |
554 | ~wxColour(); | |
555 | unsigned char Red(); | |
556 | unsigned char Green(); | |
557 | unsigned char Blue(); | |
558 | bool Ok(); | |
559 | void Set(unsigned char red, unsigned char green, unsigned char blue); | |
560 | %addmethods { | |
561 | PyObject* Get() { | |
562 | PyObject* rv = PyTuple_New(3); | |
563 | PyTuple_SetItem(rv, 0, PyInt_FromLong(self->Red())); | |
564 | PyTuple_SetItem(rv, 1, PyInt_FromLong(self->Green())); | |
565 | PyTuple_SetItem(rv, 2, PyInt_FromLong(self->Blue())); | |
566 | return rv; | |
567 | } | |
568 | } | |
9b3d3bc4 RD |
569 | %pragma(python) addtoclass = "asTuple = Get" |
570 | %pragma(python) addtoclass = "def __str__(self): return str(self.asTuple())" | |
571 | %pragma(python) addtoclass = "def __repr__(self): return str(self.asTuple())" | |
572 | ||
7bf85405 RD |
573 | }; |
574 | ||
575 | %new wxColour* wxNamedColour(const wxString& colorName); | |
de20db99 | 576 | |
7bf85405 RD |
577 | %{ // Alternate 'constructor' |
578 | wxColour* wxNamedColour(const wxString& colorName) { | |
579 | return new wxColour(colorName); | |
580 | } | |
581 | %} | |
582 | ||
583 | ||
7bf85405 | 584 | |
9416aa89 | 585 | class wxColourDatabase : public wxObject { |
7bf85405 | 586 | public: |
0569df0f RD |
587 | |
588 | wxColour *FindColour(const wxString& colour); | |
589 | wxString FindName(const wxColour& colour) const; | |
590 | ||
7bf85405 | 591 | %addmethods { |
0569df0f RD |
592 | void Append(const wxString& name, int red, int green, int blue) { |
593 | self->Append(name.c_str(), new wxColour(red, green, blue)); | |
7bf85405 | 594 | } |
7bf85405 | 595 | } |
0569df0f RD |
596 | }; |
597 | ||
598 | ||
599 | //---------------------------------------------------------------------- | |
600 | ||
9416aa89 | 601 | class wxPen : public wxGDIObject { |
0569df0f RD |
602 | public: |
603 | wxPen(wxColour& colour, int width=1, int style=wxSOLID); | |
604 | ~wxPen(); | |
7bf85405 RD |
605 | |
606 | int GetCap(); | |
25832b3f | 607 | wxColour GetColour(); |
7bf85405 | 608 | |
fb5e0af0 | 609 | int GetJoin(); |
7bf85405 RD |
610 | int GetStyle(); |
611 | int GetWidth(); | |
612 | bool Ok(); | |
613 | void SetCap(int cap_style); | |
614 | void SetColour(wxColour& colour); | |
aeeb6a44 RR |
615 | void SetJoin(int join_style); |
616 | void SetStyle(int style); | |
617 | void SetWidth(int width); | |
08127323 | 618 | |
aeeb6a44 | 619 | // **** This one needs to return a list of ints (wxDash) |
ecc08ead | 620 | //int GetDashes(wxDash **dashes); |
eec92d76 | 621 | void SetDashes(int LCOUNT, wxDash* choices); |
6999b0d8 RD |
622 | |
623 | #ifdef __WXMSW__ | |
624 | wxBitmap* GetStipple(); | |
b8b8dda7 | 625 | void SetStipple(wxBitmap& stipple); |
fb5e0af0 | 626 | #endif |
7bf85405 RD |
627 | }; |
628 | ||
0569df0f | 629 | |
ecc08ead | 630 | |
05f30eec RD |
631 | |
632 | // The list of ints for the dashes needs to exist for the life of the pen | |
633 | // so we make it part of the class to save it. wxPyPen is aliased to wxPen | |
634 | // in _extras.py | |
635 | ||
ecc08ead RD |
636 | %{ |
637 | class wxPyPen : public wxPen { | |
638 | public: | |
639 | wxPyPen(wxColour& colour, int width=1, int style=wxSOLID) | |
640 | : wxPen(colour, width, style) | |
641 | { m_dash = NULL; } | |
642 | ~wxPyPen() { | |
643 | if (m_dash) | |
05f30eec | 644 | delete [] m_dash; |
ecc08ead RD |
645 | } |
646 | ||
647 | void SetDashes(int nb_dashes, const wxDash *dash) { | |
05f30eec RD |
648 | if (m_dash) |
649 | delete [] m_dash; | |
ecc08ead | 650 | m_dash = new wxDash[nb_dashes]; |
05f30eec | 651 | for (int i=0; i<nb_dashes; i++) { |
ecc08ead | 652 | m_dash[i] = dash[i]; |
05f30eec | 653 | } |
ecc08ead RD |
654 | wxPen::SetDashes(nb_dashes, m_dash); |
655 | } | |
656 | ||
657 | private: | |
658 | wxDash* m_dash; | |
659 | }; | |
660 | %} | |
661 | ||
662 | ||
ecc08ead RD |
663 | class wxPyPen : public wxPen { |
664 | public: | |
665 | wxPyPen(wxColour& colour, int width=1, int style=wxSOLID); | |
666 | ~wxPyPen(); | |
667 | ||
668 | void SetDashes(int LCOUNT, wxDash* choices); | |
669 | }; | |
670 | ||
671 | ||
672 | ||
05f30eec | 673 | |
9416aa89 | 674 | class wxPenList : public wxObject { |
0569df0f RD |
675 | public: |
676 | ||
677 | void AddPen(wxPen* pen); | |
678 | wxPen* FindOrCreatePen(const wxColour& colour, int width, int style); | |
679 | void RemovePen(wxPen* pen); | |
680 | }; | |
681 | ||
682 | ||
683 | ||
7bf85405 RD |
684 | //---------------------------------------------------------------------- |
685 | ||
9416aa89 | 686 | class wxBrush : public wxGDIObject { |
7bf85405 | 687 | public: |
0569df0f RD |
688 | wxBrush(const wxColour& colour, int style=wxSOLID); |
689 | ~wxBrush(); | |
26b9cf27 | 690 | |
25832b3f | 691 | wxColour GetColour(); |
7bf85405 RD |
692 | wxBitmap * GetStipple(); |
693 | int GetStyle(); | |
694 | bool Ok(); | |
695 | void SetColour(wxColour &colour); | |
b8b8dda7 | 696 | void SetStipple(wxBitmap& bitmap); |
7bf85405 RD |
697 | void SetStyle(int style); |
698 | }; | |
699 | ||
0569df0f | 700 | |
6ee2116b | 701 | class wxBrushList : public wxObject { |
0569df0f RD |
702 | public: |
703 | ||
704 | void AddBrush(wxBrush *brush); | |
705 | wxBrush * FindOrCreateBrush(const wxColour& colour, int style); | |
706 | void RemoveBrush(wxBrush *brush); | |
707 | }; | |
708 | ||
7bf85405 RD |
709 | //---------------------------------------------------------------------- |
710 | ||
711 | ||
712 | ||
9416aa89 | 713 | class wxDC : public wxObject { |
7bf85405 | 714 | public: |
fb5e0af0 | 715 | // wxDC(); **** abstract base class, can't instantiate. |
7bf85405 RD |
716 | ~wxDC(); |
717 | ||
718 | void BeginDrawing(); | |
efc5f224 RD |
719 | // %name(BlitXY) |
720 | bool Blit(long xdest, long ydest, | |
721 | long width, long height, | |
722 | wxDC *source, long xsrc, long ysrc, | |
723 | int logicalFunc = wxCOPY, int useMask = FALSE); | |
724 | // bool Blit(const wxPoint& destPt, const wxSize& sz, | |
725 | // wxDC *source, const wxPoint& srcPt, | |
726 | // int logicalFunc = wxCOPY, int useMask = FALSE); | |
727 | ||
7bf85405 RD |
728 | void Clear(); |
729 | void CrossHair(long x, long y); | |
730 | void DestroyClippingRegion(); | |
731 | long DeviceToLogicalX(long x); | |
732 | long DeviceToLogicalXRel(long x); | |
733 | long DeviceToLogicalY(long y); | |
734 | long DeviceToLogicalYRel(long y); | |
735 | void DrawArc(long x1, long y1, long x2, long y2, long xc, long yc); | |
bb0054cd | 736 | void DrawCircle(long x, long y, long radius); |
7bf85405 RD |
737 | void DrawEllipse(long x, long y, long width, long height); |
738 | void DrawEllipticArc(long x, long y, long width, long height, long start, long end); | |
739 | void DrawIcon(const wxIcon& icon, long x, long y); | |
740 | void DrawLine(long x1, long y1, long x2, long y2); | |
eec92d76 RD |
741 | void DrawLines(int PCOUNT, wxPoint* points, long xoffset=0, long yoffset=0); |
742 | void DrawPolygon(int PCOUNT, wxPoint* points, long xoffset=0, long yoffset=0, | |
7bf85405 RD |
743 | int fill_style=wxODDEVEN_RULE); |
744 | void DrawPoint(long x, long y); | |
745 | void DrawRectangle(long x, long y, long width, long height); | |
6999b0d8 | 746 | void DrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle); |
7bf85405 | 747 | void DrawRoundedRectangle(long x, long y, long width, long height, long radius=20); |
eec92d76 | 748 | void DrawSpline(int PCOUNT, wxPoint* points); |
7bf85405 RD |
749 | void DrawText(const wxString& text, long x, long y); |
750 | void EndDoc(); | |
751 | void EndDrawing(); | |
752 | void EndPage(); | |
753 | void FloodFill(long x, long y, const wxColour& colour, int style=wxFLOOD_SURFACE); | |
b8b8dda7 RD |
754 | wxBrush& GetBackground(); |
755 | wxBrush& GetBrush(); | |
7bf85405 RD |
756 | long GetCharHeight(); |
757 | long GetCharWidth(); | |
758 | void GetClippingBox(long *OUTPUT, long *OUTPUT, | |
759 | long *OUTPUT, long *OUTPUT); | |
b8b8dda7 | 760 | wxFont& GetFont(); |
7bf85405 | 761 | int GetLogicalFunction(); |
eec92d76 | 762 | void GetLogicalScale(double *OUTPUT, double *OUTPUT); |
7bf85405 RD |
763 | int GetMapMode(); |
764 | bool GetOptimization(); | |
b8b8dda7 | 765 | wxPen& GetPen(); |
fb5e0af0 RD |
766 | %addmethods { |
767 | %new wxColour* GetPixel(long x, long y) { | |
768 | wxColour* wc = new wxColour(); | |
769 | self->GetPixel(x, y, wc); | |
770 | return wc; | |
771 | } | |
772 | } | |
bb0054cd RD |
773 | %name(GetSizeTuple)void GetSize(int* OUTPUT, int* OUTPUT); |
774 | wxSize GetSize(); | |
eec92d76 | 775 | wxSize GetSizeMM(); |
25832b3f | 776 | wxColour GetTextBackground(); |
af309447 RD |
777 | void GetTextExtent(const wxString& string, long *OUTPUT, long *OUTPUT); |
778 | %name(GetFullTextExtent)void GetTextExtent(const wxString& string, | |
779 | long *OUTPUT, long *OUTPUT, long *OUTPUT, long* OUTPUT, | |
780 | const wxFont* font = NULL); | |
25832b3f | 781 | wxColour GetTextForeground(); |
eec92d76 | 782 | void GetUserScale(double *OUTPUT, double *OUTPUT); |
7bf85405 RD |
783 | long LogicalToDeviceX(long x); |
784 | long LogicalToDeviceXRel(long x); | |
785 | long LogicalToDeviceY(long y); | |
786 | long LogicalToDeviceYRel(long y); | |
787 | long MaxX(); | |
788 | long MaxY(); | |
789 | long MinX(); | |
790 | long MinY(); | |
791 | bool Ok(); | |
792 | void SetDeviceOrigin(long x, long y); | |
793 | void SetBackground(const wxBrush& brush); | |
794 | void SetBackgroundMode(int mode); | |
795 | void SetClippingRegion(long x, long y, long width, long height); | |
19a97bd6 | 796 | %name(SetClippingRegionAsRegion) void SetClippingRegion(const wxRegion& region); |
7bf85405 RD |
797 | void SetPalette(const wxPalette& colourMap); |
798 | void SetBrush(const wxBrush& brush); | |
799 | void SetFont(const wxFont& font); | |
800 | void SetLogicalFunction(int function); | |
eec92d76 | 801 | void SetLogicalScale(double x, double y); |
7bf85405 RD |
802 | void SetMapMode(int mode); |
803 | void SetOptimization(bool optimize); | |
804 | void SetPen(const wxPen& pen); | |
805 | void SetTextBackground(const wxColour& colour); | |
806 | void SetTextForeground(const wxColour& colour); | |
807 | void SetUserScale(double x_scale, double y_scale); | |
808 | bool StartDoc(const wxString& message); | |
809 | void StartPage(); | |
810 | ||
811 | ||
efc5f224 RD |
812 | |
813 | void DrawBitmap(const wxBitmap& bitmap, long x, long y, | |
814 | int useMask = FALSE); | |
815 | ||
eec92d76 RD |
816 | bool CanDrawBitmap(); |
817 | bool CanGetTextExtent(); | |
818 | int GetDepth(); | |
819 | wxSize GetPPI(); | |
820 | ||
821 | void GetLogicalOrigin(int *OUTPUT, int *OUTPUT); | |
822 | void SetLogicalOrigin(int x, int y); | |
823 | void GetDeviceOrigin(int *OUTPUT, int *OUTPUT); | |
eec92d76 RD |
824 | void SetAxisOrientation(bool xLeftRight, bool yBottomUp); |
825 | ||
f6bcfd97 BP |
826 | void CalcBoundingBox(int x, int y); |
827 | void ResetBoundingBox(); | |
c7e7022c | 828 | |
9d37f964 RD |
829 | %addmethods { |
830 | void GetBoundingBox(int* OUTPUT, int* OUTPUT, int* OUTPUT, int* OUTPUT); | |
831 | // See below for implementation | |
832 | } | |
833 | ||
c7e7022c RD |
834 | #ifdef __WXMSW__ |
835 | long GetHDC(); | |
836 | #endif | |
9d37f964 RD |
837 | |
838 | ||
839 | %addmethods { | |
76e280e7 | 840 | // NOTE: These methods are VERY SIMILAR in implentation. It would be |
17c0e08c | 841 | // nice to factor out common code and or turn them into a set of |
76e280e7 RD |
842 | // template-like macros. |
843 | ||
9d37f964 RD |
844 | // Draw a point for every set of coordinants in pyPoints, optionally |
845 | // setting a new pen for each | |
846 | PyObject* _DrawPointList(PyObject* pyPoints, PyObject* pyPens) { | |
847 | bool isFastSeq = PyList_Check(pyPoints) || PyTuple_Check(pyPoints); | |
848 | bool isFastPens = PyList_Check(pyPens) || PyTuple_Check(pyPens); | |
849 | int numObjs = 0; | |
850 | int numPens = 0; | |
851 | wxPen* pen; | |
852 | PyObject* obj; | |
853 | int x1, y1; | |
854 | int i = 0; | |
855 | ||
856 | if (!PySequence_Check(pyPoints)) { | |
857 | goto err0; | |
858 | } | |
859 | if (!PySequence_Check(pyPens)) { | |
860 | goto err1; | |
861 | } | |
862 | numObjs = PySequence_Length(pyPoints); | |
863 | numPens = PySequence_Length(pyPens); | |
864 | ||
865 | for (i = 0; i < numObjs; i++) { | |
866 | // Use a new pen? | |
867 | if (i < numPens) { | |
868 | if (isFastPens) { | |
869 | obj = PySequence_Fast_GET_ITEM(pyPens, i); | |
870 | } | |
871 | else { | |
872 | obj = PySequence_GetItem(pyPens, i); | |
873 | } | |
874 | if (SWIG_GetPtrObj(obj, (void **) &pen, "_wxPen_p")) { | |
76e280e7 RD |
875 | if (!isFastPens) |
876 | Py_DECREF(obj); | |
9d37f964 RD |
877 | goto err1; |
878 | } | |
879 | ||
880 | self->SetPen(*pen); | |
881 | if (!isFastPens) | |
882 | Py_DECREF(obj); | |
883 | } | |
884 | ||
885 | // Get the point coordinants | |
886 | if (isFastSeq) { | |
887 | obj = PySequence_Fast_GET_ITEM(pyPoints, i); | |
888 | } | |
889 | else { | |
890 | obj = PySequence_GetItem(pyPoints, i); | |
891 | } | |
892 | if (! _2int_seq_helper(obj, &x1, &y1)) { | |
76e280e7 RD |
893 | if (!isFastPens) |
894 | Py_DECREF(obj); | |
9d37f964 RD |
895 | goto err0; |
896 | } | |
897 | ||
898 | // Now draw the point | |
899 | self->DrawPoint(x1, y1); | |
900 | ||
901 | if (!isFastSeq) | |
902 | Py_DECREF(obj); | |
903 | } | |
904 | ||
905 | Py_INCREF(Py_None); | |
906 | return Py_None; | |
907 | ||
908 | err1: | |
909 | PyErr_SetString(PyExc_TypeError, "Expected a sequence of wxPens"); | |
910 | return NULL; | |
911 | err0: | |
912 | PyErr_SetString(PyExc_TypeError, "Expected a sequence of (x,y) sequences."); | |
913 | return NULL; | |
914 | } | |
915 | ||
916 | ||
917 | // Draw a line for every set of coordinants in pyLines, optionally | |
918 | // setting a new pen for each | |
919 | PyObject* _DrawLineList(PyObject* pyLines, PyObject* pyPens) { | |
920 | bool isFastSeq = PyList_Check(pyLines) || PyTuple_Check(pyLines); | |
921 | bool isFastPens = PyList_Check(pyPens) || PyTuple_Check(pyPens); | |
922 | int numObjs = 0; | |
923 | int numPens = 0; | |
924 | wxPen* pen; | |
925 | PyObject* obj; | |
926 | int x1, y1, x2, y2; | |
927 | int i = 0; | |
928 | ||
929 | if (!PySequence_Check(pyLines)) { | |
930 | goto err0; | |
931 | } | |
932 | if (!PySequence_Check(pyPens)) { | |
933 | goto err1; | |
934 | } | |
935 | numObjs = PySequence_Length(pyLines); | |
936 | numPens = PySequence_Length(pyPens); | |
937 | ||
938 | for (i = 0; i < numObjs; i++) { | |
939 | // Use a new pen? | |
940 | if (i < numPens) { | |
941 | if (isFastPens) { | |
942 | obj = PySequence_Fast_GET_ITEM(pyPens, i); | |
943 | } | |
944 | else { | |
945 | obj = PySequence_GetItem(pyPens, i); | |
946 | } | |
947 | if (SWIG_GetPtrObj(obj, (void **) &pen, "_wxPen_p")) { | |
76e280e7 RD |
948 | if (!isFastPens) |
949 | Py_DECREF(obj); | |
9d37f964 RD |
950 | goto err1; |
951 | } | |
952 | ||
953 | self->SetPen(*pen); | |
954 | if (!isFastPens) | |
955 | Py_DECREF(obj); | |
956 | } | |
957 | ||
958 | // Get the line coordinants | |
959 | if (isFastSeq) { | |
960 | obj = PySequence_Fast_GET_ITEM(pyLines, i); | |
961 | } | |
962 | else { | |
963 | obj = PySequence_GetItem(pyLines, i); | |
964 | } | |
965 | if (! _4int_seq_helper(obj, &x1, &y1, &x2, &y2)) { | |
76e280e7 RD |
966 | if (!isFastPens) |
967 | Py_DECREF(obj); | |
9d37f964 RD |
968 | goto err0; |
969 | } | |
970 | ||
971 | // Now draw the line | |
972 | self->DrawLine(x1, y1, x2, y2); | |
973 | ||
974 | if (!isFastSeq) | |
975 | Py_DECREF(obj); | |
976 | } | |
977 | ||
978 | Py_INCREF(Py_None); | |
979 | return Py_None; | |
980 | ||
981 | err1: | |
982 | PyErr_SetString(PyExc_TypeError, "Expected a sequence of wxPens"); | |
983 | return NULL; | |
984 | err0: | |
985 | PyErr_SetString(PyExc_TypeError, "Expected a sequence of (x1,y1, x2,y2) sequences."); | |
986 | return NULL; | |
987 | } | |
988 | } | |
989 | ||
990 | ||
991 | %pragma(python) addtoclass = " | |
992 | def DrawPointList(self, points, pens=None): | |
993 | if pens is None: | |
994 | pens = [] | |
995 | elif isinstance(pens, wxPenPtr): | |
996 | pens = [pens] | |
997 | elif len(pens) != len(points): | |
998 | raise ValueError('points and pens must have same length') | |
999 | return self._DrawPointList(points, pens) | |
1000 | ||
1001 | def DrawLineList(self, lines, pens=None): | |
1002 | if pens is None: | |
1003 | pens = [] | |
1004 | elif isinstance(pens, wxPenPtr): | |
1005 | pens = [pens] | |
1006 | elif len(pens) != len(lines): | |
1007 | raise ValueError('lines and pens must have same length') | |
1008 | return self._DrawLineList(lines, pens) | |
1009 | " | |
1010 | ||
1011 | ||
7bf85405 RD |
1012 | }; |
1013 | ||
1014 | ||
9d37f964 RD |
1015 | |
1016 | %{ | |
1017 | static void wxDC_GetBoundingBox(wxDC* dc, int* x1, int* y1, int* x2, int* y2) { | |
1018 | *x1 = dc->MinX(); | |
1019 | *y1 = dc->MinY(); | |
1020 | *x2 = dc->MaxX(); | |
1021 | *y2 = dc->MaxY(); | |
1022 | } | |
1023 | %} | |
1024 | ||
7bf85405 RD |
1025 | //---------------------------------------------------------------------- |
1026 | ||
1027 | class wxMemoryDC : public wxDC { | |
1028 | public: | |
1029 | wxMemoryDC(); | |
1030 | ||
1031 | void SelectObject(const wxBitmap& bitmap); | |
1032 | } | |
1033 | ||
1034 | %new wxMemoryDC* wxMemoryDCFromDC(wxDC* oldDC); | |
1035 | %{ // Alternate 'constructor' | |
1036 | wxMemoryDC* wxMemoryDCFromDC(wxDC* oldDC) { | |
1037 | return new wxMemoryDC(oldDC); | |
1038 | } | |
1039 | %} | |
1040 | ||
1041 | ||
1042 | //--------------------------------------------------------------------------- | |
1043 | ||
1044 | class wxScreenDC : public wxDC { | |
1045 | public: | |
1046 | wxScreenDC(); | |
1047 | ||
26b9cf27 RD |
1048 | %name(StartDrawingOnTopWin) bool StartDrawingOnTop(wxWindow* window); |
1049 | bool StartDrawingOnTop(wxRect* rect = NULL); | |
7bf85405 RD |
1050 | bool EndDrawingOnTop(); |
1051 | }; | |
1052 | ||
1053 | //--------------------------------------------------------------------------- | |
1054 | ||
1055 | class wxClientDC : public wxDC { | |
1056 | public: | |
1057 | wxClientDC(wxWindow* win); | |
1058 | }; | |
1059 | ||
1060 | //--------------------------------------------------------------------------- | |
1061 | ||
1062 | class wxPaintDC : public wxDC { | |
1063 | public: | |
1064 | wxPaintDC(wxWindow* win); | |
1065 | }; | |
1066 | ||
1067 | //--------------------------------------------------------------------------- | |
1068 | ||
b639c3c5 RD |
1069 | class wxWindowDC : public wxDC { |
1070 | public: | |
1071 | wxWindowDC(wxWindow* win); | |
1072 | }; | |
b639c3c5 RD |
1073 | |
1074 | //--------------------------------------------------------------------------- | |
1075 | ||
7bf85405 | 1076 | |
fb5e0af0 | 1077 | #ifdef __WXMSW__ |
17c0e08c RD |
1078 | |
1079 | %{ | |
1080 | #include <wx/metafile.h> | |
1081 | %} | |
1082 | ||
1083 | class wxMetaFile : public wxObject { | |
1084 | public: | |
1085 | wxMetaFile(const wxString& filename = wxPyEmptyStr); | |
1086 | ~wxMetaFile(); | |
1087 | ||
1088 | bool Ok(); | |
1089 | bool SetClipboard(int width = 0, int height = 0); | |
1090 | ||
1091 | wxSize GetSize(); | |
1092 | int GetWidth(); | |
1093 | int GetHeight(); | |
1094 | ||
1095 | const wxString& GetFileName() const { return m_filename; } | |
1096 | ||
1097 | }; | |
1098 | ||
1099 | // bool wxMakeMetaFilePlaceable(const wxString& filename, | |
1100 | // int minX, int minY, int maxX, int maxY, float scale=1.0); | |
1101 | ||
1102 | ||
7bf85405 RD |
1103 | class wxMetaFileDC : public wxDC { |
1104 | public: | |
17c0e08c RD |
1105 | wxMetaFileDC(const wxString& filename = wxPyEmptyStr, |
1106 | int width = 0, int height = 0, | |
1107 | const wxString& description = wxPyEmptyStr); | |
7bf85405 RD |
1108 | wxMetaFile* Close(); |
1109 | }; | |
17c0e08c | 1110 | |
fb5e0af0 | 1111 | #endif |
7bf85405 RD |
1112 | |
1113 | //--------------------------------------------------------------------------- | |
1114 | //--------------------------------------------------------------------------- | |
1115 | ||
1116 | ||
1117 | %readonly | |
af309447 RD |
1118 | %{ |
1119 | #if 0 | |
1120 | %} | |
7bf85405 RD |
1121 | extern wxFont *wxNORMAL_FONT; |
1122 | extern wxFont *wxSMALL_FONT; | |
1123 | extern wxFont *wxITALIC_FONT; | |
1124 | extern wxFont *wxSWISS_FONT; | |
7bf85405 | 1125 | |
1afc06c2 | 1126 | extern wxPen *wxRED_PEN; |
7bf85405 RD |
1127 | extern wxPen *wxCYAN_PEN; |
1128 | extern wxPen *wxGREEN_PEN; | |
1129 | extern wxPen *wxBLACK_PEN; | |
1130 | extern wxPen *wxWHITE_PEN; | |
1131 | extern wxPen *wxTRANSPARENT_PEN; | |
1132 | extern wxPen *wxBLACK_DASHED_PEN; | |
1133 | extern wxPen *wxGREY_PEN; | |
1134 | extern wxPen *wxMEDIUM_GREY_PEN; | |
1135 | extern wxPen *wxLIGHT_GREY_PEN; | |
1136 | ||
1137 | extern wxBrush *wxBLUE_BRUSH; | |
1138 | extern wxBrush *wxGREEN_BRUSH; | |
1139 | extern wxBrush *wxWHITE_BRUSH; | |
1140 | extern wxBrush *wxBLACK_BRUSH; | |
1141 | extern wxBrush *wxTRANSPARENT_BRUSH; | |
1142 | extern wxBrush *wxCYAN_BRUSH; | |
1143 | extern wxBrush *wxRED_BRUSH; | |
1144 | extern wxBrush *wxGREY_BRUSH; | |
1145 | extern wxBrush *wxMEDIUM_GREY_BRUSH; | |
1146 | extern wxBrush *wxLIGHT_GREY_BRUSH; | |
1147 | ||
1148 | extern wxColour *wxBLACK; | |
1149 | extern wxColour *wxWHITE; | |
1150 | extern wxColour *wxRED; | |
1151 | extern wxColour *wxBLUE; | |
1152 | extern wxColour *wxGREEN; | |
1153 | extern wxColour *wxCYAN; | |
1154 | extern wxColour *wxLIGHT_GREY; | |
1155 | ||
1156 | extern wxCursor *wxSTANDARD_CURSOR; | |
1157 | extern wxCursor *wxHOURGLASS_CURSOR; | |
1158 | extern wxCursor *wxCROSS_CURSOR; | |
1159 | ||
1160 | extern wxBitmap wxNullBitmap; | |
1161 | extern wxIcon wxNullIcon; | |
1162 | extern wxCursor wxNullCursor; | |
1163 | extern wxPen wxNullPen; | |
1164 | extern wxBrush wxNullBrush; | |
1165 | extern wxPalette wxNullPalette; | |
1166 | extern wxFont wxNullFont; | |
1167 | extern wxColour wxNullColour; | |
1168 | ||
0569df0f RD |
1169 | |
1170 | extern wxFontList* wxTheFontList; | |
1171 | extern wxPenList* wxThePenList; | |
6ee2116b | 1172 | extern wxBrushList* wxTheBrushList; |
0569df0f RD |
1173 | extern wxColourDatabase* wxTheColourDatabase; |
1174 | ||
1175 | ||
af309447 RD |
1176 | %readwrite |
1177 | %{ | |
1178 | #endif | |
1179 | %} | |
1180 | ||
b639c3c5 RD |
1181 | //--------------------------------------------------------------------------- |
1182 | ||
9416aa89 | 1183 | class wxPalette : public wxGDIObject { |
b639c3c5 | 1184 | public: |
eec92d76 | 1185 | wxPalette(int LCOUNT, byte* choices, byte* choices, byte* choices); |
b639c3c5 RD |
1186 | ~wxPalette(); |
1187 | ||
1188 | int GetPixel(byte red, byte green, byte blue); | |
1189 | bool GetRGB(int pixel, byte* OUTPUT, byte* OUTPUT, byte* OUTPUT); | |
1190 | bool Ok(); | |
1191 | }; | |
1192 | ||
1193 | //--------------------------------------------------------------------------- | |
1194 | ||
af309447 RD |
1195 | enum { |
1196 | wxIMAGELIST_DRAW_NORMAL , | |
1197 | wxIMAGELIST_DRAW_TRANSPARENT, | |
1198 | wxIMAGELIST_DRAW_SELECTED, | |
1199 | wxIMAGELIST_DRAW_FOCUSED, | |
1200 | wxIMAGE_LIST_NORMAL, | |
1201 | wxIMAGE_LIST_SMALL, | |
1202 | wxIMAGE_LIST_STATE | |
1203 | }; | |
1204 | ||
9416aa89 | 1205 | class wxImageList : public wxObject { |
af309447 | 1206 | public: |
dcd38683 | 1207 | wxImageList(int width, int height, int mask=TRUE, int initialCount=1); |
af309447 RD |
1208 | ~wxImageList(); |
1209 | ||
1210 | int Add(const wxBitmap& bitmap, const wxBitmap& mask = wxNullBitmap); | |
1211 | %name(AddWithColourMask)int Add(const wxBitmap& bitmap, const wxColour& maskColour); | |
1212 | %name(AddIcon)int Add(const wxIcon& icon); | |
f6bcfd97 | 1213 | #ifdef __WXMSW__ |
b57bdb5a | 1214 | bool Replace(int index, const wxBitmap& bitmap, const wxBitmap& mask = wxNullBitmap); |
b57bdb5a | 1215 | #else |
f6bcfd97 BP |
1216 | // %name(ReplaceIcon)bool Replace(int index, const wxIcon& icon); |
1217 | // int Add(const wxBitmap& bitmap); | |
b57bdb5a RD |
1218 | bool Replace(int index, const wxBitmap& bitmap); |
1219 | #endif | |
af309447 RD |
1220 | |
1221 | bool Draw(int index, wxDC& dc, int x, int x, int flags = wxIMAGELIST_DRAW_NORMAL, | |
1222 | const bool solidBackground = FALSE); | |
1223 | ||
1224 | int GetImageCount(); | |
1225 | bool Remove(int index); | |
1226 | bool RemoveAll(); | |
f6bcfd97 | 1227 | void GetSize(int index, int& OUTPUT, int& OUTPUT); |
af309447 RD |
1228 | }; |
1229 | ||
b639c3c5 | 1230 | |
9416aa89 RD |
1231 | //--------------------------------------------------------------------------- |
1232 | // Regions, etc. | |
1233 | ||
1234 | enum wxRegionContain { | |
1235 | wxOutRegion, wxPartRegion, wxInRegion | |
1236 | }; | |
1237 | ||
1238 | ||
1239 | class wxRegion : public wxGDIObject { | |
1240 | public: | |
1241 | wxRegion(long x=0, long y=0, long width=0, long height=0); | |
1242 | ~wxRegion(); | |
1243 | ||
1244 | void Clear(); | |
1245 | wxRegionContain Contains(long x, long y); | |
1246 | %name(ContainsPoint)wxRegionContain Contains(const wxPoint& pt); | |
1247 | %name(ContainsRect)wxRegionContain Contains(const wxRect& rect); | |
1248 | %name(ContainsRectDim)wxRegionContain Contains(long x, long y, long w, long h); | |
1249 | ||
1250 | wxRect GetBox(); | |
1251 | ||
1252 | bool Intersect(long x, long y, long width, long height); | |
1253 | %name(IntersectRect)bool Intersect(const wxRect& rect); | |
1254 | %name(IntersectRegion)bool Intersect(const wxRegion& region); | |
1255 | ||
1256 | bool IsEmpty(); | |
1257 | ||
1258 | bool Union(long x, long y, long width, long height); | |
1259 | %name(UnionRect)bool Union(const wxRect& rect); | |
1260 | %name(UnionRegion)bool Union(const wxRegion& region); | |
1261 | ||
1262 | bool Subtract(long x, long y, long width, long height); | |
1263 | %name(SubtractRect)bool Subtract(const wxRect& rect); | |
1264 | %name(SubtractRegion)bool Subtract(const wxRegion& region); | |
1265 | ||
1266 | bool Xor(long x, long y, long width, long height); | |
1267 | %name(XorRect)bool Xor(const wxRect& rect); | |
1268 | %name(XorRegion)bool Xor(const wxRegion& region); | |
1269 | }; | |
1270 | ||
1271 | ||
1272 | ||
1273 | class wxRegionIterator : public wxObject { | |
1274 | public: | |
1275 | wxRegionIterator(const wxRegion& region); | |
1276 | ~wxRegionIterator(); | |
1277 | ||
1278 | long GetX(); | |
1279 | long GetY(); | |
1280 | long GetW(); | |
1281 | long GetWidth(); | |
1282 | long GetH(); | |
1283 | long GetHeight(); | |
1284 | wxRect GetRect(); | |
1285 | bool HaveRects(); | |
1286 | void Reset(); | |
1287 | ||
1288 | %addmethods { | |
1289 | void Next() { | |
1290 | (*self) ++; | |
1291 | } | |
1292 | }; | |
1293 | }; | |
1294 | ||
1295 | ||
7bf85405 RD |
1296 | //--------------------------------------------------------------------------- |
1297 |