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>
20 #include <wx/postscrp.h>
24 //----------------------------------------------------------------------
27 %include my_typemaps.i
29 // Import some definitions of other classes, etc.
33 //---------------------------------------------------------------------------
37 wxBitmap(const wxString& name, long type);
41 void Create(int width, int height, int depth = -1);
45 wxPalette* GetPalette();
48 bool LoadFile(const wxString& name, long flags);
50 bool SaveFile(const wxString& name, int type, wxPalette* palette = NULL);
51 void SetDepth(int depth);
52 void SetHeight(int height);
53 void SetMask(wxMask* mask);
55 void SetPalette(wxPalette& palette);
57 void SetWidth(int width);
60 %new wxBitmap* wxEmptyBitmap(int width, int height, int depth=-1);
61 wxBitmap* wxNoRefBitmap(char* name, long flags);
63 %{ // Alternate 'constructor'
64 wxBitmap* wxEmptyBitmap(int width, int height, int depth=-1) {
65 return new wxBitmap(width, height, depth);
68 // This one won't own the reference, so Python won't call
69 // the dtor, this is good for toolbars and such where
70 // the parent will manage the bitmap.
71 wxBitmap* wxNoRefBitmap(char* name, long flags) {
72 return new wxBitmap(name, flags);
76 //---------------------------------------------------------------------------
80 wxMask(const wxBitmap& bitmap);
84 %new wxMask* wxMaskColour(const wxBitmap& bitmap, const wxColour& colour);
86 wxMask* wxMaskColour(const wxBitmap& bitmap, const wxColour& colour) {
87 return new wxMask(bitmap, colour);
92 //---------------------------------------------------------------------------
95 class wxIcon : public wxBitmap {
98 wxIcon(const wxString& name, long flags,
99 int desiredWidth = -1, int desiredHeight = -1);
106 bool LoadFile(const wxString& name, long flags);
108 void SetDepth(int depth);
109 void SetHeight(int height);
110 void SetWidth(int width);
113 //---------------------------------------------------------------------------
115 class wxCursor : public wxBitmap {
118 wxCursor(const wxString& cursorName, long flags, int hotSpotX=0, int hotSpotY=0);
124 %name(wxStockCursor) %new wxCursor* wxPyStockCursor(int id);
125 %{ // Alternate 'constructor'
126 wxCursor* wxPyStockCursor(int id) {
127 return new wxCursor(id);
131 //----------------------------------------------------------------------
135 // I'll do it this way to use long-lived objects and not have to
136 // worry about when python may delete the object.
138 wxFont( int pointSize, int family, int style, int weight,
139 int underline=FALSE, char* faceName = "") {
141 return wxTheFontList->FindOrCreateFont(pointSize, family, style, weight,
142 underline, faceName);
148 wxString GetFaceName();
153 bool GetUnderlined();
155 void SetFaceName(const wxString& faceName);
156 void SetFamily(int family);
157 void SetPointSize(int pointSize);
158 void SetStyle(int style);
159 void SetUnderlined(bool underlined);
160 void SetWeight(int weight);
163 //----------------------------------------------------------------------
167 wxColour(unsigned char red=0, unsigned char green=0, unsigned char blue=0);
170 unsigned char Green();
171 unsigned char Blue();
173 void Set(unsigned char red, unsigned char green, unsigned char blue);
176 PyObject* rv = PyTuple_New(3);
177 PyTuple_SetItem(rv, 0, PyInt_FromLong(self->Red()));
178 PyTuple_SetItem(rv, 1, PyInt_FromLong(self->Green()));
179 PyTuple_SetItem(rv, 2, PyInt_FromLong(self->Blue()));
185 %new wxColour* wxNamedColour(const wxString& colorName);
186 %{ // Alternate 'constructor'
187 wxColour* wxNamedColour(const wxString& colorName) {
188 return new wxColour(colorName);
193 //----------------------------------------------------------------------
195 typedef unsigned long wxDash;
199 // I'll do it this way to use long-lived objects and not have to
200 // worry about when python may delete the object.
202 wxPen(wxColour* colour, int width=1, int style=wxSOLID) {
203 return wxThePenList->FindOrCreatePen(*colour, width, style);
209 wxColour& GetColour();
215 void SetCap(int cap_style);
216 void SetColour(wxColour& colour);
217 void SetJoin(int join_style);
218 void SetStyle(int style);
219 void SetWidth(int width);
222 // **** This one needs to return a list of ints (wxDash)
223 int GetDashes(wxDash **dashes);
224 wxBitmap* GetStipple();
225 void SetDashes(int LCOUNT, wxDash* LIST);
226 void SetStipple(wxBitmap& stipple);
230 //----------------------------------------------------------------------
234 // I'll do it this way to use long-lived objects and not have to
235 // worry about when python may delete the object.
237 wxBrush(wxColour* colour, int style=wxSOLID) {
238 return wxTheBrushList->FindOrCreateBrush(*colour, style);
243 wxColour& GetColour();
244 wxBitmap * GetStipple();
247 void SetColour(wxColour &colour);
248 void SetStipple(wxBitmap& bitmap);
249 void SetStyle(int style);
252 //----------------------------------------------------------------------
258 // wxDC(); **** abstract base class, can't instantiate.
262 bool Blit(long xdest, long ydest, long width, long height,
263 wxDC *source, long xsrc, long ysrc, long logical_func);
265 void CrossHair(long x, long y);
266 void DestroyClippingRegion();
267 long DeviceToLogicalX(long x);
268 long DeviceToLogicalXRel(long x);
269 long DeviceToLogicalY(long y);
270 long DeviceToLogicalYRel(long y);
271 void DrawArc(long x1, long y1, long x2, long y2, long xc, long yc);
272 void DrawEllipse(long x, long y, long width, long height);
273 void DrawEllipticArc(long x, long y, long width, long height, long start, long end);
274 void DrawIcon(const wxIcon& icon, long x, long y);
275 void DrawLine(long x1, long y1, long x2, long y2);
276 void DrawLines(int LCOUNT, wxPoint* LIST, long xoffset=0, long yoffset=0);
277 void DrawPolygon(int LCOUNT, wxPoint* LIST, long xoffset=0, long yoffset=0,
278 int fill_style=wxODDEVEN_RULE);
279 void DrawPoint(long x, long y);
280 void DrawRectangle(long x, long y, long width, long height);
281 void DrawRoundedRectangle(long x, long y, long width, long height, long radius=20);
282 void DrawSpline(int LCOUNT, wxPoint* LIST);
283 void DrawText(const wxString& text, long x, long y);
287 void FloodFill(long x, long y, const wxColour& colour, int style=wxFLOOD_SURFACE);
288 wxBrush& GetBackground();
290 long GetCharHeight();
292 void GetClippingBox(long *OUTPUT, long *OUTPUT,
293 long *OUTPUT, long *OUTPUT);
295 int GetLogicalFunction();
297 bool GetOptimization();
300 %new wxColour* GetPixel(long x, long y) {
301 wxColour* wc = new wxColour();
302 self->GetPixel(x, y, wc);
306 void GetSize(int* OUTPUT, int* OUTPUT); //void GetSize(long* OUTPUT, long* OUTPUT);
307 wxColour& GetTextBackground();
308 void GetTextExtent(const wxString& string, long *OUTPUT, long *OUTPUT,
309 long *OUTPUT, long *OUTPUT);
310 wxColour& GetTextForeground();
311 long LogicalToDeviceX(long x);
312 long LogicalToDeviceXRel(long x);
313 long LogicalToDeviceY(long y);
314 long LogicalToDeviceYRel(long y);
320 void SetDeviceOrigin(long x, long y);
321 void SetBackground(const wxBrush& brush);
322 void SetBackgroundMode(int mode);
323 void SetClippingRegion(long x, long y, long width, long height);
324 void SetPalette(const wxPalette& colourMap);
325 void SetBrush(const wxBrush& brush);
326 void SetFont(const wxFont& font);
327 void SetLogicalFunction(int function);
328 void SetMapMode(int mode);
329 void SetOptimization(bool optimize);
330 void SetPen(const wxPen& pen);
331 void SetTextBackground(const wxColour& colour);
332 void SetTextForeground(const wxColour& colour);
333 void SetUserScale(double x_scale, double y_scale);
334 bool StartDoc(const wxString& message);
339 // This one is my own creation...
340 void DrawBitmap(wxBitmap& bitmap, long x, long y, bool swapPalette=TRUE) {
341 wxMemoryDC* memDC = new wxMemoryDC;
342 memDC->SelectObject(bitmap);
344 self->SetPalette(*bitmap.GetPalette());
345 self->Blit(x, y, bitmap.GetWidth(), bitmap.GetHeight(), memDC,
346 0, 0, self->GetLogicalFunction());
347 memDC->SelectObject(wxNullBitmap);
354 //----------------------------------------------------------------------
356 class wxMemoryDC : public wxDC {
360 void SelectObject(const wxBitmap& bitmap);
363 %new wxMemoryDC* wxMemoryDCFromDC(wxDC* oldDC);
364 %{ // Alternate 'constructor'
365 wxMemoryDC* wxMemoryDCFromDC(wxDC* oldDC) {
366 return new wxMemoryDC(oldDC);
371 //---------------------------------------------------------------------------
373 class wxScreenDC : public wxDC {
377 bool StartDrawingOnTop(wxWindow* window);
378 %name(StartDrawingOnTopRect) bool StartDrawingOnTop(wxRect* rect = NULL);
379 bool EndDrawingOnTop();
382 //---------------------------------------------------------------------------
384 class wxClientDC : public wxDC {
386 wxClientDC(wxWindow* win);
389 //---------------------------------------------------------------------------
391 class wxPaintDC : public wxDC {
393 wxPaintDC(wxWindow* win);
396 //---------------------------------------------------------------------------
398 class wxWindowDC : public wxDC {
400 wxWindowDC(wxWindow* win);
403 //---------------------------------------------------------------------------
406 class wxPostScriptDC : public wxDC {
408 wxPostScriptDC(const wxString& output, bool interactive = TRUE, wxWindow* win = NULL);
412 //---------------------------------------------------------------------------
415 class wxPrinterDC : public wxDC {
417 wxPrinterDC(const wxString& driver, const wxString& device, const wxString& output,
418 bool interactive = TRUE, int orientation = wxPORTRAIT);
422 //---------------------------------------------------------------------------
425 class wxMetaFileDC : public wxDC {
427 wxMetaFileDC(const wxString& filename = wxPyEmptyStr);
432 //---------------------------------------------------------------------------
433 //---------------------------------------------------------------------------
437 extern wxFont *wxNORMAL_FONT;
438 extern wxFont *wxSMALL_FONT;
439 extern wxFont *wxITALIC_FONT;
440 extern wxFont *wxSWISS_FONT;
441 extern wxPen *wxRED_PEN;
443 extern wxPen *wxCYAN_PEN;
444 extern wxPen *wxGREEN_PEN;
445 extern wxPen *wxBLACK_PEN;
446 extern wxPen *wxWHITE_PEN;
447 extern wxPen *wxTRANSPARENT_PEN;
448 extern wxPen *wxBLACK_DASHED_PEN;
449 extern wxPen *wxGREY_PEN;
450 extern wxPen *wxMEDIUM_GREY_PEN;
451 extern wxPen *wxLIGHT_GREY_PEN;
453 extern wxBrush *wxBLUE_BRUSH;
454 extern wxBrush *wxGREEN_BRUSH;
455 extern wxBrush *wxWHITE_BRUSH;
456 extern wxBrush *wxBLACK_BRUSH;
457 extern wxBrush *wxTRANSPARENT_BRUSH;
458 extern wxBrush *wxCYAN_BRUSH;
459 extern wxBrush *wxRED_BRUSH;
460 extern wxBrush *wxGREY_BRUSH;
461 extern wxBrush *wxMEDIUM_GREY_BRUSH;
462 extern wxBrush *wxLIGHT_GREY_BRUSH;
464 extern wxColour *wxBLACK;
465 extern wxColour *wxWHITE;
466 extern wxColour *wxRED;
467 extern wxColour *wxBLUE;
468 extern wxColour *wxGREEN;
469 extern wxColour *wxCYAN;
470 extern wxColour *wxLIGHT_GREY;
472 extern wxCursor *wxSTANDARD_CURSOR;
473 extern wxCursor *wxHOURGLASS_CURSOR;
474 extern wxCursor *wxCROSS_CURSOR;
476 extern wxBitmap wxNullBitmap;
477 extern wxIcon wxNullIcon;
478 extern wxCursor wxNullCursor;
479 extern wxPen wxNullPen;
480 extern wxBrush wxNullBrush;
481 extern wxPalette wxNullPalette;
482 extern wxFont wxNullFont;
483 extern wxColour wxNullColour;
485 //---------------------------------------------------------------------------
489 wxPalette(int LCOUNT, byte* LIST, byte* LIST, byte* LIST);
492 int GetPixel(byte red, byte green, byte blue);
493 bool GetRGB(int pixel, byte* OUTPUT, byte* OUTPUT, byte* OUTPUT);
497 //---------------------------------------------------------------------------
500 //---------------------------------------------------------------------------
502 /////////////////////////////////////////////////////////////////////////////
505 // Revision 1.11 1998/12/18 15:49:05 RR
506 // wxClipboard now serves the primary selection as well
510 // Revision 1.10 1998/12/17 18:05:50 RD
513 // Minor fixes and SWIG code generation for RR's changes. MSW and GTK
514 // versions are much closer now!
516 // Revision 1.9 1998/12/17 14:07:37 RR
518 // Removed minor differences between wxMSW and wxGTK
520 // Revision 1.8 1998/12/16 22:10:54 RD
522 // Tweaks needed to be able to build wxPython with wxGTK.
524 // Revision 1.7 1998/12/15 20:41:18 RD
525 // Changed the import semantics from "from wxPython import *" to "from
526 // wxPython.wx import *" This is for people who are worried about
527 // namespace pollution, they can use "from wxPython import wx" and then
528 // prefix all the wxPython identifiers with "wx."
530 // Added wxTaskbarIcon for wxMSW.
532 // Made the events work for wxGrid.
536 // Added wxMiniFrame for wxGTK, (untested.)
538 // Changed many of the args and return values that were pointers to gdi
539 // objects to references to reflect changes in the wxWindows API.
541 // Other assorted fixes and additions.
543 // Revision 1.6 1998/11/25 08:45:24 RD
545 // Added wxPalette, wxRegion, wxRegionIterator, wxTaskbarIcon
546 // Added events for wxGrid
547 // Other various fixes and additions
549 // Revision 1.5 1998/10/20 06:43:57 RD
550 // New wxTreeCtrl wrappers (untested)
551 // some changes in helpers
554 // Revision 1.4 1998/10/02 06:40:38 RD
556 // Version 0.4 of wxPython for MSW.
558 // Revision 1.3 1998/08/18 19:48:16 RD
559 // more wxGTK compatibility things.
561 // It builds now but there are serious runtime problems...
563 // Revision 1.2 1998/08/15 07:36:35 RD
564 // - Moved the header in the .i files out of the code that gets put into
565 // the .cpp files. It caused CVS conflicts because of the RCS ID being
566 // different each time.
568 // - A few minor fixes.
570 // Revision 1.1 1998/08/09 08:25:50 RD