modeling subclassing along msw, unsubclassing filedialog at end of ShowModal, fixes #12236
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65474 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -59,6 +59,9 @@ public:
|
|||||||
|
|
||||||
virtual ~wxNonOwnedWindow();
|
virtual ~wxNonOwnedWindow();
|
||||||
|
|
||||||
|
virtual void SubclassWin(WXWindow nativeWindow);
|
||||||
|
virtual void UnsubclassWin();
|
||||||
|
|
||||||
virtual wxPoint GetClientAreaOrigin() const;
|
virtual wxPoint GetClientAreaOrigin() const;
|
||||||
|
|
||||||
// implement base class pure virtuals
|
// implement base class pure virtuals
|
||||||
|
@@ -602,6 +602,7 @@ int wxFileDialog::ShowModal()
|
|||||||
m_dir = wxPathOnly(m_path);
|
m_dir = wxPathOnly(m_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UnsubclassWin();
|
||||||
::NavDisposeReply(&navReply);
|
::NavDisposeReply(&navReply);
|
||||||
::NavDialogDispose(dialog);
|
::NavDialogDispose(dialog);
|
||||||
|
|
||||||
|
@@ -275,6 +275,7 @@ int wxFileDialog::ShowModal()
|
|||||||
returnCode = [sPanel runModalForDirectory:dir.AsNSString() file:file.AsNSString() ];
|
returnCode = [sPanel runModalForDirectory:dir.AsNSString() file:file.AsNSString() ];
|
||||||
ModalFinishedCallback(sPanel, returnCode);
|
ModalFinishedCallback(sPanel, returnCode);
|
||||||
|
|
||||||
|
UnsubclassWin();
|
||||||
[sPanel setAccessoryView:nil];
|
[sPanel setAccessoryView:nil];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -295,6 +296,7 @@ int wxFileDialog::ShowModal()
|
|||||||
|
|
||||||
ModalFinishedCallback(oPanel, returnCode);
|
ModalFinishedCallback(oPanel, returnCode);
|
||||||
|
|
||||||
|
UnsubclassWin();
|
||||||
[oPanel setAccessoryView:nil];
|
[oPanel setAccessoryView:nil];
|
||||||
|
|
||||||
if ( types != nil )
|
if ( types != nil )
|
||||||
|
@@ -149,17 +149,39 @@ bool wxNonOwnedWindow::Create(wxWindow *parent,
|
|||||||
|
|
||||||
bool wxNonOwnedWindow::Create(wxWindow *parent, WXWindow nativeWindow)
|
bool wxNonOwnedWindow::Create(wxWindow *parent, WXWindow nativeWindow)
|
||||||
{
|
{
|
||||||
m_nowpeer = wxNonOwnedWindowImpl::CreateNonOwnedWindow(this, parent, nativeWindow );
|
|
||||||
m_isNativeWindowWrapper = true;
|
|
||||||
wxNonOwnedWindowImpl::Associate( m_nowpeer->GetWXWindow() , m_nowpeer ) ;
|
|
||||||
m_peer = wxWidgetImpl::CreateContentView(this);
|
|
||||||
|
|
||||||
if ( parent )
|
if ( parent )
|
||||||
parent->AddChild(this);
|
parent->AddChild(this);
|
||||||
|
|
||||||
|
SubclassWin(nativeWindow);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxNonOwnedWindow::SubclassWin(WXWindow nativeWindow)
|
||||||
|
{
|
||||||
|
wxASSERT_MSG( !m_isNativeWindowWrapper, wxT("subclassing window twice?") );
|
||||||
|
wxASSERT_MSG( m_nowpeer == NULL, wxT("window already was created") );
|
||||||
|
|
||||||
|
m_nowpeer = wxNonOwnedWindowImpl::CreateNonOwnedWindow(this, GetParent(), nativeWindow );
|
||||||
|
m_isNativeWindowWrapper = true;
|
||||||
|
wxNonOwnedWindowImpl::Associate( m_nowpeer->GetWXWindow() , m_nowpeer ) ;
|
||||||
|
m_peer = wxWidgetImpl::CreateContentView(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxNonOwnedWindow::UnsubclassWin()
|
||||||
|
{
|
||||||
|
wxASSERT_MSG( m_isNativeWindowWrapper, wxT("window was not subclassed") );
|
||||||
|
|
||||||
|
if ( GetParent() )
|
||||||
|
GetParent()->RemoveChild(this);
|
||||||
|
|
||||||
|
wxNonOwnedWindowImpl::RemoveAssociations(m_nowpeer) ;
|
||||||
|
m_isNativeWindowWrapper = false;
|
||||||
|
wxDELETE(m_nowpeer);
|
||||||
|
wxDELETE(m_peer);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
wxNonOwnedWindow::~wxNonOwnedWindow()
|
wxNonOwnedWindow::~wxNonOwnedWindow()
|
||||||
{
|
{
|
||||||
SendDestroyEvent();
|
SendDestroyEvent();
|
||||||
|
Reference in New Issue
Block a user