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