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