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 //---------------------------------------------------------------------------
38 wxBitmap(const wxString& name, long type);
42 void Create(int width, int height, int depth = -1);
46 wxPalette* GetPalette();
49 bool LoadFile(const wxString& name, long flags);
51 bool SaveFile(const wxString& name, int type, wxPalette* palette = NULL);
52 void SetDepth(int depth);
53 void SetHeight(int height);
54 void SetMask(wxMask* mask);
56 void SetPalette(wxPalette& palette);
58 void SetWidth(int width);
61 %new wxBitmap* wxEmptyBitmap(int width, int height, int depth=-1);
62 wxBitmap* wxNoRefBitmap(char* name, long flags);
64 %{ // Alternate 'constructor'
65 wxBitmap* wxEmptyBitmap(int width, int height, int depth=-1) {
66 return new wxBitmap(width, height, depth);
69 // This one won't own the reference, so Python
70 // won't call the dtor, this is good for
71 // toolbars and such where the parent will
73 wxBitmap* wxNoRefBitmap(char* name, long flags) {
74 return new wxBitmap(name, flags);
78 //---------------------------------------------------------------------------
82 wxMask(const wxBitmap& bitmap);
86 %new wxMask* wxMaskColour(const wxBitmap& bitmap, const wxColour& colour);
88 wxMask* wxMaskColour(const wxBitmap& bitmap, const wxColour& colour) {
89 return new wxMask(bitmap, colour);
94 //---------------------------------------------------------------------------
97 class wxIcon : public wxBitmap {
100 wxIcon(const wxString& name, long flags,
101 int desiredWidth = -1, int desiredHeight = -1);
108 bool LoadFile(const wxString& name, long flags);
110 void SetDepth(int depth);
111 void SetHeight(int height);
112 void SetWidth(int width);
115 //---------------------------------------------------------------------------
117 class wxCursor : public wxBitmap {
120 wxCursor(const wxString& cursorName, long flags, int hotSpotX=0, int hotSpotY=0);
126 %name(wxStockCursor) %new wxCursor* wxPyStockCursor(int id);
127 %{ // Alternate 'constructor'
128 wxCursor* wxPyStockCursor(int id) {
129 return new wxCursor(id);
133 //----------------------------------------------------------------------
137 // I'll do it this way to use long-lived objects and not have to
138 // worry about when python may delete the object.
140 wxFont( int pointSize, int family, int style, int weight,
141 int underline=FALSE, char* faceName = "") {
143 return wxTheFontList->FindOrCreateFont(pointSize, family, style, weight,
144 underline, faceName);
150 wxString GetFaceName();
157 bool GetUnderlined();
159 void SetFaceName(const wxString& faceName);
160 void SetFamily(int family);
161 void SetPointSize(int pointSize);
162 void SetStyle(int style);
163 void SetUnderlined(bool underlined);
164 void SetWeight(int weight);
167 //----------------------------------------------------------------------
171 wxColour(unsigned char red=0, unsigned char green=0, unsigned char blue=0);
174 unsigned char Green();
175 unsigned char Blue();
177 void Set(unsigned char red, unsigned char green, unsigned char blue);
180 PyObject* rv = PyTuple_New(3);
181 PyTuple_SetItem(rv, 0, PyInt_FromLong(self->Red()));
182 PyTuple_SetItem(rv, 1, PyInt_FromLong(self->Green()));
183 PyTuple_SetItem(rv, 2, PyInt_FromLong(self->Blue()));
189 %new wxColour* wxNamedColour(const wxString& colorName);
190 %{ // Alternate 'constructor'
191 wxColour* wxNamedColour(const wxString& colorName) {
192 return new wxColour(colorName);
197 //----------------------------------------------------------------------
199 typedef unsigned long wxDash;
203 // I'll do it this way to use long-lived objects and not have to
204 // worry about when python may delete the object.
206 wxPen(wxColour* colour, int width=1, int style=wxSOLID) {
207 return wxThePenList->FindOrCreatePen(*colour, width, style);
213 wxColour& GetColour();
219 void SetCap(int cap_style);
220 void SetColour(wxColour& colour);
221 void SetJoin(int join_style);
222 void SetStyle(int style);
223 void SetWidth(int width);
226 // **** This one needs to return a list of ints (wxDash)
227 int GetDashes(wxDash **dashes);
228 wxBitmap* GetStipple();
229 void SetDashes(int LCOUNT, wxDash* LIST);
230 void SetStipple(wxBitmap& stipple);
234 //----------------------------------------------------------------------
238 // I'll do it this way to use long-lived objects and not have to
239 // worry about when python may delete the object.
241 wxBrush(wxColour* colour, int style=wxSOLID) {
242 return wxTheBrushList->FindOrCreateBrush(*colour, style);
247 wxColour& GetColour();
248 wxBitmap * GetStipple();
251 void SetColour(wxColour &colour);
252 void SetStipple(wxBitmap& bitmap);
253 void SetStyle(int style);
256 //----------------------------------------------------------------------
262 // wxDC(); **** abstract base class, can't instantiate.
266 bool Blit(long xdest, long ydest, long width, long height,
267 wxDC *source, long xsrc, long ysrc, long logical_func);
269 void CrossHair(long x, long y);
270 void DestroyClippingRegion();
271 long DeviceToLogicalX(long x);
272 long DeviceToLogicalXRel(long x);
273 long DeviceToLogicalY(long y);
274 long DeviceToLogicalYRel(long y);
275 void DrawArc(long x1, long y1, long x2, long y2, long xc, long yc);
276 void DrawCircle(long x, long y, long radius);
277 void DrawEllipse(long x, long y, long width, long height);
278 void DrawEllipticArc(long x, long y, long width, long height, long start, long end);
279 void DrawIcon(const wxIcon& icon, long x, long y);
280 void DrawLine(long x1, long y1, long x2, long y2);
281 void DrawLines(int LCOUNT, wxPoint* LIST, long xoffset=0, long yoffset=0);
282 void DrawPolygon(int LCOUNT, wxPoint* LIST, long xoffset=0, long yoffset=0,
283 int fill_style=wxODDEVEN_RULE);
284 void DrawPoint(long x, long y);
285 void DrawRectangle(long x, long y, long width, long height);
286 void DrawRoundedRectangle(long x, long y, long width, long height, long radius=20);
287 void DrawSpline(int LCOUNT, wxPoint* LIST);
288 void DrawText(const wxString& text, long x, long y);
292 void FloodFill(long x, long y, const wxColour& colour, int style=wxFLOOD_SURFACE);
293 wxBrush& GetBackground();
295 long GetCharHeight();
297 void GetClippingBox(long *OUTPUT, long *OUTPUT,
298 long *OUTPUT, long *OUTPUT);
300 int GetLogicalFunction();
302 bool GetOptimization();
305 %new wxColour* GetPixel(long x, long y) {
306 wxColour* wc = new wxColour();
307 self->GetPixel(x, y, wc);
311 %name(GetSizeTuple)void GetSize(int* OUTPUT, int* OUTPUT);
313 wxColour& GetTextBackground();
314 void GetTextExtent(const wxString& string, long *OUTPUT, long *OUTPUT);
315 %name(GetFullTextExtent)void GetTextExtent(const wxString& string,
316 long *OUTPUT, long *OUTPUT, long *OUTPUT, long* OUTPUT,
317 const wxFont* font = NULL);
318 wxColour& GetTextForeground();
319 long LogicalToDeviceX(long x);
320 long LogicalToDeviceXRel(long x);
321 long LogicalToDeviceY(long y);
322 long LogicalToDeviceYRel(long y);
328 void SetDeviceOrigin(long x, long y);
329 void SetBackground(const wxBrush& brush);
330 void SetBackgroundMode(int mode);
331 void SetClippingRegion(long x, long y, long width, long height);
332 void SetPalette(const wxPalette& colourMap);
333 void SetBrush(const wxBrush& brush);
334 void SetFont(const wxFont& font);
335 void SetLogicalFunction(int function);
336 void SetMapMode(int mode);
337 void SetOptimization(bool optimize);
338 void SetPen(const wxPen& pen);
339 void SetTextBackground(const wxColour& colour);
340 void SetTextForeground(const wxColour& colour);
341 void SetUserScale(double x_scale, double y_scale);
342 bool StartDoc(const wxString& message);
347 // This one is my own creation...
348 void DrawBitmap(wxBitmap& bitmap, long x, long y, bool swapPalette=TRUE) {
349 wxMemoryDC* memDC = new wxMemoryDC;
350 memDC->SelectObject(bitmap);
352 self->SetPalette(*bitmap.GetPalette());
353 self->Blit(x, y, bitmap.GetWidth(), bitmap.GetHeight(), memDC,
354 0, 0, self->GetLogicalFunction());
355 memDC->SelectObject(wxNullBitmap);
362 //----------------------------------------------------------------------
364 class wxMemoryDC : public wxDC {
368 void SelectObject(const wxBitmap& bitmap);
371 %new wxMemoryDC* wxMemoryDCFromDC(wxDC* oldDC);
372 %{ // Alternate 'constructor'
373 wxMemoryDC* wxMemoryDCFromDC(wxDC* oldDC) {
374 return new wxMemoryDC(oldDC);
379 //---------------------------------------------------------------------------
381 class wxScreenDC : public wxDC {
385 bool StartDrawingOnTop(wxWindow* window);
386 %name(StartDrawingOnTopRect) bool StartDrawingOnTop(wxRect* rect = NULL);
387 bool EndDrawingOnTop();
390 //---------------------------------------------------------------------------
392 class wxClientDC : public wxDC {
394 wxClientDC(wxWindow* win);
397 //---------------------------------------------------------------------------
399 class wxPaintDC : public wxDC {
401 wxPaintDC(wxWindow* win);
404 //---------------------------------------------------------------------------
406 class wxWindowDC : public wxDC {
408 wxWindowDC(wxWindow* win);
411 //---------------------------------------------------------------------------
414 class wxPostScriptDC : public wxDC {
416 wxPostScriptDC(const wxString& output, bool interactive = TRUE, wxWindow* win = NULL);
420 //---------------------------------------------------------------------------
423 class wxPrinterDC : public wxDC {
425 wxPrinterDC(const wxString& driver, const wxString& device, const wxString& output,
426 bool interactive = TRUE, int orientation = wxPORTRAIT);
430 //---------------------------------------------------------------------------
433 class wxMetaFileDC : public wxDC {
435 wxMetaFileDC(const wxString& filename = wxPyEmptyStr);
440 //---------------------------------------------------------------------------
441 //---------------------------------------------------------------------------
448 extern wxFont *wxNORMAL_FONT;
449 extern wxFont *wxSMALL_FONT;
450 extern wxFont *wxITALIC_FONT;
451 extern wxFont *wxSWISS_FONT;
452 extern wxPen *wxRED_PEN;
454 extern wxPen *wxCYAN_PEN;
455 extern wxPen *wxGREEN_PEN;
456 extern wxPen *wxBLACK_PEN;
457 extern wxPen *wxWHITE_PEN;
458 extern wxPen *wxTRANSPARENT_PEN;
459 extern wxPen *wxBLACK_DASHED_PEN;
460 extern wxPen *wxGREY_PEN;
461 extern wxPen *wxMEDIUM_GREY_PEN;
462 extern wxPen *wxLIGHT_GREY_PEN;
464 extern wxBrush *wxBLUE_BRUSH;
465 extern wxBrush *wxGREEN_BRUSH;
466 extern wxBrush *wxWHITE_BRUSH;
467 extern wxBrush *wxBLACK_BRUSH;
468 extern wxBrush *wxTRANSPARENT_BRUSH;
469 extern wxBrush *wxCYAN_BRUSH;
470 extern wxBrush *wxRED_BRUSH;
471 extern wxBrush *wxGREY_BRUSH;
472 extern wxBrush *wxMEDIUM_GREY_BRUSH;
473 extern wxBrush *wxLIGHT_GREY_BRUSH;
475 extern wxColour *wxBLACK;
476 extern wxColour *wxWHITE;
477 extern wxColour *wxRED;
478 extern wxColour *wxBLUE;
479 extern wxColour *wxGREEN;
480 extern wxColour *wxCYAN;
481 extern wxColour *wxLIGHT_GREY;
483 extern wxCursor *wxSTANDARD_CURSOR;
484 extern wxCursor *wxHOURGLASS_CURSOR;
485 extern wxCursor *wxCROSS_CURSOR;
487 extern wxBitmap wxNullBitmap;
488 extern wxIcon wxNullIcon;
489 extern wxCursor wxNullCursor;
490 extern wxPen wxNullPen;
491 extern wxBrush wxNullBrush;
492 extern wxPalette wxNullPalette;
493 extern wxFont wxNullFont;
494 extern wxColour wxNullColour;
501 //---------------------------------------------------------------------------
505 wxPalette(int LCOUNT, byte* LIST, byte* LIST, byte* LIST);
508 int GetPixel(byte red, byte green, byte blue);
509 bool GetRGB(int pixel, byte* OUTPUT, byte* OUTPUT, byte* OUTPUT);
513 //---------------------------------------------------------------------------
516 wxIMAGELIST_DRAW_NORMAL ,
517 wxIMAGELIST_DRAW_TRANSPARENT,
518 wxIMAGELIST_DRAW_SELECTED,
519 wxIMAGELIST_DRAW_FOCUSED,
527 wxImageList(int width, int height, const bool mask=TRUE, int initialCount=1);
531 int Add(const wxBitmap& bitmap, const wxBitmap& mask = wxNullBitmap);
532 %name(AddWithColourMask)int Add(const wxBitmap& bitmap, const wxColour& maskColour);
533 %name(AddIcon)int Add(const wxIcon& icon);
534 bool Replace(int index, const wxBitmap& bitmap, const wxBitmap& mask = wxNullBitmap);
535 %name(ReplaceIcon)bool Replace(int index, const wxIcon& icon);
537 int Add(const wxBitmap& bitmap);
538 bool Replace(int index, const wxBitmap& bitmap);
541 bool Draw(int index, wxDC& dc, int x, int x, int flags = wxIMAGELIST_DRAW_NORMAL,
542 const bool solidBackground = FALSE);
545 bool Remove(int index);
550 //---------------------------------------------------------------------------