SWIGged updates for wxMac

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@18290 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2002-12-17 02:27:37 +00:00
parent daddf28343
commit fe80017b0b
8 changed files with 1054 additions and 202 deletions

View File

@@ -17,9 +17,9 @@ import string
import types
def wxMemoryFSHandler_AddFile(filename, a, b=''):
if isinstance(a, wxImage):
if wx.wxPy_isinstance(a, (wxImage, wxImagePtr)):
__wxMemoryFSHandler_AddFile_wxImage(filename, a, b)
elif isinstance(a, wxBitmap):
elif wx.wxPy_isinstance(a, (wxBitmap, wxBitmapPtr)):
__wxMemoryFSHandler_AddFile_wxBitmap(filename, a, b)
elif type(a) == types.StringType:
#__wxMemoryFSHandler_AddFile_wxString(filename, a)

View File

@@ -7691,7 +7691,7 @@ static PyObject * wxDC__DrawPointList(wxDC *self,PyObject * pyPoints,PyObject *
else {
obj = PySequence_GetItem(pyPoints, i);
}
if (! _2int_seq_helper(obj, &x1, &y1)) {
if (! wxPy2int_seq_helper(obj, &x1, &y1)) {
if (!isFastPens)
Py_DECREF(obj);
goto err0;
@@ -7816,7 +7816,7 @@ static PyObject * wxDC__DrawLineList(wxDC *self,PyObject * pyLines,PyObject * py
else {
obj = PySequence_GetItem(pyLines, i);
}
if (! _4int_seq_helper(obj, &x1, &y1, &x2, &y2)) {
if (! wxPy4int_seq_helper(obj, &x1, &y1, &x2, &y2)) {
if (!isFastPens)
Py_DECREF(obj);
goto err0;

View File

@@ -760,7 +760,7 @@ class wxDCPtr(wxObjectPtr):
def DrawPointList(self, points, pens=None):
if pens is None:
pens = []
elif isinstance(pens, wxPenPtr):
elif wx.wxPy_isinstance(pens, (wxPen, wxPenPtr)):
pens = [pens]
elif len(pens) != len(points):
raise ValueError('points and pens must have same length')
@@ -769,7 +769,7 @@ class wxDCPtr(wxObjectPtr):
def DrawLineList(self, lines, pens=None):
if pens is None:
pens = []
elif isinstance(pens, wxPenPtr):
elif wx.wxPy_isinstance(pens, (wxPen, wxPenPtr)):
pens = [pens]
elif len(pens) != len(lines):
raise ValueError('lines and pens must have same length')

File diff suppressed because it is too large Load Diff

View File

@@ -50,9 +50,6 @@ class wxSizePtr :
def asTuple(self, *_args, **_kwargs):
val = apply(miscc.wxSize_asTuple,(self,) + _args, _kwargs)
return val
def __cmp__(self, *_args, **_kwargs):
val = apply(miscc.wxSize___cmp__,(self,) + _args, _kwargs)
return val
def __eq__(self, *_args, **_kwargs):
val = apply(miscc.wxSize___eq__,(self,) + _args, _kwargs)
return val
@@ -125,9 +122,6 @@ class wxRealPointPtr :
val = apply(miscc.wxRealPoint___sub__,(self,) + _args, _kwargs)
if val: val = wxRealPointPtr(val) ; val.thisown = 1
return val
def __cmp__(self, *_args, **_kwargs):
val = apply(miscc.wxRealPoint___cmp__,(self,) + _args, _kwargs)
return val
def __eq__(self, *_args, **_kwargs):
val = apply(miscc.wxRealPoint___eq__,(self,) + _args, _kwargs)
return val
@@ -190,9 +184,6 @@ class wxPointPtr :
val = apply(miscc.wxPoint___sub__,(self,) + _args, _kwargs)
if val: val = wxPointPtr(val) ; val.thisown = 1
return val
def __cmp__(self, *_args, **_kwargs):
val = apply(miscc.wxPoint___cmp__,(self,) + _args, _kwargs)
return val
def __eq__(self, *_args, **_kwargs):
val = apply(miscc.wxPoint___eq__,(self,) + _args, _kwargs)
return val
@@ -316,9 +307,6 @@ class wxRectPtr :
val = apply(miscc.wxRect___add__,(self,) + _args, _kwargs)
if val: val = wxRectPtr(val) ; val.thisown = 1
return val
def __cmp__(self, *_args, **_kwargs):
val = apply(miscc.wxRect___cmp__,(self,) + _args, _kwargs)
return val
def __eq__(self, *_args, **_kwargs):
val = apply(miscc.wxRect___eq__,(self,) + _args, _kwargs)
return val
@@ -409,6 +397,131 @@ class wxRect(wxRectPtr):
class wxPoint2DDoublePtr :
def __init__(self,this):
self.this = this
self.thisown = 0
def GetFloor(self, *_args, **_kwargs):
val = apply(miscc.wxPoint2DDouble_GetFloor,(self,) + _args, _kwargs)
return val
def GetRounded(self, *_args, **_kwargs):
val = apply(miscc.wxPoint2DDouble_GetRounded,(self,) + _args, _kwargs)
return val
def GetVectorLength(self, *_args, **_kwargs):
val = apply(miscc.wxPoint2DDouble_GetVectorLength,(self,) + _args, _kwargs)
return val
def GetVectorAngle(self, *_args, **_kwargs):
val = apply(miscc.wxPoint2DDouble_GetVectorAngle,(self,) + _args, _kwargs)
return val
def SetVectorLength(self, *_args, **_kwargs):
val = apply(miscc.wxPoint2DDouble_SetVectorLength,(self,) + _args, _kwargs)
return val
def SetVectorAngle(self, *_args, **_kwargs):
val = apply(miscc.wxPoint2DDouble_SetVectorAngle,(self,) + _args, _kwargs)
return val
def GetDistance(self, *_args, **_kwargs):
val = apply(miscc.wxPoint2DDouble_GetDistance,(self,) + _args, _kwargs)
return val
def GetDistanceSquare(self, *_args, **_kwargs):
val = apply(miscc.wxPoint2DDouble_GetDistanceSquare,(self,) + _args, _kwargs)
return val
def GetDotProduct(self, *_args, **_kwargs):
val = apply(miscc.wxPoint2DDouble_GetDotProduct,(self,) + _args, _kwargs)
return val
def GetCrossProduct(self, *_args, **_kwargs):
val = apply(miscc.wxPoint2DDouble_GetCrossProduct,(self,) + _args, _kwargs)
return val
def __neg__(self, *_args, **_kwargs):
val = apply(miscc.wxPoint2DDouble___neg__,(self,) + _args, _kwargs)
if val: val = wxPoint2DDoublePtr(val) ; val.thisown = 1
return val
def __iadd__(self, *_args, **_kwargs):
val = apply(miscc.wxPoint2DDouble___iadd__,(self,) + _args, _kwargs)
if val: val = wxPoint2DDoublePtr(val)
return val
def __isub__(self, *_args, **_kwargs):
val = apply(miscc.wxPoint2DDouble___isub__,(self,) + _args, _kwargs)
if val: val = wxPoint2DDoublePtr(val)
return val
def __imul__(self, *_args, **_kwargs):
val = apply(miscc.wxPoint2DDouble___imul__,(self,) + _args, _kwargs)
if val: val = wxPoint2DDoublePtr(val)
return val
def __idiv__(self, *_args, **_kwargs):
val = apply(miscc.wxPoint2DDouble___idiv__,(self,) + _args, _kwargs)
if val: val = wxPoint2DDoublePtr(val)
return val
def __eq__(self, *_args, **_kwargs):
val = apply(miscc.wxPoint2DDouble___eq__,(self,) + _args, _kwargs)
return val
def __ne__(self, *_args, **_kwargs):
val = apply(miscc.wxPoint2DDouble___ne__,(self,) + _args, _kwargs)
return val
def asTuple(self, *_args, **_kwargs):
val = apply(miscc.wxPoint2DDouble_asTuple,(self,) + _args, _kwargs)
return val
def __setattr__(self,name,value):
if name == "m_x" :
miscc.wxPoint2DDouble_m_x_set(self,value)
return
if name == "m_y" :
miscc.wxPoint2DDouble_m_y_set(self,value)
return
if name == "x" :
miscc.wxPoint2DDouble_x_set(self,value)
return
if name == "y" :
miscc.wxPoint2DDouble_y_set(self,value)
return
self.__dict__[name] = value
def __getattr__(self,name):
if name == "m_x" :
return miscc.wxPoint2DDouble_m_x_get(self)
if name == "m_y" :
return miscc.wxPoint2DDouble_m_y_get(self)
if name == "x" :
return miscc.wxPoint2DDouble_x_get(self)
if name == "y" :
return miscc.wxPoint2DDouble_y_get(self)
raise AttributeError,name
def __repr__(self):
return "<C wxPoint2DDouble instance at %s>" % (self.this,)
def SetPolarCoordinates(self, angle, length):
self.SetVectorLength(length)
self.SetVectorAngle(angle)
def Normalize(self):
self.SetVectorLength(1.0)
def __str__(self): return str(self.asTuple())
def __repr__(self): return str(self.asTuple())
def __len__(self): return len(self.asTuple())
def __getitem__(self, index): return self.asTuple()[index]
def __setitem__(self, index, val):
if index == 0: self.m_x = val
elif index == 1: self.m_yt = val
else: raise IndexError
def __nonzero__(self): return self.asTuple() != (0.0, 0.0)
class wxPoint2DDouble(wxPoint2DDoublePtr):
def __init__(self,*_args,**_kwargs):
self.this = apply(miscc.new_wxPoint2DDouble,_args,_kwargs)
self.thisown = 1
def wxPoint2DDoubleCopy(*_args,**_kwargs):
val = wxPoint2DDoublePtr(apply(miscc.new_wxPoint2DDoubleCopy,_args,_kwargs))
val.thisown = 1
return val
def wxPoint2DDoubleFromPoint(*_args,**_kwargs):
val = wxPoint2DDoublePtr(apply(miscc.new_wxPoint2DDoubleFromPoint,_args,_kwargs))
val.thisown = 1
return val
class wxIndividualLayoutConstraintPtr(wxObjectPtr):
def __init__(self,this):
self.this = this

View File

@@ -1503,11 +1503,13 @@ static PyObject *_wrap_wxSafeYield(PyObject *self, PyObject *args, PyObject *kwa
PyObject * _resultobj;
bool _result;
wxWindow * _arg0 = (wxWindow *) NULL;
bool _arg1 = (bool ) FALSE;
PyObject * _argo0 = 0;
char *_kwnames[] = { "win", NULL };
int tempbool1 = (int) FALSE;
char *_kwnames[] = { "win","onlyIfNeeded", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"|O:wxSafeYield",_kwnames,&_argo0))
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"|Oi:wxSafeYield",_kwnames,&_argo0,&tempbool1))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
@@ -1516,9 +1518,10 @@ static PyObject *_wrap_wxSafeYield(PyObject *self, PyObject *args, PyObject *kwa
return NULL;
}
}
_arg1 = (bool ) tempbool1;
{
PyThreadState* __tstate = wxPyBeginAllowThreads();
_result = (bool )wxSafeYield(_arg0);
_result = (bool )wxSafeYield(_arg0,_arg1);
wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) return NULL;

View File

@@ -666,6 +666,7 @@ static wxPyCoreAPI API = {
wxRealPoint_helper,
wxRect_helper,
wxColour_helper,
wxPoint2DDouble_helper,
wxPyCBH_setCallbackInfo,
wxPyCBH_findCallback,

View File

@@ -1528,7 +1528,7 @@ wxColor = wxColour
wxNamedColor = wxNamedColour
wxPen = wxPyPen
wxScrollbar = wxScrollBar
wxPoint2D = wxPoint2DDouble
# backwards compatibility
wxNoRefBitmap = wxBitmap
@@ -1542,6 +1542,7 @@ wxSystemSettings_GetSystemMetric = wxSystemSettings_GetMetric
wxPyAssertionError = wxc.wxPyAssertionError
#----------------------------------------------------------------------
# wxGTK sets the locale when initialized. Doing this at the Python
# level should set it up to match what GTK is doing at the C level.
@@ -1602,6 +1603,18 @@ def wxPyTypeCast(obj, typeStr):
theObj.thisown = obj.thisown
return theObj
#----------------------------------------------------------------------------
# An isinstance for Pythons < 2.2 that can check a sequence of class objects
# like the one in 2.2 can.
def wxPy_isinstance(obj, klasses):
import types
if sys.version[:3] < "2.2" and type(klasses) in [types.TupleType, types.ListType]:
for klass in klasses:
if isinstance(obj, klass): return true
return false
else:
return isinstance(obj, klasses)
#----------------------------------------------------------------------------
_wxCallAfterId = None