]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/gdi.i
Fixed compilation error
[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"
7bf85405 18#include <wx/metafile.h>
af309447 19#include <wx/imaglist.h>
105e45b9 20#ifndef __WXMSW__
08127323 21#include <wx/dcps.h>
105e45b9 22#endif
6d8b4f8d
RD
23#include <wx/fontmap.h>
24#include <wx/fontenc.h>
25#include <wx/fontmap.h>
26#include <wx/fontutil.h>
7bf85405
RD
27%}
28
29//----------------------------------------------------------------------
30
31%include typemaps.i
32%include my_typemaps.i
33
34// Import some definitions of other classes, etc.
35%import _defs.i
36%import misc.i
37
b68dc582
RD
38%{
39 static wxString wxPyEmptyStr("");
40%}
41
7bf85405
RD
42//---------------------------------------------------------------------------
43
9416aa89
RD
44class wxGDIObject : public wxObject {
45public:
46 wxGDIObject();
47 ~wxGDIObject();
48
49 bool GetVisible();
50 void SetVisible( bool visible );
51
52 bool IsNull();
53
54};
6999b0d8
RD
55
56//---------------------------------------------------------------------------
57
9416aa89 58class wxBitmap : public wxGDIObject
5bff6bb8 59{
7bf85405 60public:
0a651eb8 61 wxBitmap(const wxString& name, wxBitmapType type);
7bf85405
RD
62 ~wxBitmap();
63
7bf85405
RD
64 wxPalette* GetPalette();
65 wxMask* GetMask();
7bf85405 66 bool LoadFile(const wxString& name, long flags);
7bf85405 67 bool SaveFile(const wxString& name, int type, wxPalette* palette = NULL);
7bf85405 68 void SetMask(wxMask* mask);
fb5e0af0 69#ifdef __WXMSW__
b8b8dda7 70 void SetPalette(wxPalette& palette);
fb5e0af0 71#endif
5bff6bb8
RD
72
73 // wxGDIImage methods
74#ifdef __WXMSW__
75 long GetHandle();
76 void SetHandle(long handle);
77#endif
78 bool Ok();
79 int GetWidth();
80 int GetHeight();
81 int GetDepth();
82 void SetWidth(int w);
83 void SetHeight(int h);
84 void SetDepth(int d);
85#ifdef __WXMSW__
86 void SetSize(const wxSize& size);
87#endif
f6bcfd97
BP
88
89 wxBitmap GetSubBitmap( const wxRect& rect );
90#ifdef __WXMSW__
91 bool CopyFromIcon(const wxIcon& icon);
92 bool CopyFromCursor(const wxCursor& cursor);
93 int GetQuality();
94 void SetQuality(int q);
95#endif
96
97 %pragma(python) addtoclass = "
98 def __del__(self,gdic=gdic):
99 try:
100 if self.thisown == 1 :
101 gdic.delete_wxBitmap(self)
102 except:
103 pass
104"
7bf85405
RD
105};
106
5bff6bb8 107
96bfd053 108// Declarations of some alternate "constructors"
7bf85405 109%new wxBitmap* wxEmptyBitmap(int width, int height, int depth=-1);
96bfd053
RD
110%new wxBitmap* wxBitmapFromXPMData(PyObject* listOfStrings);
111%new wxBitmap* wxBitmapFromIcon(const wxIcon& icon);
d56cebe7 112%new wxBitmap* wxBitmapFromBits(char* bits, int width, int height, int depth = 1 );
9c039d08 113
d56cebe7
RD
114// #ifdef __WXMSW__
115// %new wxBitmap* wxBitmapFromData(PyObject* data, long type,
116// int width, int height, int depth = 1);
117// #endif
8bf5d46e 118
96bfd053
RD
119
120
121%{ // Implementations of some alternate "constructors"
122
7bf85405
RD
123 wxBitmap* wxEmptyBitmap(int width, int height, int depth=-1) {
124 return new wxBitmap(width, height, depth);
125 }
126
96bfd053
RD
127 static char** ConvertListOfStrings(PyObject* listOfStrings) {
128 char** cArray = NULL;
129 int count;
130
131 if (!PyList_Check(listOfStrings)) {
132 PyErr_SetString(PyExc_TypeError, "Expected a list of strings.");
133 return NULL;
134 }
135 count = PyList_Size(listOfStrings);
136 cArray = new char*[count];
137
138 for(int x=0; x<count; x++) {
139 // TODO: Need some validation and error checking here
140 cArray[x] = PyString_AsString(PyList_GET_ITEM(listOfStrings, x));
141 }
142 return cArray;
143 }
144
d56cebe7 145
96bfd053
RD
146 wxBitmap* wxBitmapFromXPMData(PyObject* listOfStrings) {
147 char** cArray = NULL;
148 wxBitmap* bmp;
149
150 cArray = ConvertListOfStrings(listOfStrings);
151 if (! cArray)
152 return NULL;
153 bmp = new wxBitmap(cArray);
154 delete [] cArray;
155 return bmp;
156 }
157
158
159 wxBitmap* wxBitmapFromIcon(const wxIcon& icon) {
160 return new wxBitmap(icon);
161 }
162
163
d56cebe7
RD
164 wxBitmap* wxBitmapFromBits(char* bits, int width, int height, int depth = 1 ) {
165 return new wxBitmap(bits, width, height, depth);
166 }
926bb76c 167
4c9993c3 168
d56cebe7
RD
169// #ifdef __WXMSW__
170// wxBitmap* wxBitmapFromData(PyObject* data, long type,
171// int width, int height, int depth = 1) {
172// if (! PyString_Check(data)) {
173// PyErr_SetString(PyExc_TypeError, "Expected string object");
174// return NULL;
175// }
176// return new wxBitmap((void*)PyString_AsString(data), type, width, height, depth);
177// }
178// #endif
7bf85405
RD
179%}
180
181//---------------------------------------------------------------------------
182
9416aa89 183class wxMask : public wxObject {
7bf85405
RD
184public:
185 wxMask(const wxBitmap& bitmap);
eb715945 186 //~wxMask();
96bfd053
RD
187
188 %addmethods { void Destroy() { delete self; } }
7bf85405
RD
189};
190
191%new wxMask* wxMaskColour(const wxBitmap& bitmap, const wxColour& colour);
192%{
193 wxMask* wxMaskColour(const wxBitmap& bitmap, const wxColour& colour) {
194 return new wxMask(bitmap, colour);
195 }
196%}
197
198
199//---------------------------------------------------------------------------
200
201
9416aa89 202class wxIcon : public wxGDIObject
5bff6bb8 203{
7bf85405 204public:
fb5e0af0
RD
205 wxIcon(const wxString& name, long flags,
206 int desiredWidth = -1, int desiredHeight = -1);
7bf85405
RD
207 ~wxIcon();
208
7bf85405 209 bool LoadFile(const wxString& name, long flags);
5bff6bb8
RD
210
211 // wxGDIImage methods
212#ifdef __WXMSW__
213 long GetHandle();
214 void SetHandle(long handle);
215#endif
216 bool Ok();
217 int GetWidth();
218 int GetHeight();
219 int GetDepth();
220 void SetWidth(int w);
221 void SetHeight(int h);
222 void SetDepth(int d);
223#ifdef __WXMSW__
224 void SetSize(const wxSize& size);
225#endif
96bfd053
RD
226 void CopyFromBitmap(const wxBitmap& bmp);
227
f6bcfd97
BP
228 %pragma(python) addtoclass = "
229 def __del__(self,gdic=gdic):
230 try:
231 if self.thisown == 1 :
232 gdic.delete_wxIcon(self)
233 except:
234 pass
235"
7bf85405
RD
236};
237
8bf5d46e 238
96bfd053
RD
239// Declarations of some alternate "constructors"
240%new wxIcon* wxEmptyIcon();
241%new wxIcon* wxIconFromXPMData(PyObject* listOfStrings);
242
243%{ // Implementations of some alternate "constructors"
244 wxIcon* wxEmptyIcon() {
245 return new wxIcon();
246 }
247
248 wxIcon* wxIconFromXPMData(PyObject* listOfStrings) {
249 char** cArray = NULL;
250 wxIcon* icon;
251
252 cArray = ConvertListOfStrings(listOfStrings);
253 if (! cArray)
254 return NULL;
255 icon = new wxIcon(cArray);
256 delete [] cArray;
257 return icon;
258 }
259%}
260
7bf85405
RD
261//---------------------------------------------------------------------------
262
9416aa89 263class wxCursor : public wxGDIObject
5bff6bb8 264{
7bf85405 265public:
fb5e0af0 266#ifdef __WXMSW__
7bf85405 267 wxCursor(const wxString& cursorName, long flags, int hotSpotX=0, int hotSpotY=0);
fb5e0af0 268#endif
7bf85405 269 ~wxCursor();
5bff6bb8
RD
270
271 // wxGDIImage methods
272#ifdef __WXMSW__
273 long GetHandle();
274 void SetHandle(long handle);
275#endif
276 bool Ok();
277#ifdef __WXMSW__
278 int GetWidth();
279 int GetHeight();
280 int GetDepth();
281 void SetWidth(int w);
282 void SetHeight(int h);
283 void SetDepth(int d);
284 void SetSize(const wxSize& size);
285#endif
7bf85405
RD
286};
287
9c039d08 288%name(wxStockCursor) %new wxCursor* wxPyStockCursor(int id);
7bf85405 289%{ // Alternate 'constructor'
9c039d08 290 wxCursor* wxPyStockCursor(int id) {
7bf85405
RD
291 return new wxCursor(id);
292 }
293%}
294
295//----------------------------------------------------------------------
296
f0261a72 297
6d8b4f8d
RD
298enum wxFontFamily
299{
300 wxFONTFAMILY_DEFAULT = wxDEFAULT,
301 wxFONTFAMILY_DECORATIVE = wxDECORATIVE,
302 wxFONTFAMILY_ROMAN = wxROMAN,
303 wxFONTFAMILY_SCRIPT = wxSCRIPT,
304 wxFONTFAMILY_SWISS = wxSWISS,
305 wxFONTFAMILY_MODERN = wxMODERN,
306 wxFONTFAMILY_TELETYPE = wxTELETYPE,
307 wxFONTFAMILY_MAX
308};
309
310// font styles
311enum wxFontStyle
312{
313 wxFONTSTYLE_NORMAL = wxNORMAL,
314 wxFONTSTYLE_ITALIC = wxITALIC,
315 wxFONTSTYLE_SLANT = wxSLANT,
316 wxFONTSTYLE_MAX
317};
318
319// font weights
320enum wxFontWeight
321{
322 wxFONTWEIGHT_NORMAL = wxNORMAL,
323 wxFONTWEIGHT_LIGHT = wxLIGHT,
324 wxFONTWEIGHT_BOLD = wxBOLD,
325 wxFONTWEIGHT_MAX
326};
327
328
329// font encodings
f0261a72
RD
330enum wxFontEncoding
331{
332 wxFONTENCODING_SYSTEM = -1, // system default
333 wxFONTENCODING_DEFAULT, // current default encoding
334
335 // ISO8859 standard defines a number of single-byte charsets
336 wxFONTENCODING_ISO8859_1, // West European (Latin1)
337 wxFONTENCODING_ISO8859_2, // Central and East European (Latin2)
338 wxFONTENCODING_ISO8859_3, // Esperanto (Latin3)
6d8b4f8d 339 wxFONTENCODING_ISO8859_4, // Baltic (old) (Latin4)
f0261a72
RD
340 wxFONTENCODING_ISO8859_5, // Cyrillic
341 wxFONTENCODING_ISO8859_6, // Arabic
342 wxFONTENCODING_ISO8859_7, // Greek
343 wxFONTENCODING_ISO8859_8, // Hebrew
344 wxFONTENCODING_ISO8859_9, // Turkish (Latin5)
345 wxFONTENCODING_ISO8859_10, // Variation of Latin4 (Latin6)
346 wxFONTENCODING_ISO8859_11, // Thai
347 wxFONTENCODING_ISO8859_12, // doesn't exist currently, but put it
348 // here anyhow to make all ISO8859
349 // consecutive numbers
6d8b4f8d 350 wxFONTENCODING_ISO8859_13, // Baltic (Latin7)
f0261a72
RD
351 wxFONTENCODING_ISO8859_14, // Latin8
352 wxFONTENCODING_ISO8859_15, // Latin9 (a.k.a. Latin0, includes euro)
6d8b4f8d 353 wxFONTENCODING_ISO8859_MAX,
f0261a72
RD
354
355 // Cyrillic charset soup (see http://czyborra.com/charsets/cyrillic.html)
356 wxFONTENCODING_KOI8, // we don't support any of KOI8 variants
357 wxFONTENCODING_ALTERNATIVE, // same as MS-DOS CP866
358 wxFONTENCODING_BULGARIAN, // used under Linux in Bulgaria
359
360 // what would we do without Microsoft? They have their own encodings
361 // for DOS
362 wxFONTENCODING_CP437, // original MS-DOS codepage
363 wxFONTENCODING_CP850, // CP437 merged with Latin1
364 wxFONTENCODING_CP852, // CP437 merged with Latin2
365 wxFONTENCODING_CP855, // another cyrillic encoding
366 wxFONTENCODING_CP866, // and another one
367 // and for Windows
6d8b4f8d 368 wxFONTENCODING_CP874, // WinThai
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())
395struct 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.
421class wxFontMapper
422{
423public:
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 499class wxFont : public wxGDIObject {
7bf85405 500public:
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 538class wxFontList : public wxObject {
0569df0f
RD
539public:
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 551class wxColour : public wxObject {
7bf85405
RD
552public:
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 585class wxColourDatabase : public wxObject {
7bf85405 586public:
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
601
9416aa89 602class wxPen : public wxGDIObject {
0569df0f
RD
603public:
604 wxPen(wxColour& colour, int width=1, int style=wxSOLID);
605 ~wxPen();
7bf85405
RD
606
607 int GetCap();
25832b3f 608 wxColour GetColour();
7bf85405 609
fb5e0af0 610 int GetJoin();
7bf85405
RD
611 int GetStyle();
612 int GetWidth();
613 bool Ok();
614 void SetCap(int cap_style);
615 void SetColour(wxColour& colour);
aeeb6a44
RR
616 void SetJoin(int join_style);
617 void SetStyle(int style);
618 void SetWidth(int width);
08127323 619
aeeb6a44
RR
620 // **** This one needs to return a list of ints (wxDash)
621 int GetDashes(wxDash **dashes);
eec92d76 622 void SetDashes(int LCOUNT, wxDash* choices);
6999b0d8
RD
623
624#ifdef __WXMSW__
625 wxBitmap* GetStipple();
b8b8dda7 626 void SetStipple(wxBitmap& stipple);
fb5e0af0 627#endif
7bf85405
RD
628};
629
0569df0f 630
9416aa89 631class wxPenList : public wxObject {
0569df0f
RD
632public:
633
634 void AddPen(wxPen* pen);
635 wxPen* FindOrCreatePen(const wxColour& colour, int width, int style);
636 void RemovePen(wxPen* pen);
637};
638
639
640
7bf85405
RD
641//----------------------------------------------------------------------
642
9416aa89 643class wxBrush : public wxGDIObject {
7bf85405 644public:
0569df0f
RD
645 wxBrush(const wxColour& colour, int style=wxSOLID);
646 ~wxBrush();
26b9cf27 647
25832b3f 648 wxColour GetColour();
7bf85405
RD
649 wxBitmap * GetStipple();
650 int GetStyle();
651 bool Ok();
652 void SetColour(wxColour &colour);
b8b8dda7 653 void SetStipple(wxBitmap& bitmap);
7bf85405
RD
654 void SetStyle(int style);
655};
656
0569df0f 657
6ee2116b 658class wxBrushList : public wxObject {
0569df0f
RD
659public:
660
661 void AddBrush(wxBrush *brush);
662 wxBrush * FindOrCreateBrush(const wxColour& colour, int style);
663 void RemoveBrush(wxBrush *brush);
664};
665
7bf85405
RD
666//----------------------------------------------------------------------
667
668
669
9416aa89 670class wxDC : public wxObject {
7bf85405 671public:
fb5e0af0 672// wxDC(); **** abstract base class, can't instantiate.
7bf85405
RD
673 ~wxDC();
674
675 void BeginDrawing();
efc5f224
RD
676// %name(BlitXY)
677 bool Blit(long xdest, long ydest,
678 long width, long height,
679 wxDC *source, long xsrc, long ysrc,
680 int logicalFunc = wxCOPY, int useMask = FALSE);
681// bool Blit(const wxPoint& destPt, const wxSize& sz,
682// wxDC *source, const wxPoint& srcPt,
683// int logicalFunc = wxCOPY, int useMask = FALSE);
684
7bf85405
RD
685 void Clear();
686 void CrossHair(long x, long y);
687 void DestroyClippingRegion();
688 long DeviceToLogicalX(long x);
689 long DeviceToLogicalXRel(long x);
690 long DeviceToLogicalY(long y);
691 long DeviceToLogicalYRel(long y);
692 void DrawArc(long x1, long y1, long x2, long y2, long xc, long yc);
bb0054cd 693 void DrawCircle(long x, long y, long radius);
7bf85405
RD
694 void DrawEllipse(long x, long y, long width, long height);
695 void DrawEllipticArc(long x, long y, long width, long height, long start, long end);
696 void DrawIcon(const wxIcon& icon, long x, long y);
697 void DrawLine(long x1, long y1, long x2, long y2);
eec92d76
RD
698 void DrawLines(int PCOUNT, wxPoint* points, long xoffset=0, long yoffset=0);
699 void DrawPolygon(int PCOUNT, wxPoint* points, long xoffset=0, long yoffset=0,
7bf85405
RD
700 int fill_style=wxODDEVEN_RULE);
701 void DrawPoint(long x, long y);
702 void DrawRectangle(long x, long y, long width, long height);
6999b0d8 703 void DrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle);
7bf85405 704 void DrawRoundedRectangle(long x, long y, long width, long height, long radius=20);
eec92d76 705 void DrawSpline(int PCOUNT, wxPoint* points);
7bf85405
RD
706 void DrawText(const wxString& text, long x, long y);
707 void EndDoc();
708 void EndDrawing();
709 void EndPage();
710 void FloodFill(long x, long y, const wxColour& colour, int style=wxFLOOD_SURFACE);
b8b8dda7
RD
711 wxBrush& GetBackground();
712 wxBrush& GetBrush();
7bf85405
RD
713 long GetCharHeight();
714 long GetCharWidth();
715 void GetClippingBox(long *OUTPUT, long *OUTPUT,
716 long *OUTPUT, long *OUTPUT);
b8b8dda7 717 wxFont& GetFont();
7bf85405 718 int GetLogicalFunction();
eec92d76 719 void GetLogicalScale(double *OUTPUT, double *OUTPUT);
7bf85405
RD
720 int GetMapMode();
721 bool GetOptimization();
b8b8dda7 722 wxPen& GetPen();
fb5e0af0
RD
723 %addmethods {
724 %new wxColour* GetPixel(long x, long y) {
725 wxColour* wc = new wxColour();
726 self->GetPixel(x, y, wc);
727 return wc;
728 }
729 }
bb0054cd
RD
730 %name(GetSizeTuple)void GetSize(int* OUTPUT, int* OUTPUT);
731 wxSize GetSize();
eec92d76 732 wxSize GetSizeMM();
25832b3f 733 wxColour GetTextBackground();
af309447
RD
734 void GetTextExtent(const wxString& string, long *OUTPUT, long *OUTPUT);
735 %name(GetFullTextExtent)void GetTextExtent(const wxString& string,
736 long *OUTPUT, long *OUTPUT, long *OUTPUT, long* OUTPUT,
737 const wxFont* font = NULL);
25832b3f 738 wxColour GetTextForeground();
eec92d76 739 void GetUserScale(double *OUTPUT, double *OUTPUT);
7bf85405
RD
740 long LogicalToDeviceX(long x);
741 long LogicalToDeviceXRel(long x);
742 long LogicalToDeviceY(long y);
743 long LogicalToDeviceYRel(long y);
744 long MaxX();
745 long MaxY();
746 long MinX();
747 long MinY();
748 bool Ok();
749 void SetDeviceOrigin(long x, long y);
750 void SetBackground(const wxBrush& brush);
751 void SetBackgroundMode(int mode);
752 void SetClippingRegion(long x, long y, long width, long height);
19a97bd6 753 %name(SetClippingRegionAsRegion) void SetClippingRegion(const wxRegion& region);
7bf85405
RD
754 void SetPalette(const wxPalette& colourMap);
755 void SetBrush(const wxBrush& brush);
756 void SetFont(const wxFont& font);
757 void SetLogicalFunction(int function);
eec92d76 758 void SetLogicalScale(double x, double y);
7bf85405
RD
759 void SetMapMode(int mode);
760 void SetOptimization(bool optimize);
761 void SetPen(const wxPen& pen);
762 void SetTextBackground(const wxColour& colour);
763 void SetTextForeground(const wxColour& colour);
764 void SetUserScale(double x_scale, double y_scale);
765 bool StartDoc(const wxString& message);
766 void StartPage();
767
768
efc5f224
RD
769
770 void DrawBitmap(const wxBitmap& bitmap, long x, long y,
771 int useMask = FALSE);
772
eec92d76
RD
773 bool CanDrawBitmap();
774 bool CanGetTextExtent();
775 int GetDepth();
776 wxSize GetPPI();
777
778 void GetLogicalOrigin(int *OUTPUT, int *OUTPUT);
779 void SetLogicalOrigin(int x, int y);
780 void GetDeviceOrigin(int *OUTPUT, int *OUTPUT);
eec92d76
RD
781 void SetAxisOrientation(bool xLeftRight, bool yBottomUp);
782
f6bcfd97
BP
783 void CalcBoundingBox(int x, int y);
784 void ResetBoundingBox();
c7e7022c
RD
785
786#ifdef __WXMSW__
787 long GetHDC();
788#endif
7bf85405
RD
789};
790
791
792//----------------------------------------------------------------------
793
794class wxMemoryDC : public wxDC {
795public:
796 wxMemoryDC();
797
798 void SelectObject(const wxBitmap& bitmap);
799}
800
801%new wxMemoryDC* wxMemoryDCFromDC(wxDC* oldDC);
802%{ // Alternate 'constructor'
803 wxMemoryDC* wxMemoryDCFromDC(wxDC* oldDC) {
804 return new wxMemoryDC(oldDC);
805 }
806%}
807
808
809//---------------------------------------------------------------------------
810
811class wxScreenDC : public wxDC {
812public:
813 wxScreenDC();
814
26b9cf27
RD
815 %name(StartDrawingOnTopWin) bool StartDrawingOnTop(wxWindow* window);
816 bool StartDrawingOnTop(wxRect* rect = NULL);
7bf85405
RD
817 bool EndDrawingOnTop();
818};
819
820//---------------------------------------------------------------------------
821
822class wxClientDC : public wxDC {
823public:
824 wxClientDC(wxWindow* win);
825};
826
827//---------------------------------------------------------------------------
828
829class wxPaintDC : public wxDC {
830public:
831 wxPaintDC(wxWindow* win);
832};
833
834//---------------------------------------------------------------------------
835
b639c3c5
RD
836class wxWindowDC : public wxDC {
837public:
838 wxWindowDC(wxWindow* win);
839};
b639c3c5
RD
840
841//---------------------------------------------------------------------------
842
be4d9c1f 843#ifndef __WXMSW__
7bf85405
RD
844class wxPostScriptDC : public wxDC {
845public:
846 wxPostScriptDC(const wxString& output, bool interactive = TRUE, wxWindow* win = NULL);
847};
be4d9c1f 848#endif
7bf85405
RD
849
850//---------------------------------------------------------------------------
851
7bf85405 852
fb5e0af0 853#ifdef __WXMSW__
7bf85405
RD
854class wxMetaFileDC : public wxDC {
855public:
856 wxMetaFileDC(const wxString& filename = wxPyEmptyStr);
857 wxMetaFile* Close();
858};
fb5e0af0 859#endif
7bf85405
RD
860
861//---------------------------------------------------------------------------
862//---------------------------------------------------------------------------
863
864
865%readonly
af309447
RD
866%{
867#if 0
868%}
7bf85405
RD
869extern wxFont *wxNORMAL_FONT;
870extern wxFont *wxSMALL_FONT;
871extern wxFont *wxITALIC_FONT;
872extern wxFont *wxSWISS_FONT;
7bf85405 873
1afc06c2 874extern wxPen *wxRED_PEN;
7bf85405
RD
875extern wxPen *wxCYAN_PEN;
876extern wxPen *wxGREEN_PEN;
877extern wxPen *wxBLACK_PEN;
878extern wxPen *wxWHITE_PEN;
879extern wxPen *wxTRANSPARENT_PEN;
880extern wxPen *wxBLACK_DASHED_PEN;
881extern wxPen *wxGREY_PEN;
882extern wxPen *wxMEDIUM_GREY_PEN;
883extern wxPen *wxLIGHT_GREY_PEN;
884
885extern wxBrush *wxBLUE_BRUSH;
886extern wxBrush *wxGREEN_BRUSH;
887extern wxBrush *wxWHITE_BRUSH;
888extern wxBrush *wxBLACK_BRUSH;
889extern wxBrush *wxTRANSPARENT_BRUSH;
890extern wxBrush *wxCYAN_BRUSH;
891extern wxBrush *wxRED_BRUSH;
892extern wxBrush *wxGREY_BRUSH;
893extern wxBrush *wxMEDIUM_GREY_BRUSH;
894extern wxBrush *wxLIGHT_GREY_BRUSH;
895
896extern wxColour *wxBLACK;
897extern wxColour *wxWHITE;
898extern wxColour *wxRED;
899extern wxColour *wxBLUE;
900extern wxColour *wxGREEN;
901extern wxColour *wxCYAN;
902extern wxColour *wxLIGHT_GREY;
903
904extern wxCursor *wxSTANDARD_CURSOR;
905extern wxCursor *wxHOURGLASS_CURSOR;
906extern wxCursor *wxCROSS_CURSOR;
907
908extern wxBitmap wxNullBitmap;
909extern wxIcon wxNullIcon;
910extern wxCursor wxNullCursor;
911extern wxPen wxNullPen;
912extern wxBrush wxNullBrush;
913extern wxPalette wxNullPalette;
914extern wxFont wxNullFont;
915extern wxColour wxNullColour;
916
0569df0f
RD
917
918extern wxFontList* wxTheFontList;
919extern wxPenList* wxThePenList;
6ee2116b 920extern wxBrushList* wxTheBrushList;
0569df0f
RD
921extern wxColourDatabase* wxTheColourDatabase;
922
923
af309447
RD
924%readwrite
925%{
926#endif
927%}
928
b639c3c5
RD
929//---------------------------------------------------------------------------
930
9416aa89 931class wxPalette : public wxGDIObject {
b639c3c5 932public:
eec92d76 933 wxPalette(int LCOUNT, byte* choices, byte* choices, byte* choices);
b639c3c5
RD
934 ~wxPalette();
935
936 int GetPixel(byte red, byte green, byte blue);
937 bool GetRGB(int pixel, byte* OUTPUT, byte* OUTPUT, byte* OUTPUT);
938 bool Ok();
939};
940
941//---------------------------------------------------------------------------
942
af309447
RD
943enum {
944 wxIMAGELIST_DRAW_NORMAL ,
945 wxIMAGELIST_DRAW_TRANSPARENT,
946 wxIMAGELIST_DRAW_SELECTED,
947 wxIMAGELIST_DRAW_FOCUSED,
948 wxIMAGE_LIST_NORMAL,
949 wxIMAGE_LIST_SMALL,
950 wxIMAGE_LIST_STATE
951};
952
9416aa89 953class wxImageList : public wxObject {
af309447 954public:
dcd38683 955 wxImageList(int width, int height, int mask=TRUE, int initialCount=1);
af309447
RD
956 ~wxImageList();
957
958 int Add(const wxBitmap& bitmap, const wxBitmap& mask = wxNullBitmap);
959 %name(AddWithColourMask)int Add(const wxBitmap& bitmap, const wxColour& maskColour);
960 %name(AddIcon)int Add(const wxIcon& icon);
f6bcfd97 961#ifdef __WXMSW__
b57bdb5a 962 bool Replace(int index, const wxBitmap& bitmap, const wxBitmap& mask = wxNullBitmap);
b57bdb5a 963#else
f6bcfd97
BP
964// %name(ReplaceIcon)bool Replace(int index, const wxIcon& icon);
965// int Add(const wxBitmap& bitmap);
b57bdb5a
RD
966 bool Replace(int index, const wxBitmap& bitmap);
967#endif
af309447
RD
968
969 bool Draw(int index, wxDC& dc, int x, int x, int flags = wxIMAGELIST_DRAW_NORMAL,
970 const bool solidBackground = FALSE);
971
972 int GetImageCount();
973 bool Remove(int index);
974 bool RemoveAll();
f6bcfd97 975 void GetSize(int index, int& OUTPUT, int& OUTPUT);
af309447
RD
976};
977
b639c3c5 978
9416aa89
RD
979//---------------------------------------------------------------------------
980// Regions, etc.
981
982enum wxRegionContain {
983 wxOutRegion, wxPartRegion, wxInRegion
984};
985
986
987class wxRegion : public wxGDIObject {
988public:
989 wxRegion(long x=0, long y=0, long width=0, long height=0);
990 ~wxRegion();
991
992 void Clear();
993 wxRegionContain Contains(long x, long y);
994 %name(ContainsPoint)wxRegionContain Contains(const wxPoint& pt);
995 %name(ContainsRect)wxRegionContain Contains(const wxRect& rect);
996 %name(ContainsRectDim)wxRegionContain Contains(long x, long y, long w, long h);
997
998 wxRect GetBox();
999
1000 bool Intersect(long x, long y, long width, long height);
1001 %name(IntersectRect)bool Intersect(const wxRect& rect);
1002 %name(IntersectRegion)bool Intersect(const wxRegion& region);
1003
1004 bool IsEmpty();
1005
1006 bool Union(long x, long y, long width, long height);
1007 %name(UnionRect)bool Union(const wxRect& rect);
1008 %name(UnionRegion)bool Union(const wxRegion& region);
1009
1010 bool Subtract(long x, long y, long width, long height);
1011 %name(SubtractRect)bool Subtract(const wxRect& rect);
1012 %name(SubtractRegion)bool Subtract(const wxRegion& region);
1013
1014 bool Xor(long x, long y, long width, long height);
1015 %name(XorRect)bool Xor(const wxRect& rect);
1016 %name(XorRegion)bool Xor(const wxRegion& region);
1017};
1018
1019
1020
1021class wxRegionIterator : public wxObject {
1022public:
1023 wxRegionIterator(const wxRegion& region);
1024 ~wxRegionIterator();
1025
1026 long GetX();
1027 long GetY();
1028 long GetW();
1029 long GetWidth();
1030 long GetH();
1031 long GetHeight();
1032 wxRect GetRect();
1033 bool HaveRects();
1034 void Reset();
1035
1036 %addmethods {
1037 void Next() {
1038 (*self) ++;
1039 }
1040 };
1041};
1042
1043
7bf85405
RD
1044//---------------------------------------------------------------------------
1045