Allow attaching a wxWindow to CWnd later in wxMFCWnd
When using two-step creation, as when loading from resources, for example, it can be convenient to create wxMFCWnd as part of the (parent) wxWindow object, but only attach it to the real HWND later, once it becomes available.
This commit is contained in:
@@ -26,9 +26,20 @@
|
||||
class wxMFCWnd : public CWnd
|
||||
{
|
||||
public:
|
||||
// If default ctor is used, Attach() must be called later.
|
||||
wxMFCWnd()
|
||||
{
|
||||
}
|
||||
|
||||
// Combines default ctor and Attach().
|
||||
explicit wxMFCWnd(wxWindow* w)
|
||||
{
|
||||
Attach(w->GetHWND());
|
||||
Attach(w);
|
||||
}
|
||||
|
||||
void Attach(wxWindow* w)
|
||||
{
|
||||
CWnd::Attach(w->GetHWND());
|
||||
}
|
||||
|
||||
~wxMFCWnd()
|
||||
|
Reference in New Issue
Block a user