SWIGged updates for wxMSW

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@18196 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2002-12-12 03:56:58 +00:00
parent f8a1c24cca
commit 3e87f7c085
6 changed files with 1046 additions and 197 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

@@ -831,7 +831,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')
@@ -840,7 +840,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

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

View File

@@ -1534,7 +1534,7 @@ wxColor = wxColour
wxNamedColor = wxNamedColour
wxPen = wxPyPen
wxScrollbar = wxScrollBar
wxPoint2D = wxPoint2DDouble
# backwards compatibility
wxNoRefBitmap = wxBitmap
@@ -1548,6 +1548,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.
@@ -1608,6 +1609,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