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()));
306 %new wxColour* wxNamedColour(const wxString& colorName);
307 %{ // Alternate 'constructor'
308 wxColour* wxNamedColour(const wxString& colorName) {
309 return new wxColour(colorName);
314 //----------------------------------------------------------------------
317 typedef unsigned long wxDash;
325 // I'll do it this way to use long-lived objects and not have to
326 // worry about when python may delete the object.
328 wxPen(wxColour* colour, int width=1, int style=wxSOLID) {
329 return wxThePenList->FindOrCreatePen(*colour, width, style);
335 wxColour& GetColour();
341 void SetCap(int cap_style);
342 void SetColour(wxColour& colour);
343 void SetJoin(int join_style);
344 void SetStyle(int style);
345 void SetWidth(int width);
347 // **** This one needs to return a list of ints (wxDash)
348 int GetDashes(wxDash **dashes);
349 void SetDashes(int LCOUNT, wxDash* LIST);
352 wxBitmap* GetStipple();
353 void SetStipple(wxBitmap& stipple);
357 //----------------------------------------------------------------------
361 // I'll do it this way to use long-lived objects and not have to
362 // worry about when python may delete the object.
364 wxBrush(wxColour* colour, int style=wxSOLID) {
365 return wxTheBrushList->FindOrCreateBrush(*colour, style);
370 wxColour& GetColour();
371 wxBitmap * GetStipple();
374 void SetColour(wxColour &colour);
375 void SetStipple(wxBitmap& bitmap);
376 void SetStyle(int style);
379 //----------------------------------------------------------------------
385 // wxDC(); **** abstract base class, can't instantiate.
390 bool Blit(long xdest, long ydest,
391 long width, long height,
392 wxDC *source, long xsrc, long ysrc,
393 int logicalFunc = wxCOPY, int useMask = FALSE);
394 // bool Blit(const wxPoint& destPt, const wxSize& sz,
395 // wxDC *source, const wxPoint& srcPt,
396 // int logicalFunc = wxCOPY, int useMask = FALSE);
399 void CrossHair(long x, long y);
400 void DestroyClippingRegion();
401 long DeviceToLogicalX(long x);
402 long DeviceToLogicalXRel(long x);
403 long DeviceToLogicalY(long y);
404 long DeviceToLogicalYRel(long y);
405 void DrawArc(long x1, long y1, long x2, long y2, long xc, long yc);
406 void DrawCircle(long x, long y, long radius);
407 void DrawEllipse(long x, long y, long width, long height);
408 void DrawEllipticArc(long x, long y, long width, long height, long start, long end);
409 void DrawIcon(const wxIcon& icon, long x, long y);
410 void DrawLine(long x1, long y1, long x2, long y2);
411 void DrawLines(int LCOUNT, wxPoint* LIST, long xoffset=0, long yoffset=0);
412 void DrawPolygon(int LCOUNT, wxPoint* LIST, long xoffset=0, long yoffset=0,
413 int fill_style=wxODDEVEN_RULE);
414 void DrawPoint(long x, long y);
415 void DrawRectangle(long x, long y, long width, long height);
416 void DrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle);
417 void DrawRoundedRectangle(long x, long y, long width, long height, long radius=20);
418 void DrawSpline(int LCOUNT, wxPoint* LIST);
419 void DrawText(const wxString& text, long x, long y);
423 void FloodFill(long x, long y, const wxColour& colour, int style=wxFLOOD_SURFACE);
424 wxBrush& GetBackground();
426 long GetCharHeight();
428 void GetClippingBox(long *OUTPUT, long *OUTPUT,
429 long *OUTPUT, long *OUTPUT);
431 int GetLogicalFunction();
433 bool GetOptimization();
436 %new wxColour* GetPixel(long x, long y) {
437 wxColour* wc = new wxColour();
438 self->GetPixel(x, y, wc);
442 %name(GetSizeTuple)void GetSize(int* OUTPUT, int* OUTPUT);
444 wxColour& GetTextBackground();
445 void GetTextExtent(const wxString& string, long *OUTPUT, long *OUTPUT);
446 %name(GetFullTextExtent)void GetTextExtent(const wxString& string,
447 long *OUTPUT, long *OUTPUT, long *OUTPUT, long* OUTPUT,
448 const wxFont* font = NULL);
449 wxColour& GetTextForeground();
450 long LogicalToDeviceX(long x);
451 long LogicalToDeviceXRel(long x);
452 long LogicalToDeviceY(long y);
453 long LogicalToDeviceYRel(long y);
459 void SetDeviceOrigin(long x, long y);
460 void SetBackground(const wxBrush& brush);
461 void SetBackgroundMode(int mode);
462 void SetClippingRegion(long x, long y, long width, long height);
463 void SetPalette(const wxPalette& colourMap);
464 void SetBrush(const wxBrush& brush);
465 void SetFont(const wxFont& font);
466 void SetLogicalFunction(int function);
467 void SetMapMode(int mode);
468 void SetOptimization(bool optimize);
469 void SetPen(const wxPen& pen);
470 void SetTextBackground(const wxColour& colour);
471 void SetTextForeground(const wxColour& colour);
472 void SetUserScale(double x_scale, double y_scale);
473 bool StartDoc(const wxString& message);
477 // Don't need this one anymore as wxWindows has one...
479 // // This one is my own creation...
480 // void DrawBitmap(wxBitmap& bitmap, long x, long y, bool swapPalette=TRUE) {
481 // wxMemoryDC* memDC = new wxMemoryDC;
482 // memDC->SelectObject(bitmap);
485 // self->SetPalette(*bitmap.GetPalette());
487 // self->Blit(x, y, bitmap.GetWidth(), bitmap.GetHeight(), memDC,
488 // 0, 0, self->GetLogicalFunction());
489 // memDC->SelectObject(wxNullBitmap);
494 void DrawBitmap(const wxBitmap& bitmap, long x, long y,
495 int useMask = FALSE);
500 //----------------------------------------------------------------------
502 class wxMemoryDC : public wxDC {
506 void SelectObject(const wxBitmap& bitmap);
509 %new wxMemoryDC* wxMemoryDCFromDC(wxDC* oldDC);
510 %{ // Alternate 'constructor'
511 wxMemoryDC* wxMemoryDCFromDC(wxDC* oldDC) {
512 return new wxMemoryDC(oldDC);
517 //---------------------------------------------------------------------------
519 class wxScreenDC : public wxDC {
523 bool StartDrawingOnTop(wxWindow* window);
524 %name(StartDrawingOnTopRect) bool StartDrawingOnTop(wxRect* rect = NULL);
525 bool EndDrawingOnTop();
528 //---------------------------------------------------------------------------
530 class wxClientDC : public wxDC {
532 wxClientDC(wxWindow* win);
535 //---------------------------------------------------------------------------
537 class wxPaintDC : public wxDC {
539 wxPaintDC(wxWindow* win);
542 //---------------------------------------------------------------------------
544 class wxWindowDC : public wxDC {
546 wxWindowDC(wxWindow* win);
549 //---------------------------------------------------------------------------
552 class wxPostScriptDC : public wxDC {
554 wxPostScriptDC(const wxString& output, bool interactive = TRUE, wxWindow* win = NULL);
558 //---------------------------------------------------------------------------
561 class wxPrinterDC : public wxDC {
563 wxPrinterDC(const wxString& driver, const wxString& device, const wxString& output,
564 bool interactive = TRUE, int orientation = wxPORTRAIT);
568 //---------------------------------------------------------------------------
571 class wxMetaFileDC : public wxDC {
573 wxMetaFileDC(const wxString& filename = wxPyEmptyStr);
578 //---------------------------------------------------------------------------
579 //---------------------------------------------------------------------------
586 extern wxFont *wxNORMAL_FONT;
587 extern wxFont *wxSMALL_FONT;
588 extern wxFont *wxITALIC_FONT;
589 extern wxFont *wxSWISS_FONT;
591 extern wxPen *wxRED_PEN;
592 extern wxPen *wxCYAN_PEN;
593 extern wxPen *wxGREEN_PEN;
594 extern wxPen *wxBLACK_PEN;
595 extern wxPen *wxWHITE_PEN;
596 extern wxPen *wxTRANSPARENT_PEN;
597 extern wxPen *wxBLACK_DASHED_PEN;
598 extern wxPen *wxGREY_PEN;
599 extern wxPen *wxMEDIUM_GREY_PEN;
600 extern wxPen *wxLIGHT_GREY_PEN;
602 extern wxBrush *wxBLUE_BRUSH;
603 extern wxBrush *wxGREEN_BRUSH;
604 extern wxBrush *wxWHITE_BRUSH;
605 extern wxBrush *wxBLACK_BRUSH;
606 extern wxBrush *wxTRANSPARENT_BRUSH;
607 extern wxBrush *wxCYAN_BRUSH;
608 extern wxBrush *wxRED_BRUSH;
609 extern wxBrush *wxGREY_BRUSH;
610 extern wxBrush *wxMEDIUM_GREY_BRUSH;
611 extern wxBrush *wxLIGHT_GREY_BRUSH;
613 extern wxColour *wxBLACK;
614 extern wxColour *wxWHITE;
615 extern wxColour *wxRED;
616 extern wxColour *wxBLUE;
617 extern wxColour *wxGREEN;
618 extern wxColour *wxCYAN;
619 extern wxColour *wxLIGHT_GREY;
621 extern wxCursor *wxSTANDARD_CURSOR;
622 extern wxCursor *wxHOURGLASS_CURSOR;
623 extern wxCursor *wxCROSS_CURSOR;
625 extern wxBitmap wxNullBitmap;
626 extern wxIcon wxNullIcon;
627 extern wxCursor wxNullCursor;
628 extern wxPen wxNullPen;
629 extern wxBrush wxNullBrush;
630 extern wxPalette wxNullPalette;
631 extern wxFont wxNullFont;
632 extern wxColour wxNullColour;
639 //---------------------------------------------------------------------------
643 wxPalette(int LCOUNT, byte* LIST, byte* LIST, byte* LIST);
646 int GetPixel(byte red, byte green, byte blue);
647 bool GetRGB(int pixel, byte* OUTPUT, byte* OUTPUT, byte* OUTPUT);
651 //---------------------------------------------------------------------------
654 wxIMAGELIST_DRAW_NORMAL ,
655 wxIMAGELIST_DRAW_TRANSPARENT,
656 wxIMAGELIST_DRAW_SELECTED,
657 wxIMAGELIST_DRAW_FOCUSED,
665 wxImageList(int width, int height, int mask=TRUE, int initialCount=1);
669 int Add(const wxBitmap& bitmap, const wxBitmap& mask = wxNullBitmap);
670 %name(AddWithColourMask)int Add(const wxBitmap& bitmap, const wxColour& maskColour);
671 %name(AddIcon)int Add(const wxIcon& icon);
672 bool Replace(int index, const wxBitmap& bitmap, const wxBitmap& mask = wxNullBitmap);
673 %name(ReplaceIcon)bool Replace(int index, const wxIcon& icon);
675 int Add(const wxBitmap& bitmap);
676 bool Replace(int index, const wxBitmap& bitmap);
679 bool Draw(int index, wxDC& dc, int x, int x, int flags = wxIMAGELIST_DRAW_NORMAL,
680 const bool solidBackground = FALSE);
683 bool Remove(int index);
688 //---------------------------------------------------------------------------