diff --git a/src/app_ex.py b/src/app_ex.py index ebbe9b41..9fba86bf 100644 --- a/src/app_ex.py +++ b/src/app_ex.py @@ -237,19 +237,6 @@ logged in on the main display of your Mac.""" #---------------------------------------------------------------------------- -# TODO: Move this someplace else? -def deprecated(func): - def new_func(*args, **kwargs): - import warnings - warnings.warn("Call to deprecated item %s." % func.__name__, - category=DeprecationWarning) - return func(*args, **kwargs) - new_func.__name__ = func.__name__ - new_func.__doc__ = func.__doc__ - new_func.__dict__.update(func.__dict__) - return new_func - - @deprecated class PySimpleApp(App): """ diff --git a/src/core_ex.py b/src/core_ex.py index b3cb2d13..a6d55964 100644 --- a/src/core_ex.py +++ b/src/core_ex.py @@ -1,7 +1,13 @@ + +# A little trick to make 'wx' be a reference to this module so wx.Names can +# be used in the python code here. +import sys as _sys +wx = _sys.modules[__name__] + + # Load version numbers from __version__... Ensure that major and minor # versions are the same for both wxPython and wxWidgets. - from __version__ import * __version__ = VERSION_STRING import _core @@ -30,7 +36,21 @@ def version(): port = '???' return "%s %s" % (wx.VERSION_STRING, port) - + + +def deprecated(func): + def new_func(*args, **kwargs): + import warnings + warnings.warn("Call to deprecated item %s." % func.__name__, + category=DeprecationWarning) + return func(*args, **kwargs) + new_func.__name__ = func.__name__ + new_func.__doc__ = func.__doc__ + new_func.__dict__.update(func.__dict__) + return new_func + + + ## #---------------------------------------------------------------------------- ## class PyDeadObjectError(AttributeError): diff --git a/src/window_ex.cpp b/src/window_ex.cpp new file mode 100644 index 00000000..d111067e --- /dev/null +++ b/src/window_ex.cpp @@ -0,0 +1,30 @@ + +#ifdef __WXMSW__ +#include +#endif + +#ifdef __WXGTK__ +#include +#include +#define GetXWindow(wxwin) (wxwin)->m_wxwindow ? \ + GDK_WINDOW_XWINDOW((wxwin)->m_wxwindow->window) : \ + GDK_WINDOW_XWINDOW((wxwin)->m_widget->window) +#endif + + + + + +void* wxPyGetWinHandle(wxWindow* win) +{ +#ifdef __WXMSW__ + return (void*)win->GetHandle(); +#endif +#if defined(__WXGTK__) || defined(__WXX11__) + return (void*)GetXWindow(win); +#endif +#ifdef __WXMAC__ + return (void*)win->GetHandle(); +#endif + return 0; +}