Typemaps for wxCoord, switch to using it.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@18839 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2003-01-21 00:59:20 +00:00
parent 76bad85642
commit d827d4acf0
4 changed files with 353 additions and 264 deletions

View File

@@ -561,34 +561,34 @@ public:
//---------------------------------------------------------------------- //----------------------------------------------------------------------
class wxDC : public wxObject { class wxDC : public wxObject {
public: public:
// wxDC(); **** abstract base class, can't instantiate. // wxDC(); **** abstract base class, can't instantiate.
~wxDC(); ~wxDC();
void BeginDrawing(); void BeginDrawing();
// %name(BlitXY) // %name(BlitXY)
bool Blit(long xdest, long ydest, bool Blit(wxCoord xdest, wxCoord ydest,
long width, long height, wxCoord width, wxCoord height,
wxDC *source, long xsrc, long ysrc, wxDC *source, wxCoord xsrc, wxCoord ysrc,
int logicalFunc = wxCOPY, int useMask = FALSE); int logicalFunc = wxCOPY, int useMask = FALSE);
// bool Blit(const wxPoint& destPt, const wxSize& sz, // bool Blit(const wxPoint& destPt, const wxSize& sz,
// wxDC *source, const wxPoint& srcPt, // wxDC *source, const wxPoint& srcPt,
// int logicalFunc = wxCOPY, int useMask = FALSE); // int logicalFunc = wxCOPY, int useMask = FALSE);
void Clear(); void Clear();
void CrossHair(long x, long y); void CrossHair(wxCoord x, wxCoord y);
void DestroyClippingRegion(); void DestroyClippingRegion();
long DeviceToLogicalX(long x); wxCoord DeviceToLogicalX(wxCoord x);
long DeviceToLogicalXRel(long x); wxCoord DeviceToLogicalXRel(wxCoord x);
long DeviceToLogicalY(long y); wxCoord DeviceToLogicalY(wxCoord y);
long DeviceToLogicalYRel(long y); wxCoord DeviceToLogicalYRel(wxCoord y);
void DrawArc(long x1, long y1, long x2, long y2, long xc, long yc); void DrawArc(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord xc, wxCoord yc);
void DrawCircle(long x, long y, long radius); void DrawCircle(wxCoord x, wxCoord y, wxCoord radius);
void DrawEllipse(long x, long y, long width, long height); void DrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
void DrawEllipticArc(long x, long y, long width, long height, long start, long end); void DrawEllipticArc(wxCoord x, wxCoord y, wxCoord width, wxCoord height, wxCoord start, wxCoord end);
void DrawIcon(const wxIcon& icon, long x, long y); void DrawIcon(const wxIcon& icon, wxCoord x, wxCoord y);
void DrawLabel(const wxString& text, const wxRect& rect, void DrawLabel(const wxString& text, const wxRect& rect,
int alignment = wxALIGN_LEFT | wxALIGN_TOP, int alignment = wxALIGN_LEFT | wxALIGN_TOP,
@@ -606,27 +606,27 @@ public:
} }
} }
void DrawLine(long x1, long y1, long x2, long y2); void DrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
void DrawLines(int PCOUNT, wxPoint* points, long xoffset=0, long yoffset=0); void DrawLines(int PCOUNT, wxPoint* points, wxCoord xoffset=0, wxCoord yoffset=0);
void DrawPolygon(int PCOUNT, wxPoint* points, long xoffset=0, long yoffset=0, void DrawPolygon(int PCOUNT, wxPoint* points, wxCoord xoffset=0, wxCoord yoffset=0,
int fill_style=wxODDEVEN_RULE); int fill_style=wxODDEVEN_RULE);
void DrawPoint(long x, long y); void DrawPoint(wxCoord x, wxCoord y);
void DrawRectangle(long x, long y, long width, long height); void DrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
%name(DrawRectangleRect)void DrawRectangle(const wxRect& rect); %name(DrawRectangleRect)void DrawRectangle(const wxRect& rect);
void DrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle); void DrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle);
void DrawRoundedRectangle(long x, long y, long width, long height, long radius=20); void DrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, wxCoord radius=20);
void DrawSpline(int PCOUNT, wxPoint* points); void DrawSpline(int PCOUNT, wxPoint* points);
void DrawText(const wxString& text, long x, long y); void DrawText(const wxString& text, wxCoord x, wxCoord y);
void EndDoc(); void EndDoc();
void EndDrawing(); void EndDrawing();
void EndPage(); void EndPage();
bool FloodFill(long x, long y, const wxColour& colour, int style=wxFLOOD_SURFACE); bool FloodFill(wxCoord x, wxCoord y, const wxColour& colour, int style=wxFLOOD_SURFACE);
wxBrush GetBackground(); wxBrush GetBackground();
wxBrush GetBrush(); wxBrush GetBrush();
long GetCharHeight(); wxCoord GetCharHeight();
long GetCharWidth(); wxCoord GetCharWidth();
void GetClippingBox(long *OUTPUT, long *OUTPUT, void GetClippingBox(wxCoord *OUTPUT, wxCoord *OUTPUT,
long *OUTPUT, long *OUTPUT); wxCoord *OUTPUT, wxCoord *OUTPUT);
wxFont GetFont(); wxFont GetFont();
int GetLogicalFunction(); int GetLogicalFunction();
void GetLogicalScale(double *OUTPUT, double *OUTPUT); void GetLogicalScale(double *OUTPUT, double *OUTPUT);
@@ -634,7 +634,7 @@ public:
bool GetOptimization(); bool GetOptimization();
wxPen GetPen(); wxPen GetPen();
%addmethods { %addmethods {
%new wxColour* GetPixel(long x, long y) { %new wxColour* GetPixel(wxCoord x, wxCoord y) {
wxColour* wc = new wxColour(); wxColour* wc = new wxColour();
self->GetPixel(x, y, wc); self->GetPixel(x, y, wc);
return wc; return wc;
@@ -644,25 +644,27 @@ public:
wxSize GetSize(); wxSize GetSize();
wxSize GetSizeMM(); wxSize GetSizeMM();
wxColour GetTextBackground(); wxColour GetTextBackground();
void GetTextExtent(const wxString& string, long *OUTPUT, long *OUTPUT); void GetTextExtent(const wxString& string, wxCoord *OUTPUT, wxCoord *OUTPUT);
%name(GetFullTextExtent)void GetTextExtent(const wxString& string, %name(GetFullTextExtent)void GetTextExtent(const wxString& string,
long *OUTPUT, long *OUTPUT, long *OUTPUT, long* OUTPUT, wxCoord *OUTPUT, wxCoord *OUTPUT, wxCoord *OUTPUT, wxCoord* OUTPUT,
const wxFont* font = NULL); const wxFont* font = NULL);
void GetMultiLineTextExtent(const wxString& text, wxCoord *OUTPUT, wxCoord *OUTPUT, wxCoord *OUTPUT,
wxFont *font = NULL);
wxColour GetTextForeground(); wxColour GetTextForeground();
void GetUserScale(double *OUTPUT, double *OUTPUT); void GetUserScale(double *OUTPUT, double *OUTPUT);
long LogicalToDeviceX(long x); wxCoord LogicalToDeviceX(wxCoord x);
long LogicalToDeviceXRel(long x); wxCoord LogicalToDeviceXRel(wxCoord x);
long LogicalToDeviceY(long y); wxCoord LogicalToDeviceY(wxCoord y);
long LogicalToDeviceYRel(long y); wxCoord LogicalToDeviceYRel(wxCoord y);
long MaxX(); wxCoord MaxX();
long MaxY(); wxCoord MaxY();
long MinX(); wxCoord MinX();
long MinY(); wxCoord MinY();
bool Ok(); bool Ok();
void SetDeviceOrigin(long x, long y); void SetDeviceOrigin(wxCoord x, wxCoord y);
void SetBackground(const wxBrush& brush); void SetBackground(const wxBrush& brush);
void SetBackgroundMode(int mode); void SetBackgroundMode(int mode);
void SetClippingRegion(long x, long y, long width, long height); void SetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
%name(SetClippingRegionAsRegion) void SetClippingRegion(const wxRegion& region); %name(SetClippingRegionAsRegion) void SetClippingRegion(const wxRegion& region);
%name(SetClippingRect) void SetClippingRegion(const wxRect& rect); %name(SetClippingRect) void SetClippingRegion(const wxRect& rect);
void SetPalette(const wxPalette& colourMap); void SetPalette(const wxPalette& colourMap);
@@ -681,7 +683,7 @@ public:
void DrawBitmap(const wxBitmap& bitmap, long x, long y, void DrawBitmap(const wxBitmap& bitmap, wxCoord x, wxCoord y,
int useMask = FALSE); int useMask = FALSE);
bool CanDrawBitmap(); bool CanDrawBitmap();
@@ -1108,7 +1110,7 @@ enum wxRegionContain {
class wxRegion : public wxGDIObject { class wxRegion : public wxGDIObject {
public: public:
wxRegion(long x=0, long y=0, long width=0, long height=0); wxRegion(wxCoord x=0, wxCoord y=0, wxCoord width=0, wxCoord height=0);
#ifndef __WXMAC__ #ifndef __WXMAC__
%name(wxRegionFromPoints)wxRegion(int PCOUNT, wxPoint* points, int fillStyle = wxWINDING_RULE); %name(wxRegionFromPoints)wxRegion(int PCOUNT, wxPoint* points, int fillStyle = wxWINDING_RULE);
#endif #endif
@@ -1119,28 +1121,28 @@ public:
bool Offset(wxCoord x, wxCoord y); bool Offset(wxCoord x, wxCoord y);
#endif #endif
wxRegionContain Contains(long x, long y); wxRegionContain Contains(wxCoord x, wxCoord y);
%name(ContainsPoint)wxRegionContain Contains(const wxPoint& pt); %name(ContainsPoint)wxRegionContain Contains(const wxPoint& pt);
%name(ContainsRect)wxRegionContain Contains(const wxRect& rect); %name(ContainsRect)wxRegionContain Contains(const wxRect& rect);
%name(ContainsRectDim)wxRegionContain Contains(long x, long y, long w, long h); %name(ContainsRectDim)wxRegionContain Contains(wxCoord x, wxCoord y, wxCoord w, wxCoord h);
wxRect GetBox(); wxRect GetBox();
bool Intersect(long x, long y, long width, long height); bool Intersect(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
%name(IntersectRect)bool Intersect(const wxRect& rect); %name(IntersectRect)bool Intersect(const wxRect& rect);
%name(IntersectRegion)bool Intersect(const wxRegion& region); %name(IntersectRegion)bool Intersect(const wxRegion& region);
bool IsEmpty(); bool IsEmpty();
bool Union(long x, long y, long width, long height); bool Union(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
%name(UnionRect)bool Union(const wxRect& rect); %name(UnionRect)bool Union(const wxRect& rect);
%name(UnionRegion)bool Union(const wxRegion& region); %name(UnionRegion)bool Union(const wxRegion& region);
bool Subtract(long x, long y, long width, long height); bool Subtract(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
%name(SubtractRect)bool Subtract(const wxRect& rect); %name(SubtractRect)bool Subtract(const wxRect& rect);
%name(SubtractRegion)bool Subtract(const wxRegion& region); %name(SubtractRegion)bool Subtract(const wxRegion& region);
bool Xor(long x, long y, long width, long height); bool Xor(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
%name(XorRect)bool Xor(const wxRect& rect); %name(XorRect)bool Xor(const wxRect& rect);
%name(XorRegion)bool Xor(const wxRegion& region); %name(XorRegion)bool Xor(const wxRegion& region);
}; };
@@ -1152,12 +1154,12 @@ public:
wxRegionIterator(const wxRegion& region); wxRegionIterator(const wxRegion& region);
~wxRegionIterator(); ~wxRegionIterator();
long GetX(); wxCoord GetX();
long GetY(); wxCoord GetY();
long GetW(); wxCoord GetW();
long GetWidth(); wxCoord GetWidth();
long GetH(); wxCoord GetH();
long GetHeight(); wxCoord GetHeight();
wxRect GetRect(); wxRect GetRect();
bool HaveRects(); bool HaveRects();
void Reset(); void Reset();

File diff suppressed because it is too large Load Diff

View File

@@ -624,6 +624,9 @@ class wxDCPtr(wxObjectPtr):
def GetFullTextExtent(self, *_args, **_kwargs): def GetFullTextExtent(self, *_args, **_kwargs):
val = apply(gdic.wxDC_GetFullTextExtent,(self,) + _args, _kwargs) val = apply(gdic.wxDC_GetFullTextExtent,(self,) + _args, _kwargs)
return val return val
def GetMultiLineTextExtent(self, *_args, **_kwargs):
val = apply(gdic.wxDC_GetMultiLineTextExtent,(self,) + _args, _kwargs)
return val
def GetTextForeground(self, *_args, **_kwargs): def GetTextForeground(self, *_args, **_kwargs):
val = apply(gdic.wxDC_GetTextForeground,(self,) + _args, _kwargs) val = apply(gdic.wxDC_GetTextForeground,(self,) + _args, _kwargs)
if val: val = wxColourPtr(val) ; val.thisown = 1 if val: val = wxColourPtr(val) ; val.thisown = 1

View File

@@ -388,6 +388,11 @@ $function
%typemap(python,ignore) byte *OUTPUT = byte *T_OUTPUT; %typemap(python,ignore) byte *OUTPUT = byte *T_OUTPUT;
%typemap(python,argout) byte *OUTPUT = byte *T_OUTPUT; %typemap(python,argout) byte *OUTPUT = byte *T_OUTPUT;
%typemap(python,ignore) wxCoord *OUTPUT = int *OUTPUT;
%typemap(python,argout) wxCoord *OUTPUT = int *OUTPUT;
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// Typemaps to convert return values that are base class pointers // Typemaps to convert return values that are base class pointers
// to the real derived type, if possible. See wxPyMake_wxObject in // to the real derived type, if possible. See wxPyMake_wxObject in