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);
48 void SetHeight(int h);
51 void SetSize(const wxSize& size);
55 //---------------------------------------------------------------------------
57 class wxBitmap : public wxGDIImage {
59 wxBitmap(const wxString& name, long type);
62 wxPalette* GetPalette();
64 bool LoadFile(const wxString& name, long flags);
65 bool SaveFile(const wxString& name, int type, wxPalette* palette = NULL);
66 void SetMask(wxMask* mask);
68 void SetPalette(wxPalette& palette);
72 %new wxBitmap* wxEmptyBitmap(int width, int height, int depth=-1);
75 %new wxBitmap* wxBitmapFromData(char* data, long type,
76 int width, int height, int depth = 1);
79 %{ // Alternate 'constructor'
80 wxBitmap* wxEmptyBitmap(int width, int height, int depth=-1) {
81 return new wxBitmap(width, height, depth);
85 wxBitmap* wxBitmapFromData(char* data, long type,
86 int width, int height, int depth = 1) {
87 return new wxBitmap((void*)data, type, width, height, depth);
92 //---------------------------------------------------------------------------
96 wxMask(const wxBitmap& bitmap);
100 %new wxMask* wxMaskColour(const wxBitmap& bitmap, const wxColour& colour);
102 wxMask* wxMaskColour(const wxBitmap& bitmap, const wxColour& colour) {
103 return new wxMask(bitmap, colour);
108 //---------------------------------------------------------------------------
111 class wxIcon : public wxGDIImage {
113 wxIcon(const wxString& name, long flags,
114 int desiredWidth = -1, int desiredHeight = -1);
117 bool LoadFile(const wxString& name, long flags);
121 //---------------------------------------------------------------------------
123 class wxCursor : public wxGDIImage {
126 wxCursor(const wxString& cursorName, long flags, int hotSpotX=0, int hotSpotY=0);
131 %name(wxStockCursor) %new wxCursor* wxPyStockCursor(int id);
132 %{ // Alternate 'constructor'
133 wxCursor* wxPyStockCursor(int id) {
134 return new wxCursor(id);
138 //----------------------------------------------------------------------
143 wxFONTENCODING_SYSTEM = -1, // system default
144 wxFONTENCODING_DEFAULT, // current default encoding
146 // ISO8859 standard defines a number of single-byte charsets
147 wxFONTENCODING_ISO8859_1, // West European (Latin1)
148 wxFONTENCODING_ISO8859_2, // Central and East European (Latin2)
149 wxFONTENCODING_ISO8859_3, // Esperanto (Latin3)
150 wxFONTENCODING_ISO8859_4, // Baltic languages (Estonian) (Latin4)
151 wxFONTENCODING_ISO8859_5, // Cyrillic
152 wxFONTENCODING_ISO8859_6, // Arabic
153 wxFONTENCODING_ISO8859_7, // Greek
154 wxFONTENCODING_ISO8859_8, // Hebrew
155 wxFONTENCODING_ISO8859_9, // Turkish (Latin5)
156 wxFONTENCODING_ISO8859_10, // Variation of Latin4 (Latin6)
157 wxFONTENCODING_ISO8859_11, // Thai
158 wxFONTENCODING_ISO8859_12, // doesn't exist currently, but put it
159 // here anyhow to make all ISO8859
160 // consecutive numbers
161 wxFONTENCODING_ISO8859_13, // Latin7
162 wxFONTENCODING_ISO8859_14, // Latin8
163 wxFONTENCODING_ISO8859_15, // Latin9 (a.k.a. Latin0, includes euro)
165 // Cyrillic charset soup (see http://czyborra.com/charsets/cyrillic.html)
166 wxFONTENCODING_KOI8, // we don't support any of KOI8 variants
167 wxFONTENCODING_ALTERNATIVE, // same as MS-DOS CP866
168 wxFONTENCODING_BULGARIAN, // used under Linux in Bulgaria
170 // what would we do without Microsoft? They have their own encodings
172 wxFONTENCODING_CP437, // original MS-DOS codepage
173 wxFONTENCODING_CP850, // CP437 merged with Latin1
174 wxFONTENCODING_CP852, // CP437 merged with Latin2
175 wxFONTENCODING_CP855, // another cyrillic encoding
176 wxFONTENCODING_CP866, // and another one
178 wxFONTENCODING_CP1250, // WinLatin2
179 wxFONTENCODING_CP1251, // WinCyrillic
180 wxFONTENCODING_CP1252, // WinLatin1
187 // I'll do it this way to use long-lived objects and not have to
188 // worry about when python may delete the object.
190 wxFont( int pointSize, int family, int style, int weight,
191 int underline=FALSE, char* faceName = "",
192 wxFontEncoding encoding=wxFONTENCODING_DEFAULT) {
194 return wxTheFontList->FindOrCreateFont(pointSize, family, style, weight,
195 underline, faceName, encoding);
202 wxString GetFaceName();
209 bool GetUnderlined();
211 wxFontEncoding GetEncoding();
212 void SetFaceName(const wxString& faceName);
213 void SetFamily(int family);
214 void SetPointSize(int pointSize);
215 void SetStyle(int style);
216 void SetUnderlined(bool underlined);
217 void SetWeight(int weight);
218 void SetEncoding(wxFontEncoding encoding);
219 wxString GetFamilyString();
220 wxString GetStyleString();
221 wxString GetWeightString();
225 wxFontEncoding wxFont_GetDefaultEncoding() {
226 return wxFont::GetDefaultEncoding();
229 void wxFont_SetDefaultEncoding(wxFontEncoding encoding) {
230 wxFont::SetDefaultEncoding(encoding);
234 //----------------------------------------------------------------------
238 wxColour(unsigned char red=0, unsigned char green=0, unsigned char blue=0);
241 unsigned char Green();
242 unsigned char Blue();
244 void Set(unsigned char red, unsigned char green, unsigned char blue);
247 PyObject* rv = PyTuple_New(3);
248 PyTuple_SetItem(rv, 0, PyInt_FromLong(self->Red()));
249 PyTuple_SetItem(rv, 1, PyInt_FromLong(self->Green()));
250 PyTuple_SetItem(rv, 2, PyInt_FromLong(self->Blue()));
256 %new wxColour* wxNamedColour(const wxString& colorName);
257 %{ // Alternate 'constructor'
258 wxColour* wxNamedColour(const wxString& colorName) {
259 return new wxColour(colorName);
264 //----------------------------------------------------------------------
267 typedef unsigned long wxDash;
275 // I'll do it this way to use long-lived objects and not have to
276 // worry about when python may delete the object.
278 wxPen(wxColour* colour, int width=1, int style=wxSOLID) {
279 return wxThePenList->FindOrCreatePen(*colour, width, style);
285 wxColour& GetColour();
291 void SetCap(int cap_style);
292 void SetColour(wxColour& colour);
293 void SetJoin(int join_style);
294 void SetStyle(int style);
295 void SetWidth(int width);
297 // **** This one needs to return a list of ints (wxDash)
298 int GetDashes(wxDash **dashes);
299 void SetDashes(int LCOUNT, wxDash* LIST);
302 wxBitmap* GetStipple();
303 void SetStipple(wxBitmap& stipple);
307 //----------------------------------------------------------------------
311 // I'll do it this way to use long-lived objects and not have to
312 // worry about when python may delete the object.
314 wxBrush(wxColour* colour, int style=wxSOLID) {
315 return wxTheBrushList->FindOrCreateBrush(*colour, style);
320 wxColour& GetColour();
321 wxBitmap * GetStipple();
324 void SetColour(wxColour &colour);
325 void SetStipple(wxBitmap& bitmap);
326 void SetStyle(int style);
329 //----------------------------------------------------------------------
335 // wxDC(); **** abstract base class, can't instantiate.
340 bool Blit(long xdest, long ydest,
341 long width, long height,
342 wxDC *source, long xsrc, long ysrc,
343 int logicalFunc = wxCOPY, int useMask = FALSE);
344 // bool Blit(const wxPoint& destPt, const wxSize& sz,
345 // wxDC *source, const wxPoint& srcPt,
346 // int logicalFunc = wxCOPY, int useMask = FALSE);
349 void CrossHair(long x, long y);
350 void DestroyClippingRegion();
351 long DeviceToLogicalX(long x);
352 long DeviceToLogicalXRel(long x);
353 long DeviceToLogicalY(long y);
354 long DeviceToLogicalYRel(long y);
355 void DrawArc(long x1, long y1, long x2, long y2, long xc, long yc);
356 void DrawCircle(long x, long y, long radius);
357 void DrawEllipse(long x, long y, long width, long height);
358 void DrawEllipticArc(long x, long y, long width, long height, long start, long end);
359 void DrawIcon(const wxIcon& icon, long x, long y);
360 void DrawLine(long x1, long y1, long x2, long y2);
361 void DrawLines(int LCOUNT, wxPoint* LIST, long xoffset=0, long yoffset=0);
362 void DrawPolygon(int LCOUNT, wxPoint* LIST, long xoffset=0, long yoffset=0,
363 int fill_style=wxODDEVEN_RULE);
364 void DrawPoint(long x, long y);
365 void DrawRectangle(long x, long y, long width, long height);
366 void DrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle);
367 void DrawRoundedRectangle(long x, long y, long width, long height, long radius=20);
368 void DrawSpline(int LCOUNT, wxPoint* LIST);
369 void DrawText(const wxString& text, long x, long y);
373 void FloodFill(long x, long y, const wxColour& colour, int style=wxFLOOD_SURFACE);
374 wxBrush& GetBackground();
376 long GetCharHeight();
378 void GetClippingBox(long *OUTPUT, long *OUTPUT,
379 long *OUTPUT, long *OUTPUT);
381 int GetLogicalFunction();
383 bool GetOptimization();
386 %new wxColour* GetPixel(long x, long y) {
387 wxColour* wc = new wxColour();
388 self->GetPixel(x, y, wc);
392 %name(GetSizeTuple)void GetSize(int* OUTPUT, int* OUTPUT);
394 wxColour& GetTextBackground();
395 void GetTextExtent(const wxString& string, long *OUTPUT, long *OUTPUT);
396 %name(GetFullTextExtent)void GetTextExtent(const wxString& string,
397 long *OUTPUT, long *OUTPUT, long *OUTPUT, long* OUTPUT,
398 const wxFont* font = NULL);
399 wxColour& GetTextForeground();
400 long LogicalToDeviceX(long x);
401 long LogicalToDeviceXRel(long x);
402 long LogicalToDeviceY(long y);
403 long LogicalToDeviceYRel(long y);
409 void SetDeviceOrigin(long x, long y);
410 void SetBackground(const wxBrush& brush);
411 void SetBackgroundMode(int mode);
412 void SetClippingRegion(long x, long y, long width, long height);
413 void SetPalette(const wxPalette& colourMap);
414 void SetBrush(const wxBrush& brush);
415 void SetFont(const wxFont& font);
416 void SetLogicalFunction(int function);
417 void SetMapMode(int mode);
418 void SetOptimization(bool optimize);
419 void SetPen(const wxPen& pen);
420 void SetTextBackground(const wxColour& colour);
421 void SetTextForeground(const wxColour& colour);
422 void SetUserScale(double x_scale, double y_scale);
423 bool StartDoc(const wxString& message);
427 // Don't need this one anymore as wxWindows has one...
429 // // This one is my own creation...
430 // void DrawBitmap(wxBitmap& bitmap, long x, long y, bool swapPalette=TRUE) {
431 // wxMemoryDC* memDC = new wxMemoryDC;
432 // memDC->SelectObject(bitmap);
435 // self->SetPalette(*bitmap.GetPalette());
437 // self->Blit(x, y, bitmap.GetWidth(), bitmap.GetHeight(), memDC,
438 // 0, 0, self->GetLogicalFunction());
439 // memDC->SelectObject(wxNullBitmap);
444 void DrawBitmap(const wxBitmap& bitmap, long x, long y,
445 int useMask = FALSE);
450 //----------------------------------------------------------------------
452 class wxMemoryDC : public wxDC {
456 void SelectObject(const wxBitmap& bitmap);
459 %new wxMemoryDC* wxMemoryDCFromDC(wxDC* oldDC);
460 %{ // Alternate 'constructor'
461 wxMemoryDC* wxMemoryDCFromDC(wxDC* oldDC) {
462 return new wxMemoryDC(oldDC);
467 //---------------------------------------------------------------------------
469 class wxScreenDC : public wxDC {
473 bool StartDrawingOnTop(wxWindow* window);
474 %name(StartDrawingOnTopRect) bool StartDrawingOnTop(wxRect* rect = NULL);
475 bool EndDrawingOnTop();
478 //---------------------------------------------------------------------------
480 class wxClientDC : public wxDC {
482 wxClientDC(wxWindow* win);
485 //---------------------------------------------------------------------------
487 class wxPaintDC : public wxDC {
489 wxPaintDC(wxWindow* win);
492 //---------------------------------------------------------------------------
494 class wxWindowDC : public wxDC {
496 wxWindowDC(wxWindow* win);
499 //---------------------------------------------------------------------------
502 class wxPostScriptDC : public wxDC {
504 wxPostScriptDC(const wxString& output, bool interactive = TRUE, wxWindow* win = NULL);
508 //---------------------------------------------------------------------------
511 class wxPrinterDC : public wxDC {
513 wxPrinterDC(const wxString& driver, const wxString& device, const wxString& output,
514 bool interactive = TRUE, int orientation = wxPORTRAIT);
518 //---------------------------------------------------------------------------
521 class wxMetaFileDC : public wxDC {
523 wxMetaFileDC(const wxString& filename = wxPyEmptyStr);
528 //---------------------------------------------------------------------------
529 //---------------------------------------------------------------------------
536 extern wxFont *wxNORMAL_FONT;
537 extern wxFont *wxSMALL_FONT;
538 extern wxFont *wxITALIC_FONT;
539 extern wxFont *wxSWISS_FONT;
541 extern wxPen *wxRED_PEN;
542 extern wxPen *wxCYAN_PEN;
543 extern wxPen *wxGREEN_PEN;
544 extern wxPen *wxBLACK_PEN;
545 extern wxPen *wxWHITE_PEN;
546 extern wxPen *wxTRANSPARENT_PEN;
547 extern wxPen *wxBLACK_DASHED_PEN;
548 extern wxPen *wxGREY_PEN;
549 extern wxPen *wxMEDIUM_GREY_PEN;
550 extern wxPen *wxLIGHT_GREY_PEN;
552 extern wxBrush *wxBLUE_BRUSH;
553 extern wxBrush *wxGREEN_BRUSH;
554 extern wxBrush *wxWHITE_BRUSH;
555 extern wxBrush *wxBLACK_BRUSH;
556 extern wxBrush *wxTRANSPARENT_BRUSH;
557 extern wxBrush *wxCYAN_BRUSH;
558 extern wxBrush *wxRED_BRUSH;
559 extern wxBrush *wxGREY_BRUSH;
560 extern wxBrush *wxMEDIUM_GREY_BRUSH;
561 extern wxBrush *wxLIGHT_GREY_BRUSH;
563 extern wxColour *wxBLACK;
564 extern wxColour *wxWHITE;
565 extern wxColour *wxRED;
566 extern wxColour *wxBLUE;
567 extern wxColour *wxGREEN;
568 extern wxColour *wxCYAN;
569 extern wxColour *wxLIGHT_GREY;
571 extern wxCursor *wxSTANDARD_CURSOR;
572 extern wxCursor *wxHOURGLASS_CURSOR;
573 extern wxCursor *wxCROSS_CURSOR;
575 extern wxBitmap wxNullBitmap;
576 extern wxIcon wxNullIcon;
577 extern wxCursor wxNullCursor;
578 extern wxPen wxNullPen;
579 extern wxBrush wxNullBrush;
580 extern wxPalette wxNullPalette;
581 extern wxFont wxNullFont;
582 extern wxColour wxNullColour;
589 //---------------------------------------------------------------------------
593 wxPalette(int LCOUNT, byte* LIST, byte* LIST, byte* LIST);
596 int GetPixel(byte red, byte green, byte blue);
597 bool GetRGB(int pixel, byte* OUTPUT, byte* OUTPUT, byte* OUTPUT);
601 //---------------------------------------------------------------------------
604 wxIMAGELIST_DRAW_NORMAL ,
605 wxIMAGELIST_DRAW_TRANSPARENT,
606 wxIMAGELIST_DRAW_SELECTED,
607 wxIMAGELIST_DRAW_FOCUSED,
615 wxImageList(int width, int height, int mask=TRUE, int initialCount=1);
619 int Add(const wxBitmap& bitmap, const wxBitmap& mask = wxNullBitmap);
620 %name(AddWithColourMask)int Add(const wxBitmap& bitmap, const wxColour& maskColour);
621 %name(AddIcon)int Add(const wxIcon& icon);
622 bool Replace(int index, const wxBitmap& bitmap, const wxBitmap& mask = wxNullBitmap);
623 %name(ReplaceIcon)bool Replace(int index, const wxIcon& icon);
625 int Add(const wxBitmap& bitmap);
626 bool Replace(int index, const wxBitmap& bitmap);
629 bool Draw(int index, wxDC& dc, int x, int x, int flags = wxIMAGELIST_DRAW_NORMAL,
630 const bool solidBackground = FALSE);
633 bool Remove(int index);
638 //---------------------------------------------------------------------------