Merge pull request #67 from swt2c/add_window_coord_overloads

Add int* overloads for ClientToScreen/ScreenToClient overloads and ad…
This commit is contained in:
Robin Dunn
2016-05-09 21:55:30 -07:00
2 changed files with 16 additions and 3 deletions

View File

@@ -66,11 +66,14 @@ def run():
c.find('GetChildren').noCopy = True
for name in ['GetVirtualSize',
'GetPosition',
'GetScreenPosition',
'ClientToScreen',
'ScreenToClient', ]:
'GetScreenPosition']:
c.find(name).findOverload('int *').ignore()
# Fix ClientToScreen/ScreenToClient int * overloads
for name in ['ClientToScreen', 'ScreenToClient']:
c.find(name).findOverload('int *').find('x').inOut = True
c.find(name).findOverload('int *').find('y').inOut = True
# Like the above, but these also need to transplant the docs from the
# ignored item to the non-ignored overload.
for name in ['GetClientSize', 'GetSize']:

View File

@@ -90,6 +90,16 @@ class WindowTests(wtc.WidgetTestCase):
self.assertEqual(wx.FindWindowById(self.frame.GetId()), self.frame)
def test_windowCoordConvFunctions(self):
w = wx.Window(self.frame, -1, (10,10), (50,50))
a = w.ClientToScreen(0, 0)
b = w.ClientToScreen((0, 0))
c = w.ScreenToClient(0, 0)
d = w.ScreenToClient((0, 0))
self.assertEqual(a[0], b.x)
self.assertEqual(a[1], b.y)
self.assertEqual(c[0], d.x)
self.assertEqual(c[1], d.y)
#---------------------------------------------------------------------------