1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: SWIG interface file for wxDC, wxBrush, wxPen, wxFont, etc.
9 // Copyright: (c) 1998 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
18 #include <wx/metafile.h>
19 #include <wx/imaglist.h>
25 //----------------------------------------------------------------------
28 %include my_typemaps.i
30 // Import some definitions of other classes, etc.
34 //---------------------------------------------------------------------------
39 // void SetHandle(long handle);
44 // void SetWidth(int w);
45 // void SetHeight(int h);
46 // void SetDepth(int d);
47 // void SetSize(const wxSize& size);
50 //---------------------------------------------------------------------------
56 wxBitmap(const wxString& name, long type);
59 wxPalette* GetPalette();
61 bool LoadFile(const wxString& name, long flags);
62 bool SaveFile(const wxString& name, int type, wxPalette* palette = NULL);
63 void SetMask(wxMask* mask);
65 void SetPalette(wxPalette& palette);
71 void SetHandle(long handle);
78 void SetHeight(int h);
81 void SetSize(const wxSize& size);
86 %new wxBitmap* wxEmptyBitmap(int width, int height, int depth=-1);
89 %new wxBitmap* wxBitmapFromData(char* data, long type,
90 int width, int height, int depth = 1);
93 %{ // Alternate 'constructor'
94 wxBitmap* wxEmptyBitmap(int width, int height, int depth=-1) {
95 return new wxBitmap(width, height, depth);
99 wxBitmap* wxBitmapFromData(char* data, long type,
100 int width, int height, int depth = 1) {
101 return new wxBitmap((void*)data, type, width, height, depth);
106 //---------------------------------------------------------------------------
110 wxMask(const wxBitmap& bitmap);
114 %new wxMask* wxMaskColour(const wxBitmap& bitmap, const wxColour& colour);
116 wxMask* wxMaskColour(const wxBitmap& bitmap, const wxColour& colour) {
117 return new wxMask(bitmap, colour);
122 //---------------------------------------------------------------------------
126 //: public wxGDIImage
129 wxIcon(const wxString& name, long flags,
130 int desiredWidth = -1, int desiredHeight = -1);
133 bool LoadFile(const wxString& name, long flags);
135 // wxGDIImage methods
138 void SetHandle(long handle);
144 void SetWidth(int w);
145 void SetHeight(int h);
146 void SetDepth(int d);
148 void SetSize(const wxSize& size);
153 //---------------------------------------------------------------------------
156 //: public wxGDIImage
160 wxCursor(const wxString& cursorName, long flags, int hotSpotX=0, int hotSpotY=0);
164 // wxGDIImage methods
167 void SetHandle(long handle);
174 void SetWidth(int w);
175 void SetHeight(int h);
176 void SetDepth(int d);
177 void SetSize(const wxSize& size);
181 %name(wxStockCursor) %new wxCursor* wxPyStockCursor(int id);
182 %{ // Alternate 'constructor'
183 wxCursor* wxPyStockCursor(int id) {
184 return new wxCursor(id);
188 //----------------------------------------------------------------------
193 wxFONTENCODING_SYSTEM = -1, // system default
194 wxFONTENCODING_DEFAULT, // current default encoding
196 // ISO8859 standard defines a number of single-byte charsets
197 wxFONTENCODING_ISO8859_1, // West European (Latin1)
198 wxFONTENCODING_ISO8859_2, // Central and East European (Latin2)
199 wxFONTENCODING_ISO8859_3, // Esperanto (Latin3)
200 wxFONTENCODING_ISO8859_4, // Baltic languages (Estonian) (Latin4)
201 wxFONTENCODING_ISO8859_5, // Cyrillic
202 wxFONTENCODING_ISO8859_6, // Arabic
203 wxFONTENCODING_ISO8859_7, // Greek
204 wxFONTENCODING_ISO8859_8, // Hebrew
205 wxFONTENCODING_ISO8859_9, // Turkish (Latin5)
206 wxFONTENCODING_ISO8859_10, // Variation of Latin4 (Latin6)
207 wxFONTENCODING_ISO8859_11, // Thai
208 wxFONTENCODING_ISO8859_12, // doesn't exist currently, but put it
209 // here anyhow to make all ISO8859
210 // consecutive numbers
211 wxFONTENCODING_ISO8859_13, // Latin7
212 wxFONTENCODING_ISO8859_14, // Latin8
213 wxFONTENCODING_ISO8859_15, // Latin9 (a.k.a. Latin0, includes euro)
215 // Cyrillic charset soup (see http://czyborra.com/charsets/cyrillic.html)
216 wxFONTENCODING_KOI8, // we don't support any of KOI8 variants
217 wxFONTENCODING_ALTERNATIVE, // same as MS-DOS CP866
218 wxFONTENCODING_BULGARIAN, // used under Linux in Bulgaria
220 // what would we do without Microsoft? They have their own encodings
222 wxFONTENCODING_CP437, // original MS-DOS codepage
223 wxFONTENCODING_CP850, // CP437 merged with Latin1
224 wxFONTENCODING_CP852, // CP437 merged with Latin2
225 wxFONTENCODING_CP855, // another cyrillic encoding
226 wxFONTENCODING_CP866, // and another one
228 wxFONTENCODING_CP1250, // WinLatin2
229 wxFONTENCODING_CP1251, // WinCyrillic
230 wxFONTENCODING_CP1252, // WinLatin1
237 // I'll do it this way to use long-lived objects and not have to
238 // worry about when python may delete the object.
240 wxFont( int pointSize, int family, int style, int weight,
241 int underline=FALSE, char* faceName = "",
242 wxFontEncoding encoding=wxFONTENCODING_DEFAULT) {
244 return wxTheFontList->FindOrCreateFont(pointSize, family, style, weight,
245 underline, faceName, encoding);
252 wxString GetFaceName();
259 bool GetUnderlined();
261 wxFontEncoding GetEncoding();
262 void SetFaceName(const wxString& faceName);
263 void SetFamily(int family);
264 void SetPointSize(int pointSize);
265 void SetStyle(int style);
266 void SetUnderlined(bool underlined);
267 void SetWeight(int weight);
268 void SetEncoding(wxFontEncoding encoding);
269 wxString GetFamilyString();
270 wxString GetStyleString();
271 wxString GetWeightString();
275 wxFontEncoding wxFont_GetDefaultEncoding() {
276 return wxFont::GetDefaultEncoding();
279 void wxFont_SetDefaultEncoding(wxFontEncoding encoding) {
280 wxFont::SetDefaultEncoding(encoding);
284 //----------------------------------------------------------------------
288 wxColour(unsigned char red=0, unsigned char green=0, unsigned char blue=0);
291 unsigned char Green();
292 unsigned char Blue();
294 void Set(unsigned char red, unsigned char green, unsigned char blue);
297 PyObject* rv = PyTuple_New(3);
298 PyTuple_SetItem(rv, 0, PyInt_FromLong(self->Red()));
299 PyTuple_SetItem(rv, 1, PyInt_FromLong(self->Green()));
300 PyTuple_SetItem(rv, 2, PyInt_FromLong(self->Blue()));
304 %pragma(python) addtoclass = "asTuple = Get"
305 %pragma(python) addtoclass = "def __str__(self): return str(self.asTuple())"
306 %pragma(python) addtoclass = "def __repr__(self): return str(self.asTuple())"
310 %new wxColour* wxNamedColour(const wxString& colorName);
311 %{ // Alternate 'constructor'
312 wxColour* wxNamedColour(const wxString& colorName) {
313 return new wxColour(colorName);
318 //----------------------------------------------------------------------
321 typedef unsigned long wxDash;
329 // I'll do it this way to use long-lived objects and not have to
330 // worry about when python may delete the object.
332 wxPen(wxColour* colour, int width=1, int style=wxSOLID) {
333 return wxThePenList->FindOrCreatePen(*colour, width, style);
339 wxColour& GetColour();
345 void SetCap(int cap_style);
346 void SetColour(wxColour& colour);
347 void SetJoin(int join_style);
348 void SetStyle(int style);
349 void SetWidth(int width);
351 // **** This one needs to return a list of ints (wxDash)
352 int GetDashes(wxDash **dashes);
353 void SetDashes(int LCOUNT, wxDash* choices);
356 wxBitmap* GetStipple();
357 void SetStipple(wxBitmap& stipple);
361 //----------------------------------------------------------------------
365 // I'll do it this way to use long-lived objects and not have to
366 // worry about when python may delete the object.
368 wxBrush(const wxColour* colour, int style=wxSOLID) {
369 return wxTheBrushList->FindOrCreateBrush(*colour, style);
374 // wxBrush(const wxColour& colour, int style=wxSOLID);
376 wxColour& GetColour();
377 wxBitmap * GetStipple();
380 void SetColour(wxColour &colour);
381 void SetStipple(wxBitmap& bitmap);
382 void SetStyle(int style);
385 //----------------------------------------------------------------------
391 // wxDC(); **** abstract base class, can't instantiate.
396 bool Blit(long xdest, long ydest,
397 long width, long height,
398 wxDC *source, long xsrc, long ysrc,
399 int logicalFunc = wxCOPY, int useMask = FALSE);
400 // bool Blit(const wxPoint& destPt, const wxSize& sz,
401 // wxDC *source, const wxPoint& srcPt,
402 // int logicalFunc = wxCOPY, int useMask = FALSE);
405 void CrossHair(long x, long y);
406 void DestroyClippingRegion();
407 long DeviceToLogicalX(long x);
408 long DeviceToLogicalXRel(long x);
409 long DeviceToLogicalY(long y);
410 long DeviceToLogicalYRel(long y);
411 void DrawArc(long x1, long y1, long x2, long y2, long xc, long yc);
412 void DrawCircle(long x, long y, long radius);
413 void DrawEllipse(long x, long y, long width, long height);
414 void DrawEllipticArc(long x, long y, long width, long height, long start, long end);
415 void DrawIcon(const wxIcon& icon, long x, long y);
416 void DrawLine(long x1, long y1, long x2, long y2);
417 void DrawLines(int PCOUNT, wxPoint* points, long xoffset=0, long yoffset=0);
418 void DrawPolygon(int PCOUNT, wxPoint* points, long xoffset=0, long yoffset=0,
419 int fill_style=wxODDEVEN_RULE);
420 void DrawPoint(long x, long y);
421 void DrawRectangle(long x, long y, long width, long height);
422 void DrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle);
423 void DrawRoundedRectangle(long x, long y, long width, long height, long radius=20);
424 void DrawSpline(int PCOUNT, wxPoint* points);
425 void DrawText(const wxString& text, long x, long y);
429 void FloodFill(long x, long y, const wxColour& colour, int style=wxFLOOD_SURFACE);
430 wxBrush& GetBackground();
432 long GetCharHeight();
434 void GetClippingBox(long *OUTPUT, long *OUTPUT,
435 long *OUTPUT, long *OUTPUT);
437 int GetLogicalFunction();
438 void GetLogicalScale(double *OUTPUT, double *OUTPUT);
440 bool GetOptimization();
443 %new wxColour* GetPixel(long x, long y) {
444 wxColour* wc = new wxColour();
445 self->GetPixel(x, y, wc);
449 %name(GetSizeTuple)void GetSize(int* OUTPUT, int* OUTPUT);
452 wxColour& GetTextBackground();
453 void GetTextExtent(const wxString& string, long *OUTPUT, long *OUTPUT);
454 %name(GetFullTextExtent)void GetTextExtent(const wxString& string,
455 long *OUTPUT, long *OUTPUT, long *OUTPUT, long* OUTPUT,
456 const wxFont* font = NULL);
457 wxColour& GetTextForeground();
458 void GetUserScale(double *OUTPUT, double *OUTPUT);
459 long LogicalToDeviceX(long x);
460 long LogicalToDeviceXRel(long x);
461 long LogicalToDeviceY(long y);
462 long LogicalToDeviceYRel(long y);
468 void SetDeviceOrigin(long x, long y);
469 void SetBackground(const wxBrush& brush);
470 void SetBackgroundMode(int mode);
471 void SetClippingRegion(long x, long y, long width, long height);
472 void SetPalette(const wxPalette& colourMap);
473 void SetBrush(const wxBrush& brush);
474 void SetFont(const wxFont& font);
475 void SetLogicalFunction(int function);
476 void SetLogicalScale(double x, double y);
477 void SetMapMode(int mode);
478 void SetOptimization(bool optimize);
479 void SetPen(const wxPen& pen);
480 void SetTextBackground(const wxColour& colour);
481 void SetTextForeground(const wxColour& colour);
482 void SetUserScale(double x_scale, double y_scale);
483 bool StartDoc(const wxString& message);
488 void DrawBitmap(const wxBitmap& bitmap, long x, long y,
489 int useMask = FALSE);
491 bool CanDrawBitmap();
492 bool CanGetTextExtent();
496 void GetLogicalOrigin(int *OUTPUT, int *OUTPUT);
497 void SetLogicalOrigin(int x, int y);
498 void GetDeviceOrigin(int *OUTPUT, int *OUTPUT);
499 void SetAxisOrientation(bool xLeftRight, bool yBottomUp);
504 //----------------------------------------------------------------------
506 class wxMemoryDC : public wxDC {
510 void SelectObject(const wxBitmap& bitmap);
513 %new wxMemoryDC* wxMemoryDCFromDC(wxDC* oldDC);
514 %{ // Alternate 'constructor'
515 wxMemoryDC* wxMemoryDCFromDC(wxDC* oldDC) {
516 return new wxMemoryDC(oldDC);
521 //---------------------------------------------------------------------------
523 class wxScreenDC : public wxDC {
527 %name(StartDrawingOnTopWin) bool StartDrawingOnTop(wxWindow* window);
528 bool StartDrawingOnTop(wxRect* rect = NULL);
529 bool EndDrawingOnTop();
532 //---------------------------------------------------------------------------
534 class wxClientDC : public wxDC {
536 wxClientDC(wxWindow* win);
539 //---------------------------------------------------------------------------
541 class wxPaintDC : public wxDC {
543 wxPaintDC(wxWindow* win);
546 //---------------------------------------------------------------------------
548 class wxWindowDC : public wxDC {
550 wxWindowDC(wxWindow* win);
553 //---------------------------------------------------------------------------
556 class wxPostScriptDC : public wxDC {
558 wxPostScriptDC(const wxString& output, bool interactive = TRUE, wxWindow* win = NULL);
562 //---------------------------------------------------------------------------
565 class wxPrinterDC : public wxDC {
567 wxPrinterDC(const wxString& driver, const wxString& device, const wxString& output,
568 bool interactive = TRUE, int orientation = wxPORTRAIT);
572 //---------------------------------------------------------------------------
575 class wxMetaFileDC : public wxDC {
577 wxMetaFileDC(const wxString& filename = wxPyEmptyStr);
582 //---------------------------------------------------------------------------
583 //---------------------------------------------------------------------------
590 extern wxFont *wxNORMAL_FONT;
591 extern wxFont *wxSMALL_FONT;
592 extern wxFont *wxITALIC_FONT;
593 extern wxFont *wxSWISS_FONT;
595 extern wxPen *wxRED_PEN;
596 extern wxPen *wxCYAN_PEN;
597 extern wxPen *wxGREEN_PEN;
598 extern wxPen *wxBLACK_PEN;
599 extern wxPen *wxWHITE_PEN;
600 extern wxPen *wxTRANSPARENT_PEN;
601 extern wxPen *wxBLACK_DASHED_PEN;
602 extern wxPen *wxGREY_PEN;
603 extern wxPen *wxMEDIUM_GREY_PEN;
604 extern wxPen *wxLIGHT_GREY_PEN;
606 extern wxBrush *wxBLUE_BRUSH;
607 extern wxBrush *wxGREEN_BRUSH;
608 extern wxBrush *wxWHITE_BRUSH;
609 extern wxBrush *wxBLACK_BRUSH;
610 extern wxBrush *wxTRANSPARENT_BRUSH;
611 extern wxBrush *wxCYAN_BRUSH;
612 extern wxBrush *wxRED_BRUSH;
613 extern wxBrush *wxGREY_BRUSH;
614 extern wxBrush *wxMEDIUM_GREY_BRUSH;
615 extern wxBrush *wxLIGHT_GREY_BRUSH;
617 extern wxColour *wxBLACK;
618 extern wxColour *wxWHITE;
619 extern wxColour *wxRED;
620 extern wxColour *wxBLUE;
621 extern wxColour *wxGREEN;
622 extern wxColour *wxCYAN;
623 extern wxColour *wxLIGHT_GREY;
625 extern wxCursor *wxSTANDARD_CURSOR;
626 extern wxCursor *wxHOURGLASS_CURSOR;
627 extern wxCursor *wxCROSS_CURSOR;
629 extern wxBitmap wxNullBitmap;
630 extern wxIcon wxNullIcon;
631 extern wxCursor wxNullCursor;
632 extern wxPen wxNullPen;
633 extern wxBrush wxNullBrush;
634 extern wxPalette wxNullPalette;
635 extern wxFont wxNullFont;
636 extern wxColour wxNullColour;
643 //---------------------------------------------------------------------------
647 wxPalette(int LCOUNT, byte* choices, byte* choices, byte* choices);
650 int GetPixel(byte red, byte green, byte blue);
651 bool GetRGB(int pixel, byte* OUTPUT, byte* OUTPUT, byte* OUTPUT);
655 //---------------------------------------------------------------------------
658 wxIMAGELIST_DRAW_NORMAL ,
659 wxIMAGELIST_DRAW_TRANSPARENT,
660 wxIMAGELIST_DRAW_SELECTED,
661 wxIMAGELIST_DRAW_FOCUSED,
669 wxImageList(int width, int height, int mask=FALSE, int initialCount=1);
673 int Add(const wxBitmap& bitmap, const wxBitmap& mask = wxNullBitmap);
674 %name(AddWithColourMask)int Add(const wxBitmap& bitmap, const wxColour& maskColour);
675 %name(AddIcon)int Add(const wxIcon& icon);
676 bool Replace(int index, const wxBitmap& bitmap, const wxBitmap& mask = wxNullBitmap);
677 %name(ReplaceIcon)bool Replace(int index, const wxIcon& icon);
679 int Add(const wxBitmap& bitmap);
680 bool Replace(int index, const wxBitmap& bitmap);
683 bool Draw(int index, wxDC& dc, int x, int x, int flags = wxIMAGELIST_DRAW_NORMAL,
684 const bool solidBackground = FALSE);
687 bool Remove(int index);
692 //---------------------------------------------------------------------------