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>
21 //----------------------------------------------------------------------
24 %include my_typemaps.i
26 // Import some definitions of other classes, etc.
30 //---------------------------------------------------------------------------
34 wxBitmap(const wxString& name, long type);
38 void Create(int width, int height, int depth = -1);
42 wxPalette* GetPalette();
45 bool LoadFile(const wxString& name, long flags);
47 bool SaveFile(const wxString& name, int type, wxPalette* palette = NULL);
48 void SetDepth(int depth);
49 void SetHeight(int height);
50 void SetMask(wxMask* mask);
52 void SetPalette(wxPalette* palette);
54 void SetWidth(int width);
57 %new wxBitmap* wxEmptyBitmap(int width, int height, int depth=-1);
58 wxBitmap* wxNoRefBitmap(char* name, long flags);
59 %{ // Alternate 'constructor'
60 wxBitmap* wxEmptyBitmap(int width, int height, int depth=-1) {
61 return new wxBitmap(width, height, depth);
64 // This one won't own the reference, so Python won't call
65 // the dtor, this is good for toolbars and such where
66 // the parent will manage the bitmap.
67 wxBitmap* wxNoRefBitmap(char* name, long flags) {
68 return new wxBitmap(name, flags);
72 //---------------------------------------------------------------------------
76 wxMask(const wxBitmap& bitmap);
80 %new wxMask* wxMaskColour(const wxBitmap& bitmap, const wxColour& colour);
82 wxMask* wxMaskColour(const wxBitmap& bitmap, const wxColour& colour) {
83 return new wxMask(bitmap, colour);
88 //---------------------------------------------------------------------------
91 class wxIcon : public wxBitmap {
94 wxIcon(const wxString& name, long flags,
95 int desiredWidth = -1, int desiredHeight = -1);
102 bool LoadFile(const wxString& name, long flags);
104 void SetDepth(int depth);
105 void SetHeight(int height);
106 void SetWidth(int width);
109 //---------------------------------------------------------------------------
111 class wxCursor : public wxBitmap {
114 wxCursor(const wxString& cursorName, long flags, int hotSpotX=0, int hotSpotY=0);
120 %new wxCursor* wxStockCursor(int id);
121 %{ // Alternate 'constructor'
122 wxCursor* wxStockCursor(int id) {
123 return new wxCursor(id);
127 //----------------------------------------------------------------------
131 // I'll do it this way to use long-lived objects and not have to
132 // worry about when python may delete the object.
134 wxFont( int pointSize, int family, int style, int weight,
135 int underline=FALSE, char* faceName = "") {
137 return wxTheFontList->FindOrCreateFont(pointSize, family, style, weight,
138 underline, faceName);
144 wxString GetFaceName();
149 bool GetUnderlined();
152 void SetFaceName(const wxString& faceName);
153 void SetFamily(int family);
154 void SetPointSize(int pointSize);
155 void SetStyle(int style);
156 void SetUnderlined(bool underlined);
157 void SetWeight(int weight);
161 //----------------------------------------------------------------------
165 wxColour(unsigned char red=0, unsigned char green=0, unsigned char blue=0);
168 unsigned char Green();
169 unsigned char Blue();
171 void Set(unsigned char red, unsigned char green, unsigned char blue);
174 PyObject* rv = PyTuple_New(3);
175 PyTuple_SetItem(rv, 0, PyInt_FromLong(self->Red()));
176 PyTuple_SetItem(rv, 1, PyInt_FromLong(self->Green()));
177 PyTuple_SetItem(rv, 2, PyInt_FromLong(self->Blue()));
183 %new wxColour* wxNamedColour(const wxString& colorName);
184 %{ // Alternate 'constructor'
185 wxColour* wxNamedColour(const wxString& colorName) {
186 return new wxColour(colorName);
191 //----------------------------------------------------------------------
193 typedef unsigned long wxDash;
197 // I'll do it this way to use long-lived objects and not have to
198 // worry about when python may delete the object.
200 wxPen(wxColour* colour, int width=1, int style=wxSOLID) {
201 return wxThePenList->FindOrCreatePen(*colour, width, style);
207 wxColour& GetColour();
210 // **** This one needs to return a list of ints (wxDash)
211 int GetDashes(wxDash **dashes);
212 wxBitmap* GetStipple();
218 void SetCap(int cap_style);
219 void SetColour(wxColour& colour);
221 void SetDashes(int LCOUNT, wxDash* LIST);
222 void SetStipple(wxBitmap * stipple);
224 void SetJoin(int join_style);
225 void SetStyle(int style);
226 void SetWidth(int width);
229 //----------------------------------------------------------------------
233 // I'll do it this way to use long-lived objects and not have to
234 // worry about when python may delete the object.
236 wxBrush(wxColour* colour, int style=wxSOLID) {
237 return wxTheBrushList->FindOrCreateBrush(*colour, style);
242 wxColour& GetColour();
243 wxBitmap * GetStipple();
247 void SetColour(wxColour &colour);
248 void SetStipple(wxBitmap *bitmap);
249 void SetStyle(int style);
253 //----------------------------------------------------------------------
259 // wxDC(); **** abstract base class, can't instantiate.
263 bool Blit(long xdest, long ydest, long width, long height,
264 wxDC *source, long xsrc, long ysrc, long logical_func);
266 void CrossHair(long x, long y);
267 void DestroyClippingRegion();
268 long DeviceToLogicalX(long x);
269 long DeviceToLogicalXRel(long x);
270 long DeviceToLogicalY(long y);
271 long DeviceToLogicalYRel(long y);
272 void DrawArc(long x1, long y1, long x2, long y2, long xc, long yc);
273 void DrawEllipse(long x, long y, long width, long height);
274 void DrawEllipticArc(long x, long y, long width, long height, long start, long end);
275 void DrawIcon(const wxIcon& icon, long x, long y);
276 void DrawLine(long x1, long y1, long x2, long y2);
277 void DrawLines(int LCOUNT, wxPoint* LIST, long xoffset=0, long yoffset=0);
278 void DrawPolygon(int LCOUNT, wxPoint* LIST, long xoffset=0, long yoffset=0,
279 int fill_style=wxODDEVEN_RULE);
280 void DrawPoint(long x, long y);
281 void DrawRectangle(long x, long y, long width, long height);
282 void DrawRoundedRectangle(long x, long y, long width, long height, long radius=20);
283 void DrawSpline(int LCOUNT, wxPoint* LIST);
284 void DrawText(const wxString& text, long x, long y);
289 void FloodFill(long x, long y, const wxColour& colour, int style=wxFLOOD_SURFACE);
292 void FloodFill(long x, long y, wxColour* colour, int style=wxFLOOD_SURFACE);
294 wxBrush * GetBackground();
295 wxBrush * GetBrush();
296 long GetCharHeight();
298 void GetClippingBox(long *OUTPUT, long *OUTPUT,
299 long *OUTPUT, long *OUTPUT);
301 int GetLogicalFunction();
303 bool GetOptimization();
306 %new wxColour* GetPixel(long x, long y) {
307 wxColour* wc = new wxColour();
308 self->GetPixel(x, y, wc);
312 void GetSize(int* OUTPUT, int* OUTPUT); //void GetSize(long* OUTPUT, long* OUTPUT);
313 wxColour& GetTextBackground();
314 void GetTextExtent(const wxString& string, long *OUTPUT, long *OUTPUT,
315 long *OUTPUT, long *OUTPUT);
316 wxColour& GetTextForeground();
317 long LogicalToDeviceX(long x);
318 long LogicalToDeviceXRel(long x);
319 long LogicalToDeviceY(long y);
320 long LogicalToDeviceYRel(long y);
326 void SetDeviceOrigin(long x, long y);
327 void SetBackground(const wxBrush& brush);
328 void SetBackgroundMode(int mode);
329 void SetClippingRegion(long x, long y, long width, long height);
330 void SetPalette(const wxPalette& colourMap);
331 void SetBrush(const wxBrush& brush);
332 void SetFont(const wxFont& font);
333 void SetLogicalFunction(int function);
334 void SetMapMode(int mode);
335 void SetOptimization(bool optimize);
336 void SetPen(const wxPen& pen);
337 void SetTextBackground(const wxColour& colour);
338 void SetTextForeground(const wxColour& colour);
339 void SetUserScale(double x_scale, double y_scale);
340 bool StartDoc(const wxString& message);
345 // This one is my own creation...
346 void DrawBitmap(wxBitmap* bitmap, long x, long y, bool swapPalette=TRUE) {
347 wxMemoryDC* memDC = new wxMemoryDC;
348 memDC->SelectObject(bitmap);
350 self->SetPalette(bitmap->GetPalette());
351 self->Blit(x, y, bitmap->GetWidth(), bitmap->GetHeight(), memDC,
352 0, 0, self->GetLogicalFunction());
353 memDC->SelectObject(wxNullBitmap);
360 //----------------------------------------------------------------------
362 class wxMemoryDC : public wxDC {
366 void SelectObject(const wxBitmap& bitmap);
369 %new wxMemoryDC* wxMemoryDCFromDC(wxDC* oldDC);
370 %{ // Alternate 'constructor'
371 wxMemoryDC* wxMemoryDCFromDC(wxDC* oldDC) {
372 return new wxMemoryDC(oldDC);
377 //---------------------------------------------------------------------------
379 class wxScreenDC : public wxDC {
383 bool StartDrawingOnTop(wxWindow* window);
384 %name(StartDrawingOnTopRect) bool StartDrawingOnTop(wxRect* rect = NULL);
385 bool EndDrawingOnTop();
388 //---------------------------------------------------------------------------
390 class wxClientDC : public wxDC {
392 wxClientDC(wxWindow* win);
395 //---------------------------------------------------------------------------
397 class wxPaintDC : public wxDC {
399 wxPaintDC(wxWindow* win);
402 //---------------------------------------------------------------------------
404 class wxPostScriptDC : public wxDC {
406 wxPostScriptDC(const wxString& output, bool interactive = TRUE, wxWindow* win = NULL);
409 //---------------------------------------------------------------------------
412 class wxPrinterDC : public wxDC {
414 wxPrinterDC(const wxString& driver, const wxString& device, const wxString& output,
415 bool interactive = TRUE, int orientation = wxPORTRAIT);
419 //---------------------------------------------------------------------------
422 class wxMetaFileDC : public wxDC {
424 wxMetaFileDC(const wxString& filename = wxPyEmptyStr);
429 //---------------------------------------------------------------------------
430 //---------------------------------------------------------------------------
434 extern wxFont *wxNORMAL_FONT;
435 extern wxFont *wxSMALL_FONT;
436 extern wxFont *wxITALIC_FONT;
437 extern wxFont *wxSWISS_FONT;
438 extern wxPen *wxRED_PEN;
440 extern wxPen *wxCYAN_PEN;
441 extern wxPen *wxGREEN_PEN;
442 extern wxPen *wxBLACK_PEN;
443 extern wxPen *wxWHITE_PEN;
444 extern wxPen *wxTRANSPARENT_PEN;
445 extern wxPen *wxBLACK_DASHED_PEN;
446 extern wxPen *wxGREY_PEN;
447 extern wxPen *wxMEDIUM_GREY_PEN;
448 extern wxPen *wxLIGHT_GREY_PEN;
450 extern wxBrush *wxBLUE_BRUSH;
451 extern wxBrush *wxGREEN_BRUSH;
452 extern wxBrush *wxWHITE_BRUSH;
453 extern wxBrush *wxBLACK_BRUSH;
454 extern wxBrush *wxTRANSPARENT_BRUSH;
455 extern wxBrush *wxCYAN_BRUSH;
456 extern wxBrush *wxRED_BRUSH;
457 extern wxBrush *wxGREY_BRUSH;
458 extern wxBrush *wxMEDIUM_GREY_BRUSH;
459 extern wxBrush *wxLIGHT_GREY_BRUSH;
461 extern wxColour *wxBLACK;
462 extern wxColour *wxWHITE;
463 extern wxColour *wxRED;
464 extern wxColour *wxBLUE;
465 extern wxColour *wxGREEN;
466 extern wxColour *wxCYAN;
467 extern wxColour *wxLIGHT_GREY;
469 extern wxCursor *wxSTANDARD_CURSOR;
470 extern wxCursor *wxHOURGLASS_CURSOR;
471 extern wxCursor *wxCROSS_CURSOR;
473 extern wxBitmap wxNullBitmap;
474 extern wxIcon wxNullIcon;
475 extern wxCursor wxNullCursor;
476 extern wxPen wxNullPen;
477 extern wxBrush wxNullBrush;
478 extern wxPalette wxNullPalette;
479 extern wxFont wxNullFont;
480 extern wxColour wxNullColour;
482 //---------------------------------------------------------------------------
484 /////////////////////////////////////////////////////////////////////////////
487 // Revision 1.3 1998/08/18 19:48:16 RD
488 // more wxGTK compatibility things.
490 // It builds now but there are serious runtime problems...
492 // Revision 1.2 1998/08/15 07:36:35 RD
493 // - Moved the header in the .i files out of the code that gets put into
494 // the .cpp files. It caused CVS conflicts because of the RCS ID being
495 // different each time.
497 // - A few minor fixes.
499 // Revision 1.1 1998/08/09 08:25:50 RD