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);
60 %{ // Alternate 'constructor'
61 wxBitmap* wxEmptyBitmap(int width, int height, int depth=-1) {
62 return new wxBitmap(width, height, depth);
65 // This one won't own the reference, so Python won't call
66 // the dtor, this is good for toolbars and such where
67 // the parent will manage the bitmap.
68 wxBitmap* wxNoRefBitmap(char* name, long flags) {
69 return new wxBitmap(name, flags);
73 //---------------------------------------------------------------------------
77 wxMask(const wxBitmap& bitmap);
81 %new wxMask* wxMaskColour(const wxBitmap& bitmap, const wxColour& colour);
83 wxMask* wxMaskColour(const wxBitmap& bitmap, const wxColour& colour) {
84 return new wxMask(bitmap, colour);
89 //---------------------------------------------------------------------------
92 class wxIcon : public wxBitmap {
95 wxIcon(const wxString& name, long flags,
96 int desiredWidth = -1, int desiredHeight = -1);
103 bool LoadFile(const wxString& name, long flags);
105 void SetDepth(int depth);
106 void SetHeight(int height);
107 void SetWidth(int width);
110 //---------------------------------------------------------------------------
112 class wxCursor : public wxBitmap {
115 wxCursor(const wxString& cursorName, long flags, int hotSpotX=0, int hotSpotY=0);
121 %name(wxStockCursor) %new wxCursor* wxPyStockCursor(int id);
122 %{ // Alternate 'constructor'
123 wxCursor* wxPyStockCursor(int id) {
124 return new wxCursor(id);
128 //----------------------------------------------------------------------
132 // I'll do it this way to use long-lived objects and not have to
133 // worry about when python may delete the object.
135 wxFont( int pointSize, int family, int style, int weight,
136 int underline=FALSE, char* faceName = "") {
138 return wxTheFontList->FindOrCreateFont(pointSize, family, style, weight,
139 underline, faceName);
145 wxString GetFaceName();
150 bool GetUnderlined();
153 void SetFaceName(const wxString& faceName);
154 void SetFamily(int family);
155 void SetPointSize(int pointSize);
156 void SetStyle(int style);
157 void SetUnderlined(bool underlined);
158 void SetWeight(int weight);
162 //----------------------------------------------------------------------
166 wxColour(unsigned char red=0, unsigned char green=0, unsigned char blue=0);
169 unsigned char Green();
170 unsigned char Blue();
172 void Set(unsigned char red, unsigned char green, unsigned char blue);
175 PyObject* rv = PyTuple_New(3);
176 PyTuple_SetItem(rv, 0, PyInt_FromLong(self->Red()));
177 PyTuple_SetItem(rv, 1, PyInt_FromLong(self->Green()));
178 PyTuple_SetItem(rv, 2, PyInt_FromLong(self->Blue()));
184 %new wxColour* wxNamedColour(const wxString& colorName);
185 %{ // Alternate 'constructor'
186 wxColour* wxNamedColour(const wxString& colorName) {
187 return new wxColour(colorName);
192 //----------------------------------------------------------------------
194 typedef unsigned long wxDash;
198 // I'll do it this way to use long-lived objects and not have to
199 // worry about when python may delete the object.
201 wxPen(wxColour* colour, int width=1, int style=wxSOLID) {
202 return wxThePenList->FindOrCreatePen(*colour, width, style);
208 wxColour& GetColour();
211 // **** This one needs to return a list of ints (wxDash)
212 int GetDashes(wxDash **dashes);
213 wxBitmap* GetStipple();
219 void SetCap(int cap_style);
220 void SetColour(wxColour& colour);
222 void SetDashes(int LCOUNT, wxDash* LIST);
223 void SetStipple(wxBitmap * stipple);
225 void SetJoin(int join_style);
226 void SetStyle(int style);
227 void SetWidth(int width);
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();
248 void SetColour(wxColour &colour);
249 void SetStipple(wxBitmap *bitmap);
250 void SetStyle(int style);
254 //----------------------------------------------------------------------
260 // wxDC(); **** abstract base class, can't instantiate.
264 bool Blit(long xdest, long ydest, long width, long height,
265 wxDC *source, long xsrc, long ysrc, long logical_func);
267 void CrossHair(long x, long y);
268 void DestroyClippingRegion();
269 long DeviceToLogicalX(long x);
270 long DeviceToLogicalXRel(long x);
271 long DeviceToLogicalY(long y);
272 long DeviceToLogicalYRel(long y);
273 void DrawArc(long x1, long y1, long x2, long y2, long xc, long yc);
274 void DrawEllipse(long x, long y, long width, long height);
275 void DrawEllipticArc(long x, long y, long width, long height, long start, long end);
276 void DrawIcon(const wxIcon& icon, long x, long y);
277 void DrawLine(long x1, long y1, long x2, long y2);
278 void DrawLines(int LCOUNT, wxPoint* LIST, long xoffset=0, long yoffset=0);
279 void DrawPolygon(int LCOUNT, wxPoint* LIST, long xoffset=0, long yoffset=0,
280 int fill_style=wxODDEVEN_RULE);
281 void DrawPoint(long x, long y);
282 void DrawRectangle(long x, long y, long width, long height);
283 void DrawRoundedRectangle(long x, long y, long width, long height, long radius=20);
284 void DrawSpline(int LCOUNT, wxPoint* LIST);
285 void DrawText(const wxString& text, long x, long y);
290 void FloodFill(long x, long y, const wxColour& colour, int style=wxFLOOD_SURFACE);
293 void FloodFill(long x, long y, wxColour* colour, int style=wxFLOOD_SURFACE);
295 wxBrush * GetBackground();
296 wxBrush * GetBrush();
297 long GetCharHeight();
299 void GetClippingBox(long *OUTPUT, long *OUTPUT,
300 long *OUTPUT, long *OUTPUT);
302 int GetLogicalFunction();
304 bool GetOptimization();
307 %new wxColour* GetPixel(long x, long y) {
308 wxColour* wc = new wxColour();
309 self->GetPixel(x, y, wc);
313 void GetSize(int* OUTPUT, int* OUTPUT); //void GetSize(long* OUTPUT, long* OUTPUT);
314 wxColour& GetTextBackground();
315 void GetTextExtent(const wxString& string, long *OUTPUT, long *OUTPUT,
316 long *OUTPUT, long *OUTPUT);
317 wxColour& GetTextForeground();
318 long LogicalToDeviceX(long x);
319 long LogicalToDeviceXRel(long x);
320 long LogicalToDeviceY(long y);
321 long LogicalToDeviceYRel(long y);
327 void SetDeviceOrigin(long x, long y);
328 void SetBackground(const wxBrush& brush);
329 void SetBackgroundMode(int mode);
330 void SetClippingRegion(long x, long y, long width, long height);
331 void SetPalette(const wxPalette& colourMap);
332 void SetBrush(const wxBrush& brush);
333 void SetFont(const wxFont& font);
334 void SetLogicalFunction(int function);
335 void SetMapMode(int mode);
336 void SetOptimization(bool optimize);
337 void SetPen(const wxPen& pen);
338 void SetTextBackground(const wxColour& colour);
339 void SetTextForeground(const wxColour& colour);
340 void SetUserScale(double x_scale, double y_scale);
341 bool StartDoc(const wxString& message);
346 // This one is my own creation...
347 void DrawBitmap(wxBitmap* bitmap, long x, long y, bool swapPalette=TRUE) {
348 wxMemoryDC* memDC = new wxMemoryDC;
349 memDC->SelectObject(bitmap);
351 self->SetPalette(bitmap->GetPalette());
352 self->Blit(x, y, bitmap->GetWidth(), bitmap->GetHeight(), memDC,
353 0, 0, self->GetLogicalFunction());
354 memDC->SelectObject(wxNullBitmap);
361 //----------------------------------------------------------------------
363 class wxMemoryDC : public wxDC {
367 void SelectObject(const wxBitmap& bitmap);
370 %new wxMemoryDC* wxMemoryDCFromDC(wxDC* oldDC);
371 %{ // Alternate 'constructor'
372 wxMemoryDC* wxMemoryDCFromDC(wxDC* oldDC) {
373 return new wxMemoryDC(oldDC);
378 //---------------------------------------------------------------------------
380 class wxScreenDC : public wxDC {
384 bool StartDrawingOnTop(wxWindow* window);
385 %name(StartDrawingOnTopRect) bool StartDrawingOnTop(wxRect* rect = NULL);
386 bool EndDrawingOnTop();
389 //---------------------------------------------------------------------------
391 class wxClientDC : public wxDC {
393 wxClientDC(wxWindow* win);
396 //---------------------------------------------------------------------------
398 class wxPaintDC : public wxDC {
400 wxPaintDC(wxWindow* win);
403 //---------------------------------------------------------------------------
405 class wxPostScriptDC : public wxDC {
407 wxPostScriptDC(const wxString& output, bool interactive = TRUE, wxWindow* win = NULL);
410 //---------------------------------------------------------------------------
413 class wxPrinterDC : public wxDC {
415 wxPrinterDC(const wxString& driver, const wxString& device, const wxString& output,
416 bool interactive = TRUE, int orientation = wxPORTRAIT);
420 //---------------------------------------------------------------------------
423 class wxMetaFileDC : public wxDC {
425 wxMetaFileDC(const wxString& filename = wxPyEmptyStr);
430 //---------------------------------------------------------------------------
431 //---------------------------------------------------------------------------
435 extern wxFont *wxNORMAL_FONT;
436 extern wxFont *wxSMALL_FONT;
437 extern wxFont *wxITALIC_FONT;
438 extern wxFont *wxSWISS_FONT;
439 extern wxPen *wxRED_PEN;
441 extern wxPen *wxCYAN_PEN;
442 extern wxPen *wxGREEN_PEN;
443 extern wxPen *wxBLACK_PEN;
444 extern wxPen *wxWHITE_PEN;
445 extern wxPen *wxTRANSPARENT_PEN;
446 extern wxPen *wxBLACK_DASHED_PEN;
447 extern wxPen *wxGREY_PEN;
448 extern wxPen *wxMEDIUM_GREY_PEN;
449 extern wxPen *wxLIGHT_GREY_PEN;
451 extern wxBrush *wxBLUE_BRUSH;
452 extern wxBrush *wxGREEN_BRUSH;
453 extern wxBrush *wxWHITE_BRUSH;
454 extern wxBrush *wxBLACK_BRUSH;
455 extern wxBrush *wxTRANSPARENT_BRUSH;
456 extern wxBrush *wxCYAN_BRUSH;
457 extern wxBrush *wxRED_BRUSH;
458 extern wxBrush *wxGREY_BRUSH;
459 extern wxBrush *wxMEDIUM_GREY_BRUSH;
460 extern wxBrush *wxLIGHT_GREY_BRUSH;
462 extern wxColour *wxBLACK;
463 extern wxColour *wxWHITE;
464 extern wxColour *wxRED;
465 extern wxColour *wxBLUE;
466 extern wxColour *wxGREEN;
467 extern wxColour *wxCYAN;
468 extern wxColour *wxLIGHT_GREY;
470 extern wxCursor *wxSTANDARD_CURSOR;
471 extern wxCursor *wxHOURGLASS_CURSOR;
472 extern wxCursor *wxCROSS_CURSOR;
474 extern wxBitmap wxNullBitmap;
475 extern wxIcon wxNullIcon;
476 extern wxCursor wxNullCursor;
477 extern wxPen wxNullPen;
478 extern wxBrush wxNullBrush;
479 extern wxPalette wxNullPalette;
480 extern wxFont wxNullFont;
481 extern wxColour wxNullColour;
483 //---------------------------------------------------------------------------
485 /////////////////////////////////////////////////////////////////////////////
488 // Revision 1.4 1998/10/02 06:40:38 RD
489 // Version 0.4 of wxPython for MSW.
491 // Revision 1.3 1998/08/18 19:48:16 RD
492 // more wxGTK compatibility things.
494 // It builds now but there are serious runtime problems...
496 // Revision 1.2 1998/08/15 07:36:35 RD
497 // - Moved the header in the .i files out of the code that gets put into
498 // the .cpp files. It caused CVS conflicts because of the RCS ID being
499 // different each time.
501 // - A few minor fixes.
503 // Revision 1.1 1998/08/09 08:25:50 RD