Merge pull request #1972 from jeremyd2019/handle-casts-to-long

WXMSW: use HandleToLong/LongToHandle functions.
This commit is contained in:
Robin Dunn
2021-12-13 21:38:13 -08:00
committed by GitHub
6 changed files with 10 additions and 10 deletions

View File

@@ -106,7 +106,7 @@ def run():
doc='MSW-only method to fetch the windows handle for the bitmap.',
body="""\
#ifdef __WXMSW__
return (long)self->GetHandle();
return HandleToLong(self->GetHandle());
#else
return 0;
#endif
@@ -116,7 +116,7 @@ def run():
doc='MSW-only method to set the windows handle for the bitmap.',
body="""\
#ifdef __WXMSW__
self->SetHandle((WXHANDLE)handle);
self->SetHandle((WXHANDLE)LongToHandle(handle));
#endif
""")

View File

@@ -51,7 +51,7 @@ def run():
c.addCppMethod('long', 'GetHandle', '()', """\
#ifdef __WXMSW__
return (long)self->GetHandle();
return HandleToLong(self->GetHandle());
#else
return 0;
#endif""",
@@ -59,7 +59,7 @@ def run():
c.addCppMethod('void', 'SetHandle', '(long handle)', """\
#ifdef __WXMSW__
self->SetHandle((WXHANDLE)handle);
self->SetHandle((WXHANDLE)LongToHandle(handle));
#endif""",
briefDoc="Set the handle to use for this Cursor. Windows only.")

View File

@@ -82,7 +82,7 @@ def run():
c.addCppMethod('int', '__nonzero__', '()', "return self->IsOk();")
c.addCppMethod('int', '__bool__', '()', "return self->IsOk();")
c.addCppMethod('long', '__hash__', '()', "return (long)self->GetID();")
c.addCppMethod('long', '__hash__', '()', "return (long)(intptr_t)self->GetID();")
c.addCppMethod('bool', '__eq__', '(wxDataViewItem* other)',
"return other ? (self->GetID() == other->GetID()) : false;")

View File

@@ -257,7 +257,7 @@ def run():
c.addCppMethod('long', 'GetHDC', '()', """\
#ifdef __WXMSW__
return (long)self->GetHandle();
return HandleToLong(self->GetHandle());
#else
wxPyRaiseNotImplemented();
return 0;

View File

@@ -56,7 +56,7 @@ def run():
c.addCppMethod('long', 'GetHandle', '()', """\
#ifdef __WXMSW__
return (long)self->GetHandle();
return HandleToLong(self->GetHandle());
#else
return 0;
#endif
@@ -64,7 +64,7 @@ def run():
c.addCppMethod('void', 'SetHandle', '(long handle)', """\
#ifdef __WXMSW__
self->SetHandle((WXHANDLE)handle);
self->SetHandle((WXHANDLE)LongToHandle(handle));
#endif
""")
@@ -73,7 +73,7 @@ def run():
doc='MSW-only method to create a wx.Icon from a native icon handle.',
body="""\
#ifdef __WXMSW__
return self->CreateFromHICON((WXHICON)hicon);
return self->CreateFromHICON((WXHICON)LongToHandle(hicon));
#else
return false;
#endif

View File

@@ -47,7 +47,7 @@ def run():
c.addCppMethod('int', '__bool__', '()', "return self->IsOk();")
c.addCppMethod('long', '__hash__', '()', """\
return (long)self->GetID();
return (long)(intptr_t)self->GetID();
""")
c.addCppMethod('bool', '__eq__', '(wxTreeListItem* other)',