]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/gdi.i
Allowed MSW wxTrextCtrl styling to also set the background colour,
[wxWidgets.git] / wxPython / src / gdi.i
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
14 %module gdi
15
16 %{
17 #include "helpers.h"
18 #include <wx/metafile.h>
19 #include <wx/imaglist.h>
20 #ifndef __WXMSW__
21 #include <wx/dcps.h>
22 #endif
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
34 %{
35 static wxString wxPyEmptyStr("");
36 %}
37
38 //---------------------------------------------------------------------------
39
40 class wxGDIObject : public wxObject {
41 public:
42 wxGDIObject();
43 ~wxGDIObject();
44
45 bool GetVisible();
46 void SetVisible( bool visible );
47
48 bool IsNull();
49
50 };
51
52 //---------------------------------------------------------------------------
53
54 class wxBitmap : public wxGDIObject
55 {
56 public:
57 wxBitmap(const wxString& name, wxBitmapType type);
58 ~wxBitmap();
59
60 wxPalette* GetPalette();
61 wxMask* GetMask();
62 bool LoadFile(const wxString& name, long flags);
63 bool SaveFile(const wxString& name, int type, wxPalette* palette = NULL);
64 void SetMask(wxMask* mask);
65 #ifdef __WXMSW__
66 void SetPalette(wxPalette& palette);
67 #endif
68
69 // wxGDIImage methods
70 #ifdef __WXMSW__
71 long GetHandle();
72 void SetHandle(long handle);
73 #endif
74 bool Ok();
75 int GetWidth();
76 int GetHeight();
77 int GetDepth();
78 void SetWidth(int w);
79 void SetHeight(int h);
80 void SetDepth(int d);
81 #ifdef __WXMSW__
82 void SetSize(const wxSize& size);
83 #endif
84
85 wxBitmap GetSubBitmap( const wxRect& rect );
86 #ifdef __WXMSW__
87 bool CopyFromIcon(const wxIcon& icon);
88 bool CopyFromCursor(const wxCursor& cursor);
89 int GetQuality();
90 void SetQuality(int q);
91 #endif
92
93 %pragma(python) addtoclass = "
94 def __del__(self,gdic=gdic):
95 try:
96 if self.thisown == 1 :
97 gdic.delete_wxBitmap(self)
98 except:
99 pass
100 "
101 };
102
103
104 // Declarations of some alternate "constructors"
105 %new wxBitmap* wxEmptyBitmap(int width, int height, int depth=-1);
106 %new wxBitmap* wxBitmapFromXPMData(PyObject* listOfStrings);
107 %new wxBitmap* wxBitmapFromIcon(const wxIcon& icon);
108
109 #ifdef __WXMSW__
110 %new wxBitmap* wxBitmapFromData(PyObject* data, long type,
111 int width, int height, int depth = 1);
112 #endif
113
114
115
116 %{ // Implementations of some alternate "constructors"
117
118 wxBitmap* wxEmptyBitmap(int width, int height, int depth=-1) {
119 return new wxBitmap(width, height, depth);
120 }
121
122 static char** ConvertListOfStrings(PyObject* listOfStrings) {
123 char** cArray = NULL;
124 int count;
125
126 if (!PyList_Check(listOfStrings)) {
127 PyErr_SetString(PyExc_TypeError, "Expected a list of strings.");
128 return NULL;
129 }
130 count = PyList_Size(listOfStrings);
131 cArray = new char*[count];
132
133 for(int x=0; x<count; x++) {
134 // TODO: Need some validation and error checking here
135 cArray[x] = PyString_AsString(PyList_GET_ITEM(listOfStrings, x));
136 }
137 return cArray;
138 }
139
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
158
159 #ifdef __WXMSW__
160 wxBitmap* wxBitmapFromData(PyObject* data, long type,
161 int width, int height, int depth = 1) {
162 if (! PyString_Check(data)) {
163 PyErr_SetString(PyExc_TypeError, "Expected string object");
164 return NULL;
165 }
166
167 return new wxBitmap((void*)PyString_AsString(data), type, width, height, depth);
168 }
169 #endif
170 %}
171
172 //---------------------------------------------------------------------------
173
174 class wxMask : public wxObject {
175 public:
176 wxMask(const wxBitmap& bitmap);
177 //~wxMask();
178
179 %addmethods { void Destroy() { delete self; } }
180 };
181
182 %new wxMask* wxMaskColour(const wxBitmap& bitmap, const wxColour& colour);
183 %{
184 wxMask* wxMaskColour(const wxBitmap& bitmap, const wxColour& colour) {
185 return new wxMask(bitmap, colour);
186 }
187 %}
188
189
190 //---------------------------------------------------------------------------
191
192
193 class wxIcon : public wxGDIObject
194 {
195 public:
196 wxIcon(const wxString& name, long flags,
197 int desiredWidth = -1, int desiredHeight = -1);
198 ~wxIcon();
199
200 bool LoadFile(const wxString& name, long flags);
201
202 // wxGDIImage methods
203 #ifdef __WXMSW__
204 long GetHandle();
205 void SetHandle(long handle);
206 #endif
207 bool Ok();
208 int GetWidth();
209 int GetHeight();
210 int GetDepth();
211 void SetWidth(int w);
212 void SetHeight(int h);
213 void SetDepth(int d);
214 #ifdef __WXMSW__
215 void SetSize(const wxSize& size);
216 #endif
217 void CopyFromBitmap(const wxBitmap& bmp);
218
219 %pragma(python) addtoclass = "
220 def __del__(self,gdic=gdic):
221 try:
222 if self.thisown == 1 :
223 gdic.delete_wxIcon(self)
224 except:
225 pass
226 "
227 };
228
229
230 // Declarations of some alternate "constructors"
231 %new wxIcon* wxEmptyIcon();
232 %new wxIcon* wxIconFromXPMData(PyObject* listOfStrings);
233
234 %{ // Implementations of some alternate "constructors"
235 wxIcon* wxEmptyIcon() {
236 return new wxIcon();
237 }
238
239 wxIcon* wxIconFromXPMData(PyObject* listOfStrings) {
240 char** cArray = NULL;
241 wxIcon* icon;
242
243 cArray = ConvertListOfStrings(listOfStrings);
244 if (! cArray)
245 return NULL;
246 icon = new wxIcon(cArray);
247 delete [] cArray;
248 return icon;
249 }
250 %}
251
252 //---------------------------------------------------------------------------
253
254 class wxCursor : public wxGDIObject
255 {
256 public:
257 #ifdef __WXMSW__
258 wxCursor(const wxString& cursorName, long flags, int hotSpotX=0, int hotSpotY=0);
259 #endif
260 ~wxCursor();
261
262 // wxGDIImage methods
263 #ifdef __WXMSW__
264 long GetHandle();
265 void SetHandle(long handle);
266 #endif
267 bool Ok();
268 #ifdef __WXMSW__
269 int GetWidth();
270 int GetHeight();
271 int GetDepth();
272 void SetWidth(int w);
273 void SetHeight(int h);
274 void SetDepth(int d);
275 void SetSize(const wxSize& size);
276 #endif
277 };
278
279 %name(wxStockCursor) %new wxCursor* wxPyStockCursor(int id);
280 %{ // Alternate 'constructor'
281 wxCursor* wxPyStockCursor(int id) {
282 return new wxCursor(id);
283 }
284 %}
285
286 //----------------------------------------------------------------------
287
288
289 enum wxFontEncoding
290 {
291 wxFONTENCODING_SYSTEM = -1, // system default
292 wxFONTENCODING_DEFAULT, // current default encoding
293
294 // ISO8859 standard defines a number of single-byte charsets
295 wxFONTENCODING_ISO8859_1, // West European (Latin1)
296 wxFONTENCODING_ISO8859_2, // Central and East European (Latin2)
297 wxFONTENCODING_ISO8859_3, // Esperanto (Latin3)
298 wxFONTENCODING_ISO8859_4, // Baltic languages (Estonian) (Latin4)
299 wxFONTENCODING_ISO8859_5, // Cyrillic
300 wxFONTENCODING_ISO8859_6, // Arabic
301 wxFONTENCODING_ISO8859_7, // Greek
302 wxFONTENCODING_ISO8859_8, // Hebrew
303 wxFONTENCODING_ISO8859_9, // Turkish (Latin5)
304 wxFONTENCODING_ISO8859_10, // Variation of Latin4 (Latin6)
305 wxFONTENCODING_ISO8859_11, // Thai
306 wxFONTENCODING_ISO8859_12, // doesn't exist currently, but put it
307 // here anyhow to make all ISO8859
308 // consecutive numbers
309 wxFONTENCODING_ISO8859_13, // Latin7
310 wxFONTENCODING_ISO8859_14, // Latin8
311 wxFONTENCODING_ISO8859_15, // Latin9 (a.k.a. Latin0, includes euro)
312
313 // Cyrillic charset soup (see http://czyborra.com/charsets/cyrillic.html)
314 wxFONTENCODING_KOI8, // we don't support any of KOI8 variants
315 wxFONTENCODING_ALTERNATIVE, // same as MS-DOS CP866
316 wxFONTENCODING_BULGARIAN, // used under Linux in Bulgaria
317
318 // what would we do without Microsoft? They have their own encodings
319 // for DOS
320 wxFONTENCODING_CP437, // original MS-DOS codepage
321 wxFONTENCODING_CP850, // CP437 merged with Latin1
322 wxFONTENCODING_CP852, // CP437 merged with Latin2
323 wxFONTENCODING_CP855, // another cyrillic encoding
324 wxFONTENCODING_CP866, // and another one
325 // and for Windows
326 wxFONTENCODING_CP1250, // WinLatin2
327 wxFONTENCODING_CP1251, // WinCyrillic
328 wxFONTENCODING_CP1252, // WinLatin1
329
330 wxFONTENCODING_MAX
331 };
332
333
334 class wxFont : public wxGDIObject {
335 public:
336 wxFont( int pointSize, int family, int style, int weight,
337 int underline=FALSE, char* faceName = "",
338 wxFontEncoding encoding=wxFONTENCODING_DEFAULT);
339 ~wxFont();
340
341 bool Ok();
342 wxString GetFaceName();
343 int GetFamily();
344 #ifdef __WXMSW__
345 int GetFontId();
346 #endif
347 int GetPointSize();
348 int GetStyle();
349 bool GetUnderlined();
350 int GetWeight();
351 wxFontEncoding GetEncoding();
352 void SetFaceName(const wxString& faceName);
353 void SetFamily(int family);
354 void SetPointSize(int pointSize);
355 void SetStyle(int style);
356 void SetUnderlined(bool underlined);
357 void SetWeight(int weight);
358 void SetEncoding(wxFontEncoding encoding);
359 wxString GetFamilyString();
360 wxString GetStyleString();
361 wxString GetWeightString();
362 };
363
364 %inline %{
365 wxFontEncoding wxFont_GetDefaultEncoding() {
366 return wxFont::GetDefaultEncoding();
367 }
368
369 void wxFont_SetDefaultEncoding(wxFontEncoding encoding) {
370 wxFont::SetDefaultEncoding(encoding);
371 }
372 %}
373
374
375 class wxFontList : public wxObject {
376 public:
377
378 void AddFont(wxFont* font);
379 wxFont * FindOrCreateFont(int point_size, int family, int style, int weight,
380 bool underline = FALSE, const char* facename = NULL,
381 wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
382 void RemoveFont(wxFont *font);
383 };
384
385
386 //----------------------------------------------------------------------
387
388 class wxColour : public wxObject {
389 public:
390 wxColour(unsigned char red=0, unsigned char green=0, unsigned char blue=0);
391 ~wxColour();
392 unsigned char Red();
393 unsigned char Green();
394 unsigned char Blue();
395 bool Ok();
396 void Set(unsigned char red, unsigned char green, unsigned char blue);
397 %addmethods {
398 PyObject* Get() {
399 PyObject* rv = PyTuple_New(3);
400 PyTuple_SetItem(rv, 0, PyInt_FromLong(self->Red()));
401 PyTuple_SetItem(rv, 1, PyInt_FromLong(self->Green()));
402 PyTuple_SetItem(rv, 2, PyInt_FromLong(self->Blue()));
403 return rv;
404 }
405 }
406 %pragma(python) addtoclass = "asTuple = Get"
407 %pragma(python) addtoclass = "def __str__(self): return str(self.asTuple())"
408 %pragma(python) addtoclass = "def __repr__(self): return str(self.asTuple())"
409
410 };
411
412 %new wxColour* wxNamedColour(const wxString& colorName);
413
414 %{ // Alternate 'constructor'
415 wxColour* wxNamedColour(const wxString& colorName) {
416 return new wxColour(colorName);
417 }
418 %}
419
420
421
422 class wxColourDatabase : public wxObject {
423 public:
424
425 wxColour *FindColour(const wxString& colour);
426 wxString FindName(const wxColour& colour) const;
427
428 %addmethods {
429 void Append(const wxString& name, int red, int green, int blue) {
430 self->Append(name.c_str(), new wxColour(red, green, blue));
431 }
432 }
433 };
434
435
436 //----------------------------------------------------------------------
437
438
439 class wxPen : public wxGDIObject {
440 public:
441 wxPen(wxColour& colour, int width=1, int style=wxSOLID);
442 ~wxPen();
443
444 int GetCap();
445 wxColour GetColour();
446
447 int GetJoin();
448 int GetStyle();
449 int GetWidth();
450 bool Ok();
451 void SetCap(int cap_style);
452 void SetColour(wxColour& colour);
453 void SetJoin(int join_style);
454 void SetStyle(int style);
455 void SetWidth(int width);
456
457 // **** This one needs to return a list of ints (wxDash)
458 int GetDashes(wxDash **dashes);
459 void SetDashes(int LCOUNT, wxDash* choices);
460
461 #ifdef __WXMSW__
462 wxBitmap* GetStipple();
463 void SetStipple(wxBitmap& stipple);
464 #endif
465 };
466
467
468 class wxPenList : public wxObject {
469 public:
470
471 void AddPen(wxPen* pen);
472 wxPen* FindOrCreatePen(const wxColour& colour, int width, int style);
473 void RemovePen(wxPen* pen);
474 };
475
476
477
478 //----------------------------------------------------------------------
479
480 class wxBrush : public wxGDIObject {
481 public:
482 wxBrush(const wxColour& colour, int style=wxSOLID);
483 ~wxBrush();
484
485 wxColour GetColour();
486 wxBitmap * GetStipple();
487 int GetStyle();
488 bool Ok();
489 void SetColour(wxColour &colour);
490 void SetStipple(wxBitmap& bitmap);
491 void SetStyle(int style);
492 };
493
494
495 class wxBrushList {
496 public:
497
498 void AddBrush(wxBrush *brush);
499 wxBrush * FindOrCreateBrush(const wxColour& colour, int style);
500 void RemoveBrush(wxBrush *brush);
501 };
502
503 //----------------------------------------------------------------------
504
505
506
507 class wxDC : public wxObject {
508 public:
509 // wxDC(); **** abstract base class, can't instantiate.
510 ~wxDC();
511
512 void BeginDrawing();
513 // %name(BlitXY)
514 bool Blit(long xdest, long ydest,
515 long width, long height,
516 wxDC *source, long xsrc, long ysrc,
517 int logicalFunc = wxCOPY, int useMask = FALSE);
518 // bool Blit(const wxPoint& destPt, const wxSize& sz,
519 // wxDC *source, const wxPoint& srcPt,
520 // int logicalFunc = wxCOPY, int useMask = FALSE);
521
522 void Clear();
523 void CrossHair(long x, long y);
524 void DestroyClippingRegion();
525 long DeviceToLogicalX(long x);
526 long DeviceToLogicalXRel(long x);
527 long DeviceToLogicalY(long y);
528 long DeviceToLogicalYRel(long y);
529 void DrawArc(long x1, long y1, long x2, long y2, long xc, long yc);
530 void DrawCircle(long x, long y, long radius);
531 void DrawEllipse(long x, long y, long width, long height);
532 void DrawEllipticArc(long x, long y, long width, long height, long start, long end);
533 void DrawIcon(const wxIcon& icon, long x, long y);
534 void DrawLine(long x1, long y1, long x2, long y2);
535 void DrawLines(int PCOUNT, wxPoint* points, long xoffset=0, long yoffset=0);
536 void DrawPolygon(int PCOUNT, wxPoint* points, long xoffset=0, long yoffset=0,
537 int fill_style=wxODDEVEN_RULE);
538 void DrawPoint(long x, long y);
539 void DrawRectangle(long x, long y, long width, long height);
540 void DrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle);
541 void DrawRoundedRectangle(long x, long y, long width, long height, long radius=20);
542 void DrawSpline(int PCOUNT, wxPoint* points);
543 void DrawText(const wxString& text, long x, long y);
544 void EndDoc();
545 void EndDrawing();
546 void EndPage();
547 void FloodFill(long x, long y, const wxColour& colour, int style=wxFLOOD_SURFACE);
548 wxBrush& GetBackground();
549 wxBrush& GetBrush();
550 long GetCharHeight();
551 long GetCharWidth();
552 void GetClippingBox(long *OUTPUT, long *OUTPUT,
553 long *OUTPUT, long *OUTPUT);
554 wxFont& GetFont();
555 int GetLogicalFunction();
556 void GetLogicalScale(double *OUTPUT, double *OUTPUT);
557 int GetMapMode();
558 bool GetOptimization();
559 wxPen& GetPen();
560 %addmethods {
561 %new wxColour* GetPixel(long x, long y) {
562 wxColour* wc = new wxColour();
563 self->GetPixel(x, y, wc);
564 return wc;
565 }
566 }
567 %name(GetSizeTuple)void GetSize(int* OUTPUT, int* OUTPUT);
568 wxSize GetSize();
569 wxSize GetSizeMM();
570 wxColour GetTextBackground();
571 void GetTextExtent(const wxString& string, long *OUTPUT, long *OUTPUT);
572 %name(GetFullTextExtent)void GetTextExtent(const wxString& string,
573 long *OUTPUT, long *OUTPUT, long *OUTPUT, long* OUTPUT,
574 const wxFont* font = NULL);
575 wxColour GetTextForeground();
576 void GetUserScale(double *OUTPUT, double *OUTPUT);
577 long LogicalToDeviceX(long x);
578 long LogicalToDeviceXRel(long x);
579 long LogicalToDeviceY(long y);
580 long LogicalToDeviceYRel(long y);
581 long MaxX();
582 long MaxY();
583 long MinX();
584 long MinY();
585 bool Ok();
586 void SetDeviceOrigin(long x, long y);
587 void SetBackground(const wxBrush& brush);
588 void SetBackgroundMode(int mode);
589 void SetClippingRegion(long x, long y, long width, long height);
590 void SetPalette(const wxPalette& colourMap);
591 void SetBrush(const wxBrush& brush);
592 void SetFont(const wxFont& font);
593 void SetLogicalFunction(int function);
594 void SetLogicalScale(double x, double y);
595 void SetMapMode(int mode);
596 void SetOptimization(bool optimize);
597 void SetPen(const wxPen& pen);
598 void SetTextBackground(const wxColour& colour);
599 void SetTextForeground(const wxColour& colour);
600 void SetUserScale(double x_scale, double y_scale);
601 bool StartDoc(const wxString& message);
602 void StartPage();
603
604
605
606 void DrawBitmap(const wxBitmap& bitmap, long x, long y,
607 int useMask = FALSE);
608
609 bool CanDrawBitmap();
610 bool CanGetTextExtent();
611 int GetDepth();
612 wxSize GetPPI();
613
614 void GetLogicalOrigin(int *OUTPUT, int *OUTPUT);
615 void SetLogicalOrigin(int x, int y);
616 void GetDeviceOrigin(int *OUTPUT, int *OUTPUT);
617 void SetAxisOrientation(bool xLeftRight, bool yBottomUp);
618
619 void CalcBoundingBox(int x, int y);
620 void ResetBoundingBox();
621 };
622
623
624 //----------------------------------------------------------------------
625
626 class wxMemoryDC : public wxDC {
627 public:
628 wxMemoryDC();
629
630 void SelectObject(const wxBitmap& bitmap);
631 }
632
633 %new wxMemoryDC* wxMemoryDCFromDC(wxDC* oldDC);
634 %{ // Alternate 'constructor'
635 wxMemoryDC* wxMemoryDCFromDC(wxDC* oldDC) {
636 return new wxMemoryDC(oldDC);
637 }
638 %}
639
640
641 //---------------------------------------------------------------------------
642
643 class wxScreenDC : public wxDC {
644 public:
645 wxScreenDC();
646
647 %name(StartDrawingOnTopWin) bool StartDrawingOnTop(wxWindow* window);
648 bool StartDrawingOnTop(wxRect* rect = NULL);
649 bool EndDrawingOnTop();
650 };
651
652 //---------------------------------------------------------------------------
653
654 class wxClientDC : public wxDC {
655 public:
656 wxClientDC(wxWindow* win);
657 };
658
659 //---------------------------------------------------------------------------
660
661 class wxPaintDC : public wxDC {
662 public:
663 wxPaintDC(wxWindow* win);
664 };
665
666 //---------------------------------------------------------------------------
667
668 class wxWindowDC : public wxDC {
669 public:
670 wxWindowDC(wxWindow* win);
671 };
672
673 //---------------------------------------------------------------------------
674
675 #ifndef __WXMSW__
676 class wxPostScriptDC : public wxDC {
677 public:
678 wxPostScriptDC(const wxString& output, bool interactive = TRUE, wxWindow* win = NULL);
679 };
680 #endif
681
682 //---------------------------------------------------------------------------
683
684
685 #ifdef __WXMSW__
686 class wxMetaFileDC : public wxDC {
687 public:
688 wxMetaFileDC(const wxString& filename = wxPyEmptyStr);
689 wxMetaFile* Close();
690 };
691 #endif
692
693 //---------------------------------------------------------------------------
694 //---------------------------------------------------------------------------
695
696
697 %readonly
698 %{
699 #if 0
700 %}
701 extern wxFont *wxNORMAL_FONT;
702 extern wxFont *wxSMALL_FONT;
703 extern wxFont *wxITALIC_FONT;
704 extern wxFont *wxSWISS_FONT;
705
706 extern wxPen *wxRED_PEN;
707 extern wxPen *wxCYAN_PEN;
708 extern wxPen *wxGREEN_PEN;
709 extern wxPen *wxBLACK_PEN;
710 extern wxPen *wxWHITE_PEN;
711 extern wxPen *wxTRANSPARENT_PEN;
712 extern wxPen *wxBLACK_DASHED_PEN;
713 extern wxPen *wxGREY_PEN;
714 extern wxPen *wxMEDIUM_GREY_PEN;
715 extern wxPen *wxLIGHT_GREY_PEN;
716
717 extern wxBrush *wxBLUE_BRUSH;
718 extern wxBrush *wxGREEN_BRUSH;
719 extern wxBrush *wxWHITE_BRUSH;
720 extern wxBrush *wxBLACK_BRUSH;
721 extern wxBrush *wxTRANSPARENT_BRUSH;
722 extern wxBrush *wxCYAN_BRUSH;
723 extern wxBrush *wxRED_BRUSH;
724 extern wxBrush *wxGREY_BRUSH;
725 extern wxBrush *wxMEDIUM_GREY_BRUSH;
726 extern wxBrush *wxLIGHT_GREY_BRUSH;
727
728 extern wxColour *wxBLACK;
729 extern wxColour *wxWHITE;
730 extern wxColour *wxRED;
731 extern wxColour *wxBLUE;
732 extern wxColour *wxGREEN;
733 extern wxColour *wxCYAN;
734 extern wxColour *wxLIGHT_GREY;
735
736 extern wxCursor *wxSTANDARD_CURSOR;
737 extern wxCursor *wxHOURGLASS_CURSOR;
738 extern wxCursor *wxCROSS_CURSOR;
739
740 extern wxBitmap wxNullBitmap;
741 extern wxIcon wxNullIcon;
742 extern wxCursor wxNullCursor;
743 extern wxPen wxNullPen;
744 extern wxBrush wxNullBrush;
745 extern wxPalette wxNullPalette;
746 extern wxFont wxNullFont;
747 extern wxColour wxNullColour;
748
749
750 extern wxFontList* wxTheFontList;
751 extern wxPenList* wxThePenList;
752 extern wxBrushlist* wxTheBrushList;
753 extern wxColourDatabase* wxTheColourDatabase;
754
755
756 %readwrite
757 %{
758 #endif
759 %}
760
761 //---------------------------------------------------------------------------
762
763 class wxPalette : public wxGDIObject {
764 public:
765 wxPalette(int LCOUNT, byte* choices, byte* choices, byte* choices);
766 ~wxPalette();
767
768 int GetPixel(byte red, byte green, byte blue);
769 bool GetRGB(int pixel, byte* OUTPUT, byte* OUTPUT, byte* OUTPUT);
770 bool Ok();
771 };
772
773 //---------------------------------------------------------------------------
774
775 enum {
776 wxIMAGELIST_DRAW_NORMAL ,
777 wxIMAGELIST_DRAW_TRANSPARENT,
778 wxIMAGELIST_DRAW_SELECTED,
779 wxIMAGELIST_DRAW_FOCUSED,
780 wxIMAGE_LIST_NORMAL,
781 wxIMAGE_LIST_SMALL,
782 wxIMAGE_LIST_STATE
783 };
784
785 class wxImageList : public wxObject {
786 public:
787 wxImageList(int width, int height, int mask=TRUE, int initialCount=1);
788 ~wxImageList();
789
790 int Add(const wxBitmap& bitmap, const wxBitmap& mask = wxNullBitmap);
791 %name(AddWithColourMask)int Add(const wxBitmap& bitmap, const wxColour& maskColour);
792 %name(AddIcon)int Add(const wxIcon& icon);
793 #ifdef __WXMSW__
794 bool Replace(int index, const wxBitmap& bitmap, const wxBitmap& mask = wxNullBitmap);
795 #else
796 // %name(ReplaceIcon)bool Replace(int index, const wxIcon& icon);
797 // int Add(const wxBitmap& bitmap);
798 bool Replace(int index, const wxBitmap& bitmap);
799 #endif
800
801 bool Draw(int index, wxDC& dc, int x, int x, int flags = wxIMAGELIST_DRAW_NORMAL,
802 const bool solidBackground = FALSE);
803
804 int GetImageCount();
805 bool Remove(int index);
806 bool RemoveAll();
807 void GetSize(int index, int& OUTPUT, int& OUTPUT);
808 };
809
810
811 //---------------------------------------------------------------------------
812 // Regions, etc.
813
814 enum wxRegionContain {
815 wxOutRegion, wxPartRegion, wxInRegion
816 };
817
818
819 class wxRegion : public wxGDIObject {
820 public:
821 wxRegion(long x=0, long y=0, long width=0, long height=0);
822 ~wxRegion();
823
824 void Clear();
825 wxRegionContain Contains(long x, long y);
826 %name(ContainsPoint)wxRegionContain Contains(const wxPoint& pt);
827 %name(ContainsRect)wxRegionContain Contains(const wxRect& rect);
828 %name(ContainsRectDim)wxRegionContain Contains(long x, long y, long w, long h);
829
830 wxRect GetBox();
831
832 bool Intersect(long x, long y, long width, long height);
833 %name(IntersectRect)bool Intersect(const wxRect& rect);
834 %name(IntersectRegion)bool Intersect(const wxRegion& region);
835
836 bool IsEmpty();
837
838 bool Union(long x, long y, long width, long height);
839 %name(UnionRect)bool Union(const wxRect& rect);
840 %name(UnionRegion)bool Union(const wxRegion& region);
841
842 bool Subtract(long x, long y, long width, long height);
843 %name(SubtractRect)bool Subtract(const wxRect& rect);
844 %name(SubtractRegion)bool Subtract(const wxRegion& region);
845
846 bool Xor(long x, long y, long width, long height);
847 %name(XorRect)bool Xor(const wxRect& rect);
848 %name(XorRegion)bool Xor(const wxRegion& region);
849 };
850
851
852
853 class wxRegionIterator : public wxObject {
854 public:
855 wxRegionIterator(const wxRegion& region);
856 ~wxRegionIterator();
857
858 long GetX();
859 long GetY();
860 long GetW();
861 long GetWidth();
862 long GetH();
863 long GetHeight();
864 wxRect GetRect();
865 bool HaveRects();
866 void Reset();
867
868 %addmethods {
869 void Next() {
870 (*self) ++;
871 }
872 };
873 };
874
875
876 //---------------------------------------------------------------------------
877