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 /////////////////////////////////////////////////////////////////////////////
19 #include <wx/metafile.h>
22 //----------------------------------------------------------------------
25 %include my_typemaps.i
27 // Import some definitions of other classes, etc.
31 //---------------------------------------------------------------------------
35 wxBitmap(const wxString& name, long type);
38 void Create(int width, int height, int depth = -1);
41 wxPalette* GetPalette();
44 bool LoadFile(const wxString& name, long flags);
46 bool SaveFile(const wxString& name, int type, wxPalette* palette = NULL);
47 void SetDepth(int depth);
48 void SetHeight(int height);
49 void SetMask(wxMask* mask);
51 void SetPalette(wxPalette* palette);
52 void SetWidth(int width);
55 %new wxBitmap* wxEmptyBitmap(int width, int height, int depth=-1);
56 wxBitmap* wxNoRefBitmap(char* name, long flags);
57 %{ // Alternate 'constructor'
58 wxBitmap* wxEmptyBitmap(int width, int height, int depth=-1) {
59 return new wxBitmap(width, height, depth);
62 // This one won't own the reference, so Python won't call
63 // the dtor, this is good for toolbars and such where
64 // the parent will manage the bitmap.
65 wxBitmap* wxNoRefBitmap(char* name, long flags) {
66 return new wxBitmap(name, flags);
70 //---------------------------------------------------------------------------
74 wxMask(const wxBitmap& bitmap);
78 %new wxMask* wxMaskColour(const wxBitmap& bitmap, const wxColour& colour);
80 wxMask* wxMaskColour(const wxBitmap& bitmap, const wxColour& colour) {
81 return new wxMask(bitmap, colour);
86 //---------------------------------------------------------------------------
89 class wxIcon : public wxBitmap {
91 wxIcon(char *name, long flags);
97 bool LoadFile(const wxString& name, long flags);
99 void SetDepth(int depth);
100 void SetHeight(int height);
101 void SetOk(int isOk);
102 void SetWidth(int width);
105 //---------------------------------------------------------------------------
107 class wxCursor : public wxBitmap {
109 wxCursor(const wxString& cursorName, long flags, int hotSpotX=0, int hotSpotY=0);
114 %new wxCursor* wxStockCursor(int id);
115 %{ // Alternate 'constructor'
116 wxCursor* wxStockCursor(int id) {
117 return new wxCursor(id);
121 //----------------------------------------------------------------------
125 // I'll do it this way to use long-lived objects and not have to
126 // worry about when python may delete the object.
128 wxFont( int pointSize, int family, int style, int weight,
129 int underline=FALSE, char* faceName = "") {
131 return wxTheFontList->FindOrCreateFont(pointSize, family, style, weight,
132 underline, faceName);
138 wxString GetFaceName();
143 bool GetUnderlined();
145 void SetFaceName(const wxString& faceName);
146 void SetFamily(int family);
147 void SetPointSize(int pointSize);
148 void SetStyle(int style);
149 void SetUnderlined(bool underlined);
150 void SetWeight(int weight);
153 //----------------------------------------------------------------------
157 wxColour(unsigned char red=0, unsigned char green=0, unsigned char blue=0);
160 unsigned char Green();
161 unsigned char Blue();
163 void Set(unsigned char red, unsigned char green, unsigned char blue);
166 PyObject* rv = PyTuple_New(3);
167 PyTuple_SetItem(rv, 0, PyInt_FromLong(self->Red()));
168 PyTuple_SetItem(rv, 1, PyInt_FromLong(self->Green()));
169 PyTuple_SetItem(rv, 2, PyInt_FromLong(self->Blue()));
175 %new wxColour* wxNamedColour(const wxString& colorName);
176 %{ // Alternate 'constructor'
177 wxColour* wxNamedColour(const wxString& colorName) {
178 return new wxColour(colorName);
183 //----------------------------------------------------------------------
185 typedef unsigned long wxDash;
189 // I'll do it this way to use long-lived objects and not have to
190 // worry about when python may delete the object.
192 wxPen(wxColour* colour, int width=1, int style=wxSOLID) {
193 return wxThePenList->FindOrCreatePen(*colour, width, style);
199 wxColour& GetColour();
201 // **** This one needs to return a list of ints (wxDash)
202 int GetDashes(wxDash **dashes);
204 wxBitmap* GetStipple();
208 void SetCap(int cap_style);
209 void SetColour(wxColour& colour);
210 void SetDashes(int LCOUNT, wxDash* LIST);
211 void SetJoin(int join_style);
212 void SetStipple(wxBitmap * stipple);
213 void SetStyle(int style);
214 void SetWidth(int width);
217 //----------------------------------------------------------------------
221 // I'll do it this way to use long-lived objects and not have to
222 // worry about when python may delete the object.
224 wxBrush(wxColour* colour, int style=wxSOLID) {
225 return wxTheBrushList->FindOrCreateBrush(*colour, style);
230 wxColour& GetColour();
231 wxBitmap * GetStipple();
234 void SetColour(wxColour &colour);
235 void SetStipple(wxBitmap *bitmap);
236 void SetStyle(int style);
239 //----------------------------------------------------------------------
249 bool Blit(long xdest, long ydest, long width, long height,
250 wxDC *source, long xsrc, long ysrc, long logical_func);
252 void CrossHair(long x, long y);
253 void DestroyClippingRegion();
254 long DeviceToLogicalX(long x);
255 long DeviceToLogicalXRel(long x);
256 long DeviceToLogicalY(long y);
257 long DeviceToLogicalYRel(long y);
258 void DrawArc(long x1, long y1, long x2, long y2, long xc, long yc);
259 void DrawEllipse(long x, long y, long width, long height);
260 void DrawEllipticArc(long x, long y, long width, long height, long start, long end);
261 void DrawIcon(const wxIcon& icon, long x, long y);
262 void DrawLine(long x1, long y1, long x2, long y2);
263 void DrawLines(int LCOUNT, wxPoint* LIST, long xoffset=0, long yoffset=0);
264 void DrawPolygon(int LCOUNT, wxPoint* LIST, long xoffset=0, long yoffset=0,
265 int fill_style=wxODDEVEN_RULE);
266 void DrawPoint(long x, long y);
267 void DrawRectangle(long x, long y, long width, long height);
268 void DrawRoundedRectangle(long x, long y, long width, long height, long radius=20);
269 void DrawSpline(int LCOUNT, wxPoint* LIST);
270 void DrawText(const wxString& text, long x, long y);
274 void FloodFill(long x, long y, const wxColour& colour, int style=wxFLOOD_SURFACE);
275 wxBrush * GetBackground();
276 wxBrush * GetBrush();
277 long GetCharHeight();
279 void GetClippingBox(long *OUTPUT, long *OUTPUT,
280 long *OUTPUT, long *OUTPUT);
282 int GetLogicalFunction();
284 bool GetOptimization();
286 //bool GetPixel(int x, int y, wxColour *T_OUTPUT); **** See below.
287 void GetSize(int* OUTPUT, int* OUTPUT); //void GetSize(long* OUTPUT, long* OUTPUT);
288 wxColour& GetTextBackground();
289 void GetTextExtent(const wxString& string, long *OUTPUT, long *OUTPUT,
290 long *OUTPUT, long *OUTPUT);
291 wxColour& GetTextForeground();
292 long LogicalToDeviceX(long x);
293 long LogicalToDeviceXRel(long x);
294 long LogicalToDeviceY(long y);
295 long LogicalToDeviceYRel(long y);
301 void SetDeviceOrigin(long x, long y);
302 void SetBackground(const wxBrush& brush);
303 void SetBackgroundMode(int mode);
304 void SetClippingRegion(long x, long y, long width, long height);
305 void SetPalette(const wxPalette& colourMap);
306 void SetBrush(const wxBrush& brush);
307 void SetFont(const wxFont& font);
308 void SetLogicalFunction(int function);
309 void SetMapMode(int mode);
310 void SetOptimization(bool optimize);
311 void SetPen(const wxPen& pen);
312 void SetTextBackground(const wxColour& colour);
313 void SetTextForeground(const wxColour& colour);
314 void SetUserScale(double x_scale, double y_scale);
315 bool StartDoc(const wxString& message);
320 %new wxColour* GetPixel(long x, long y) {
321 wxColor* wc = new wxColor();
322 self->GetPixel(x, y, wc);
326 // This one is my own creation...
327 void DrawBitmap(wxBitmap* bitmap, long x, long y, bool swapPalette=TRUE) {
328 wxMemoryDC* memDC = new wxMemoryDC;
329 memDC->SelectObject(bitmap);
331 self->SetPalette(bitmap->GetPalette());
332 self->Blit(x, y, bitmap->GetWidth(), bitmap->GetHeight(), memDC,
333 0, 0, self->GetLogicalFunction());
334 memDC->SelectObject(wxNullBitmap);
341 //----------------------------------------------------------------------
343 class wxMemoryDC : public wxDC {
347 void SelectObject(const wxBitmap& bitmap);
350 %new wxMemoryDC* wxMemoryDCFromDC(wxDC* oldDC);
351 %{ // Alternate 'constructor'
352 wxMemoryDC* wxMemoryDCFromDC(wxDC* oldDC) {
353 return new wxMemoryDC(oldDC);
358 //---------------------------------------------------------------------------
360 class wxScreenDC : public wxDC {
364 bool StartDrawingOnTop(wxWindow* window);
365 %name(StartDrawingOnTopRect) bool StartDrawingOnTop(wxRect* rect = NULL);
366 bool EndDrawingOnTop();
369 //---------------------------------------------------------------------------
371 class wxClientDC : public wxDC {
373 wxClientDC(wxWindow* win);
376 //---------------------------------------------------------------------------
378 class wxPaintDC : public wxDC {
380 wxPaintDC(wxWindow* win);
383 //---------------------------------------------------------------------------
385 class wxPostScriptDC : public wxDC {
387 wxPostScriptDC(const wxString& output, bool interactive = TRUE, wxWindow* win = NULL);
390 //---------------------------------------------------------------------------
392 class wxPrinterDC : public wxDC {
394 wxPrinterDC(const wxString& driver, const wxString& device, const wxString& output,
395 bool interactive = TRUE, int orientation = wxPORTRAIT);
398 //---------------------------------------------------------------------------
400 class wxMetaFileDC : public wxDC {
402 wxMetaFileDC(const wxString& filename = wxPyEmptyStr);
406 //---------------------------------------------------------------------------
407 //---------------------------------------------------------------------------
411 extern wxFont *wxNORMAL_FONT;
412 extern wxFont *wxSMALL_FONT;
413 extern wxFont *wxITALIC_FONT;
414 extern wxFont *wxSWISS_FONT;
415 extern wxPen *wxRED_PEN;
417 extern wxPen *wxCYAN_PEN;
418 extern wxPen *wxGREEN_PEN;
419 extern wxPen *wxBLACK_PEN;
420 extern wxPen *wxWHITE_PEN;
421 extern wxPen *wxTRANSPARENT_PEN;
422 extern wxPen *wxBLACK_DASHED_PEN;
423 extern wxPen *wxGREY_PEN;
424 extern wxPen *wxMEDIUM_GREY_PEN;
425 extern wxPen *wxLIGHT_GREY_PEN;
427 extern wxBrush *wxBLUE_BRUSH;
428 extern wxBrush *wxGREEN_BRUSH;
429 extern wxBrush *wxWHITE_BRUSH;
430 extern wxBrush *wxBLACK_BRUSH;
431 extern wxBrush *wxTRANSPARENT_BRUSH;
432 extern wxBrush *wxCYAN_BRUSH;
433 extern wxBrush *wxRED_BRUSH;
434 extern wxBrush *wxGREY_BRUSH;
435 extern wxBrush *wxMEDIUM_GREY_BRUSH;
436 extern wxBrush *wxLIGHT_GREY_BRUSH;
438 extern wxColour *wxBLACK;
439 extern wxColour *wxWHITE;
440 extern wxColour *wxRED;
441 extern wxColour *wxBLUE;
442 extern wxColour *wxGREEN;
443 extern wxColour *wxCYAN;
444 extern wxColour *wxLIGHT_GREY;
446 extern wxCursor *wxSTANDARD_CURSOR;
447 extern wxCursor *wxHOURGLASS_CURSOR;
448 extern wxCursor *wxCROSS_CURSOR;
450 extern wxBitmap wxNullBitmap;
451 extern wxIcon wxNullIcon;
452 extern wxCursor wxNullCursor;
453 extern wxPen wxNullPen;
454 extern wxBrush wxNullBrush;
455 extern wxPalette wxNullPalette;
456 extern wxFont wxNullFont;
457 extern wxColour wxNullColour;
459 //---------------------------------------------------------------------------
461 /////////////////////////////////////////////////////////////////////////////
464 // Revision 1.2 1998/08/15 07:36:35 RD
465 // - Moved the header in the .i files out of the code that gets put into
466 // the .cpp files. It caused CVS conflicts because of the RCS ID being
467 // different each time.
469 // - A few minor fixes.
471 // Revision 1.1 1998/08/09 08:25:50 RD