mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-07 04:20:07 +01:00
wxRealPoint::operator* truncates to int before assigning to the new point
object, which seems dumb. So let's make our own implementation which preserves the floating point result.
This commit is contained in:
@@ -306,10 +306,16 @@ def run():
|
||||
c.addItem(etgtools.WigCode("""\
|
||||
wxRealPoint operator+(const wxRealPoint& other);
|
||||
wxRealPoint operator-(const wxRealPoint& other);
|
||||
wxRealPoint operator*(double d);
|
||||
wxRealPoint operator/(int i);
|
||||
"""))
|
||||
|
||||
# wxRealPoint::operator* truncates to int before assigning to the new point
|
||||
# object, which seems dumb. So let's make our own implementation which
|
||||
# preserves the floating point result.
|
||||
c.addCppMethod('wxRealPoint*', '__mul__', '(double d)', isSlot=True,
|
||||
body="""\
|
||||
return new wxRealPoint(self->x * d, self->y * d);
|
||||
""")
|
||||
|
||||
# wxRealPoint typemap
|
||||
c.convertFromPyObject = tools.convertTwoDoublesTemplate('wxRealPoint')
|
||||
|
||||
@@ -1236,6 +1236,7 @@ class CppMethodDef(MethodDef):
|
||||
self.cppSignature = cppSignature
|
||||
self.virtualCatcherCode = virtualCatcherCode
|
||||
self.isCore = _globalIsCore
|
||||
self.isSlot = False
|
||||
self.__dict__.update(kw)
|
||||
|
||||
@staticmethod
|
||||
|
||||
@@ -865,7 +865,11 @@ from .%s import *
|
||||
else:
|
||||
if pnames:
|
||||
pnames = ', ' + pnames
|
||||
stream.write('%s(sipCpp%s);\n' % (fname, pnames))
|
||||
if method.isSlot:
|
||||
argname = 'a0'
|
||||
else:
|
||||
argname = 'sipCpp'
|
||||
stream.write('%s(%s%s);\n' % (fname, argname, pnames))
|
||||
else:
|
||||
stream.write('%s(%s);\n' % (fname, pnames))
|
||||
stream.write('%sPy_END_ALLOW_THREADS\n' % (indent+' '*4))
|
||||
|
||||
Reference in New Issue
Block a user