added As/DissociateHandle() and implemented it for MSW (modified patch 972356)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29102 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
4c27e2faf3
commit
ed4780ea6e
@ -148,16 +148,20 @@ public:
|
|||||||
virtual bool UnregisterHotKey(int hotkeyId);
|
virtual bool UnregisterHotKey(int hotkeyId);
|
||||||
#endif // wxUSE_HOTKEY
|
#endif // wxUSE_HOTKEY
|
||||||
|
|
||||||
// implementation from now on
|
// window handle stuff
|
||||||
// --------------------------
|
// -------------------
|
||||||
|
|
||||||
// simple accessors
|
|
||||||
// ----------------
|
|
||||||
|
|
||||||
WXHWND GetHWND() const { return m_hWnd; }
|
WXHWND GetHWND() const { return m_hWnd; }
|
||||||
void SetHWND(WXHWND hWnd) { m_hWnd = hWnd; }
|
void SetHWND(WXHWND hWnd) { m_hWnd = hWnd; }
|
||||||
virtual WXWidget GetHandle() const { return GetHWND(); }
|
virtual WXWidget GetHandle() const { return GetHWND(); }
|
||||||
|
|
||||||
|
void AssociateHandle(WXWidget handle);
|
||||||
|
void DissociateHandle();
|
||||||
|
|
||||||
|
|
||||||
|
// implementation from now on
|
||||||
|
// ==========================
|
||||||
|
|
||||||
// event handlers
|
// event handlers
|
||||||
// --------------
|
// --------------
|
||||||
|
|
||||||
|
@ -1018,6 +1018,10 @@ public:
|
|||||||
// is only used for wxWin itself or for user code which wants to call
|
// is only used for wxWin itself or for user code which wants to call
|
||||||
// platform-specific APIs
|
// platform-specific APIs
|
||||||
virtual WXWidget GetHandle() const = 0;
|
virtual WXWidget GetHandle() const = 0;
|
||||||
|
// associate the window with a new native handle
|
||||||
|
virtual void AssociateHandle(WXWidget WXUNUSED(handle)) { }
|
||||||
|
// dissociate the current native handle from the window
|
||||||
|
virtual void DissociateHandle() { }
|
||||||
|
|
||||||
#if wxUSE_PALETTE
|
#if wxUSE_PALETTE
|
||||||
// Store the palette used by DCs in wxWindow so that the dcs can share
|
// Store the palette used by DCs in wxWindow so that the dcs can share
|
||||||
|
@ -1005,7 +1005,7 @@ void wxWindowMSW::UnsubclassWin()
|
|||||||
HWND hwnd = GetHwnd();
|
HWND hwnd = GetHwnd();
|
||||||
if ( hwnd )
|
if ( hwnd )
|
||||||
{
|
{
|
||||||
m_hWnd = 0;
|
SetHWND(0);
|
||||||
|
|
||||||
wxCHECK_RET( ::IsWindow(hwnd), wxT("invalid HWND in UnsubclassWin") );
|
wxCHECK_RET( ::IsWindow(hwnd), wxT("invalid HWND in UnsubclassWin") );
|
||||||
|
|
||||||
@ -1021,6 +1021,27 @@ void wxWindowMSW::UnsubclassWin()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxWindowMSW::AssociateHandle(WXWidget handle)
|
||||||
|
{
|
||||||
|
if ( m_hWnd )
|
||||||
|
{
|
||||||
|
if ( !::DestroyWindow(GetHwnd()) )
|
||||||
|
wxLogLastError(wxT("DestroyWindow"));
|
||||||
|
}
|
||||||
|
|
||||||
|
WXHWND wxhwnd = (WXHWND)handle;
|
||||||
|
|
||||||
|
SetHWND(wxhwnd);
|
||||||
|
SubclassWin(wxhwnd);
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxWindowMSW::DissociateHandle()
|
||||||
|
{
|
||||||
|
// this also calls SetHWND(0) for us
|
||||||
|
UnsubclassWin();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool wxCheckWindowWndProc(WXHWND hWnd, WXFARPROC wndProc)
|
bool wxCheckWindowWndProc(WXHWND hWnd, WXFARPROC wndProc)
|
||||||
{
|
{
|
||||||
// Unicows note: the code below works, but only because WNDCLASS contains
|
// Unicows note: the code below works, but only because WNDCLASS contains
|
||||||
|
Loading…
Reference in New Issue
Block a user