-#if defined(wxUSE_DC_OLD_METHODS)
+#if 1 // The < 2.4 and > 2.5.1.5 way
bool FloodFill(wxCoord x, wxCoord y, const wxColour& col, int style = wxFLOOD_SURFACE);
+ %name(FloodFillPoint) bool FloodFill(const wxPoint& pt, const wxColour& col, int style = wxFLOOD_SURFACE);
+
//bool GetPixel(wxCoord x, wxCoord y, wxColour *col) const;
%extend {
wxColour GetPixel(wxCoord x, wxCoord y) {
self->GetPixel(x, y, &col);
return col;
}
+ wxColour GetPixelPoint(const wxPoint& pt) {
+ wxColour col;
+ self->GetPixel(pt, &col);
+ return col;
+ }
}
+
void DrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
+ %name(DrawLinePoint) void DrawLine(const wxPoint& pt1, const wxPoint& pt2);
+
void CrossHair(wxCoord x, wxCoord y);
+ %name(CrossHairPoint) void CrossHair(const wxPoint& pt);
+
void DrawArc(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord xc, wxCoord yc);
+ %name(DrawArcPoint) void DrawArc(const wxPoint& pt1, const wxPoint& pt2, const wxPoint& centre);
+
void DrawCheckMark(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
+ %name(DrawCheckMarkRect) void DrawCheckMark(const wxRect& rect);
+
void DrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, double sa, double ea);
+ %name(DrawEllipticArcPointSize) void DrawEllipticArc(const wxPoint& pt, const wxSize& sz, double sa, double ea);
+
void DrawPoint(wxCoord x, wxCoord y);
+ %name(DrawPointPoint) void DrawPoint(const wxPoint& pt);
+
void DrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
%name(DrawRectangleRect)void DrawRectangle(const wxRect& rect);
+ %name(DrawRectanglePointSize) void DrawRectangle(const wxPoint& pt, const wxSize& sz);
+
void DrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius);
+ %name(DrawRoundedRectangleRect) void DrawRoundedRectangle(const wxRect& r, double radius);
+ %name(DrawRoundedRectanglePointSize) void DrawRoundedRectangle(const wxPoint& pt, const wxSize& sz, double radius);
+
void DrawCircle(wxCoord x, wxCoord y, wxCoord radius);
+ %name(DrawCirclePoint) void DrawCircle(const wxPoint& pt, wxCoord radius);
+
void DrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
+ %name(DrawEllipseRect) void DrawEllipse(const wxRect& rect);
+ %name(DrawEllipsePointSize) void DrawEllipse(const wxPoint& pt, const wxSize& sz);
+
void DrawIcon(const wxIcon& icon, wxCoord x, wxCoord y);
+ %name(DrawIconPoint) void DrawIcon(const wxIcon& icon, const wxPoint& pt);
+
void DrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, bool useMask = False);
+ %name(DrawBitmapPoint) void DrawBitmap(const wxBitmap &bmp, const wxPoint& pt, bool useMask = False);
+
void DrawText(const wxString& text, wxCoord x, wxCoord y);
+ %name(DrawTextPoint) void DrawText(const wxString& text, const wxPoint& pt);
+
void DrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle);
+ %name(DrawRotatedTextPoint) void DrawRotatedText(const wxString& text, const wxPoint& pt, double angle);
+
bool Blit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
wxDC *source, wxCoord xsrc, wxCoord ysrc,
int rop = wxCOPY, bool useMask = False,
wxCoord xsrcMask = -1, wxCoord ysrcMask = -1);
+ %name(BlitPointSize) bool Blit(const wxPoint& destPt, const wxSize& sz,
+ wxDC *source, const wxPoint& srcPt,
+ int rop = wxCOPY, bool useMask = False,
+ const wxPoint& srcPtMask = wxDefaultPosition);
+ void SetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
+ %name(SetClippingRegionPointSize) void SetClippingRegion(const wxPoint& pt, const wxSize& sz);
+ %name(SetClippingRegionAsRegion) void SetClippingRegion(const wxRegion& region);
+ %name(SetClippingRect) void SetClippingRegion(const wxRect& rect);
-#else // The new way
+#else // The doomed 2.5.1.5
%name(FloodFillXY) bool FloodFill(wxCoord x, wxCoord y, const wxColour& col, int style = wxFLOOD_SURFACE);
bool FloodFill(const wxPoint& pt, const wxColour& col, int style = wxFLOOD_SURFACE);
return col;
}
}
+
%name(DrawLineXY) void DrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
void DrawLine(const wxPoint& pt1, const wxPoint& pt2);
int rop = wxCOPY, bool useMask = False,
const wxPoint& srcPtMask = wxDefaultPosition);
+
+ %name(SetClippingRegionXY)void SetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
+ void SetClippingRegion(const wxPoint& pt, const wxSize& sz);
+ %name(SetClippingRect) void SetClippingRegion(const wxRect& rect);
+ %name(SetClippingRegionAsRegion) void SetClippingRegion(const wxRegion& region);
+
#endif
void DrawLines(int points, wxPoint* points_array, wxCoord xoffset = 0, wxCoord yoffset = 0);
virtual void SetPalette(const wxPalette& palette);
- // clipping region
- // ---------------
-
- %name(SetClippingRegionXY)void SetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
- void SetClippingRegion(const wxPoint& pt, const wxSize& sz);
- %name(SetClippingRect) void SetClippingRegion(const wxRect& rect);
- %name(SetClippingRegionAsRegion) void SetClippingRegion(const wxRegion& region);
-
virtual void DestroyClippingRegion();
DocDeclA(
DocDeclAStr(
void, GetTextExtent(const wxString& string, wxCoord *OUTPUT, wxCoord *OUTPUT),
"GetTextExtent(wxString string) -> (width, height)",
- "Get the width and height of the text using the current font.\n"
- "Only works for single line strings.");
+ "Get the width and height of the text using the current font. Only
+works for single line strings.", "");
+
DocDeclAStrName(
void, GetTextExtent(const wxString& string,
wxCoord *OUTPUT, wxCoord *OUTPUT, wxCoord *OUTPUT, wxCoord* OUTPUT,
wxFont* font = NULL),
"GetFullTextExtent(wxString string, Font font=None) ->\n (width, height, descent, externalLeading)",
- "Get the width, height, decent and leading of the text using the current or specified font.\n"
- "Only works for single line strings.",
+ "Get the width, height, decent and leading of the text using the
+current or specified font. Only works for single line strings.", "",
GetFullTextExtent);
wxCoord *OUTPUT, wxCoord *OUTPUT, wxCoord *OUTPUT,
wxFont *font = NULL),
"GetMultiLineTextExtent(wxString string, Font font=None) ->\n (width, height, descent, externalLeading)",
- "Get the width, height, decent and leading of the text using the current or specified font.\n"
- "Works for single as well as multi-line strings.");
+ "Get the width, height, decent and leading of the text using the
+current or specified font. Works for single as well as multi-line
+strings.", "");
%extend {
// size and resolution
// -------------------
- DocStr(GetSize, "Get the DC size in device units.");
+ DocStr(GetSize, "Get the DC size in device units.", "");
wxSize GetSize();
DocDeclAName(
void, GetSize( int *OUTPUT, int *OUTPUT ),
GetSizeTuple);
- DocStr(GetSizeMM, "Get the DC size in milimeters.");
+ DocStr(GetSizeMM, "Get the DC size in milimeters.", "");
wxSize GetSizeMM() const;
DocDeclAName(
void, GetSizeMM( int *OUTPUT, int *OUTPUT ) const,
GetLogicalOriginTuple);
virtual void SetLogicalOrigin(wxCoord x, wxCoord y);
+ %extend {
+ void SetLogicalOriginPoint(const wxPoint& point) {
+ self->SetLogicalOrigin(point.x, point.y);
+ }
+ }
-
+
wxPoint GetDeviceOrigin() const;
DocDeclAName(
void, GetDeviceOrigin(wxCoord *OUTPUT, wxCoord *OUTPUT) const,
GetDeviceOriginTuple);
virtual void SetDeviceOrigin(wxCoord x, wxCoord y);
+ %extend {
+ void SetDeviceOriginPoint(const wxPoint& point) {
+ self->SetDeviceOrigin(point.x, point.y);
+ }
+ }
virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp);
// ------------
virtual void CalcBoundingBox(wxCoord x, wxCoord y);
+ %extend {
+ void CalcBoundingBoxPoint(const wxPoint& point) {
+ self->CalcBoundingBox(point.x, point.y);
+ }
+ }
+
void ResetBoundingBox();
// Get the final bounding box of the PostScript or Metafile picture.
%pythoncode { def __nonzero__(self): return self.Ok() };
+#ifdef __WXMSW__
+ long GetHDC();
+#endif
+
%extend { // See drawlist.cpp for impplementaion of these...
PyObject* _DrawPointList(PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)
%{
-//-=-=-=-=-=-=-=-=-=-=-
-
-#if 1
-// Use the standard wxBufferedDC
#include <wx/dcbuffer.h>
-
-#else
-
-// Or, temporarily put a set of classes here similar to the old buffered DC
-// classes until the real ones can be fixed to work "correctly" again.
-
-class wxBufferedDC : public wxMemoryDC
-{
-private:
- wxDC *m_dc;
- wxBitmap m_buffer;
-
-public:
-
- wxBufferedDC() : m_dc( 0 ) {}
-
- wxBufferedDC( wxDC *dc, const wxBitmap &buffer )
- : m_dc( dc ), m_buffer( buffer )
- {
- SelectObject( m_buffer );
- }
-
- wxBufferedDC( wxDC *dc, const wxSize &area )
- : m_dc( dc ), m_buffer( area.GetWidth(), area.GetHeight() )
- {
- SelectObject( m_buffer );
- }
-
- ~wxBufferedDC() {
- if( m_dc != 0 )
- UnMask();
- }
-
-
- void Init( wxDC *dc, const wxBitmap &buffer ) {
- wxASSERT_MSG( m_dc == 0 && m_buffer == wxNullBitmap,
- _T("wxBufferedDC already initialised") );
- m_dc = dc;
- m_buffer = buffer;
- SelectObject( m_buffer );
- }
-
- void Init( wxDC *dc, const wxSize &area ) {
- wxASSERT_MSG( m_dc == 0 && m_buffer == wxNullBitmap,
- _T("wxBufferedDC already initialised") );
- m_dc = dc;
- m_buffer = wxBitmap( area.GetWidth(), area.GetHeight() );
- SelectObject( m_buffer );
- }
-
- void UnMask() {
- wxASSERT_MSG( m_dc != 0, _T("No low level DC associated with buffer (anymore)") );
- m_dc->Blit( 0, 0, m_buffer.GetWidth(), m_buffer.GetHeight(), this, 0, 0 );
- m_dc = 0;
- }
-};
-
-
-class wxBufferedPaintDC : public wxBufferedDC
-{
-private:
- wxPaintDC m_paintdc;
-
-public:
- wxBufferedPaintDC( wxWindow *window, const wxBitmap &buffer = wxNullBitmap )
- : m_paintdc( window )
- {
- window->PrepareDC( m_paintdc );
-
- if( buffer != wxNullBitmap )
- Init( &m_paintdc, buffer );
- else
- Init( &m_paintdc, window->GetClientSize() );
- }
-
- ~wxBufferedPaintDC() {
- UnMask();
- }
-};
-
-#endif
-//-=-=-=-=-=-=-=-=-=-=-
%}
-
-
class wxBufferedDC : public wxMemoryDC
{
public:
%newgroup
-#ifdef __WXMSW__
+#if defined(__WXMSW__) || defined(__WXMAC__)
%{
#include <wx/metafile.h>
int GetWidth();
int GetHeight();
+#ifdef __WXMSW__
const wxString& GetFileName() const;
-
+#endif
+
%pythoncode { def __nonzero__(self): return self.Ok() }
};
// compatible with the DC Draw methods in 2.4. See also wxPython/_wx.py.
+#if 0
+
%define MAKE_OLD_DC_CLASS(classname)
%pythoncode {
class classname##_old(classname):
MAKE_OLD_DC_CLASS(MetaFileDC);
MAKE_OLD_DC_CLASS(PrinterDC);
+#endif
//---------------------------------------------------------------------------