diff --git a/etg/bitmap.py b/etg/bitmap.py index cb349fc9..7b901921 100644 --- a/etg/bitmap.py +++ b/etg/bitmap.py @@ -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 """) diff --git a/etg/cursor.py b/etg/cursor.py index 67338561..5e221fe9 100644 --- a/etg/cursor.py +++ b/etg/cursor.py @@ -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.") diff --git a/etg/dataview.py b/etg/dataview.py index c00f736d..80eade26 100644 --- a/etg/dataview.py +++ b/etg/dataview.py @@ -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;") diff --git a/etg/dc.py b/etg/dc.py index 94e3ab44..0fd9514f 100644 --- a/etg/dc.py +++ b/etg/dc.py @@ -257,7 +257,7 @@ def run(): c.addCppMethod('long', 'GetHDC', '()', """\ #ifdef __WXMSW__ - return (long)self->GetHandle(); + return HandleToLong(self->GetHandle()); #else wxPyRaiseNotImplemented(); return 0; diff --git a/etg/icon.py b/etg/icon.py index 9bd18bca..2733ddd6 100644 --- a/etg/icon.py +++ b/etg/icon.py @@ -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 diff --git a/etg/treelist.py b/etg/treelist.py index 34f22017..ca57ad65 100644 --- a/etg/treelist.py +++ b/etg/treelist.py @@ -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)',