Reverted to old method names/signatures for wx.DC, updated lib and

demo to match.  Also fixed some deprecation warnings.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27049 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2004-05-02 02:41:33 +00:00
parent 019fd9d379
commit d7403ad2d1
61 changed files with 536 additions and 702 deletions

View File

@@ -1,19 +1,6 @@
# Other names that need to be reverse-renamed for the old namespace
DC_old
MemoryDC_old
BufferedDC_old
BufferedPaintDC_old
ScreenDC_old
ClientDC_old
PaintDC_old
WindowDC_old
MirrorDC_old
PostScriptDC_old
MetaFileDC_old
PrinterDC_old
MaskColour

View File

@@ -78,40 +78,45 @@ class App(wx.PyApp):
Every application must have a ``wx.App`` instance, and all
creation of UI objects should be delayed until after the
``wx.App`` object has been created in order to ensure that the
gui platform and wxWidgets have been fully initialized.
``wx.App`` object has been created in order to ensure that the gui
platform and wxWidgets have been fully initialized.
Normally you would derive from this class and implement an
``OnInit`` method that creates a frame and then calls
``self.SetTopWindow(frame)``.
:see: `wx.PySimpleApp` for a simpler app class that can be used directly.
:see: `wx.PySimpleApp` for a simpler app class that can be used
directly.
"""
outputWindowClass = PyOnDemandOutputWindow
def __init__(self, redirect=_defRedirect, filename=None, useBestVisual=False):
def __init__(self, redirect=_defRedirect, filename=None,
useBestVisual=False, clearSigInt=True):
"""
Construct a ``wx.App`` object.
:param redirect: Should ``sys.stdout`` and ``sys.stderr``
be redirected? Defaults to True on Windows and Mac,
False otherwise. If `filename` is None then output
will be redirected to a window that pops up as
needed. (You can control what kind of window is
created for the output by resetting the class
variable ``outputWindowClass`` to a class of your
choosing.)
:param redirect: Should ``sys.stdout`` and ``sys.stderr`` be
redirected? Defaults to True on Windows and Mac, False
otherwise. If `filename` is None then output will be
redirected to a window that pops up as needed. (You can
control what kind of window is created for the output by
resetting the class variable ``outputWindowClass`` to a
class of your choosing.)
:param filename: The name of a file to redirect output
to, if redirect is True.
:param filename: The name of a file to redirect output to, if
redirect is True.
:param useBestVisual: Should the app try to use the best
available visual provided by the system (only
relevant on systems that have more than one visual.)
This parameter must be used instead of calling
`SetUseBestVisual` later on because it must be set
before the underlying GUI toolkit is initialized.
available visual provided by the system (only relevant on
systems that have more than one visual.) This parameter
must be used instead of calling `SetUseBestVisual` later
on because it must be set before the underlying GUI
toolkit is initialized.
:param clearSigInt: Should SIGINT be cleared? This allows the
app to terminate upon a Ctrl-C in the console like other
GUI apps will.
:note: You should override OnInit to do applicaition
initialization to ensure that the system, toolkit and
@@ -140,11 +145,12 @@ your Mac."""
# KeyboardInterrupt???) but will later segfault on exit. By
# setting the default handler then the app will exit, as
# expected (depending on platform.)
try:
import signal
signal.signal(signal.SIGINT, signal.SIG_DFL)
except:
pass
if clearSigInt:
try:
import signal
signal.signal(signal.SIGINT, signal.SIG_DFL)
except:
pass
# Save and redirect the stdio to a window?
self.stdioWin = None
@@ -220,11 +226,12 @@ class PySimpleApp(wx.App):
:see: `wx.App`
"""
def __init__(self, redirect=False, filename=None, useBestVisual=False):
def __init__(self, redirect=False, filename=None,
useBestVisual=False, clearSigInt=True):
"""
:see: `wx.App.__init__`
"""
wx.App.__init__(self, redirect, filename, useBestVisual)
wx.App.__init__(self, redirect, filename, useBestVisual, clearSigInt)
def OnInit(self):
wx.InitAllImageHandlers()

View File

@@ -53,7 +53,7 @@ public:
#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);
@@ -85,25 +85,25 @@ public:
%name(DrawCheckMarkRect) void DrawCheckMark(const wxRect& rect);
void DrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, double sa, double ea);
%name(DrawEllipticArcPtSz) void DrawEllipticArc(const wxPoint& pt, const wxSize& sz, 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(DrawRectanglePtSz) void DrawRectangle(const wxPoint& pt, const wxSize& sz);
%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(DrawRoundedRectanglePtSz) void DrawRoundedRectangle(const wxPoint& pt, const wxSize& sz, 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(DrawEllipsePtSz) void DrawEllipse(const wxPoint& pt, const wxSize& sz);
%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);
@@ -121,14 +121,18 @@ public:
wxDC *source, wxCoord xsrc, wxCoord ysrc,
int rop = wxCOPY, bool useMask = False,
wxCoord xsrcMask = -1, wxCoord ysrcMask = -1);
%name(BlitPtSz) bool Blit(const wxPoint& destPt, const wxSize& sz,
wxDC *source, const wxPoint& srcPt,
int rop = wxCOPY, bool useMask = False,
const wxPoint& srcPtMask = wxDefaultPosition);
%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);
@@ -203,6 +207,12 @@ public:
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);
@@ -266,14 +276,6 @@ public:
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(
@@ -417,8 +419,13 @@ public:
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,
@@ -426,6 +433,11 @@ public:
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);
@@ -440,6 +452,12 @@ public:
// ------------
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.
@@ -861,6 +879,8 @@ public:
// 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):
@@ -898,5 +918,6 @@ MAKE_OLD_DC_CLASS(PostScriptDC);
MAKE_OLD_DC_CLASS(MetaFileDC);
MAKE_OLD_DC_CLASS(PrinterDC);
#endif
//---------------------------------------------------------------------------