Add wxWindow::MSWAfterReparent() virtual function

Refactor the existing code to extract the part of Reparent() updating
the new parent style to an overridable virtual function.

No real changes yet.
This commit is contained in:
Vadim Zeitlin 2022-10-16 21:16:13 +01:00
parent bc07c9a309
commit cd637663c8
2 changed files with 12 additions and 2 deletions

View file

@ -624,6 +624,11 @@ protected:
virtual bool DoPopupMenu( wxMenu *menu, int x, int y ) override;
#endif // wxUSE_MENUS_NATIVE
// Called by Reparent() after the window parent changes, i.e. GetParent()
// returns the new parent inside this function.
virtual void MSWAfterReparent();
// the window handle
WXHWND m_hWnd;

View file

@ -1683,12 +1683,17 @@ bool wxWindowMSW::Reparent(wxWindowBase *parent)
::SetParent(hWndChild, hWndParent);
MSWAfterReparent();
return true;
}
void wxWindowMSW::MSWAfterReparent()
{
if ( wxHasWindowExStyle(this, WS_EX_CONTROLPARENT) )
{
EnsureParentHasControlParentStyle(GetParent());
}
return true;
}
static inline void SendSetRedraw(HWND hwnd, bool on)