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:
Stefan Csomor
2010-09-07 06:51:13 +00:00
parent a94c4b8529
commit d623e8b18a
4 changed files with 33 additions and 5 deletions

View File

@@ -58,6 +58,9 @@ public:
bool Create(wxWindow *parent, WXWindow nativeWindow);
virtual ~wxNonOwnedWindow();
virtual void SubclassWin(WXWindow nativeWindow);
virtual void UnsubclassWin();
virtual wxPoint GetClientAreaOrigin() const;

View File

@@ -602,6 +602,7 @@ int wxFileDialog::ShowModal()
m_dir = wxPathOnly(m_path);
}
UnsubclassWin();
::NavDisposeReply(&navReply);
::NavDialogDispose(dialog);

View File

@@ -275,6 +275,7 @@ int wxFileDialog::ShowModal()
returnCode = [sPanel runModalForDirectory:dir.AsNSString() file:file.AsNSString() ];
ModalFinishedCallback(sPanel, returnCode);
UnsubclassWin();
[sPanel setAccessoryView:nil];
}
else
@@ -295,6 +296,7 @@ int wxFileDialog::ShowModal()
ModalFinishedCallback(oPanel, returnCode);
UnsubclassWin();
[oPanel setAccessoryView:nil];
if ( types != nil )

View File

@@ -149,17 +149,39 @@ bool wxNonOwnedWindow::Create(wxWindow *parent,
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 )
parent->AddChild(this);
SubclassWin(nativeWindow);
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()
{
SendDestroyEvent();