Sheet support for wxDirDialog.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59354 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -26,7 +26,6 @@ public:
|
|||||||
virtual int ShowModal();
|
virtual int ShowModal();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
wxWindow * m_parent;
|
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxDirDialog)
|
DECLARE_DYNAMIC_CLASS(wxDirDialog)
|
||||||
};
|
};
|
||||||
|
@@ -66,8 +66,36 @@ int wxDirDialog::ShowModal()
|
|||||||
wxCFStringRef dir( m_path );
|
wxCFStringRef dir( m_path );
|
||||||
|
|
||||||
m_path = wxEmptyString;
|
m_path = wxEmptyString;
|
||||||
|
|
||||||
|
wxNonOwnedWindow* parentWindow = NULL;
|
||||||
|
int returnCode = -1;
|
||||||
|
|
||||||
if ( [oPanel runModalForDirectory:dir.AsNSString() file:nil types:nil] == NSOKButton )
|
if (GetParent())
|
||||||
|
{
|
||||||
|
parentWindow = dynamic_cast<wxNonOwnedWindow*>(wxGetTopLevelParent(GetParent()));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fprintf(stderr, "No parent!\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parentWindow)
|
||||||
|
{
|
||||||
|
NSWindow* nativeParent = parentWindow->GetWXWindow();
|
||||||
|
ModalDialogDelegate* sheetDelegate = [[ModalDialogDelegate alloc] init];
|
||||||
|
[oPanel beginSheetForDirectory:dir.AsNSString() file:nil types: nil
|
||||||
|
modalForWindow: nativeParent modalDelegate: sheetDelegate
|
||||||
|
didEndSelector: @selector(sheetDidEnd:returnCode:contextInfo:)
|
||||||
|
contextInfo: nil];
|
||||||
|
[sheetDelegate waitForSheetToFinish];
|
||||||
|
returnCode = [sheetDelegate code];
|
||||||
|
[sheetDelegate release];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
returnCode = (NSInteger)[oPanel runModalForDirectory:dir.AsNSString() file:nil types:nil];
|
||||||
|
}
|
||||||
|
if (returnCode == NSOKButton )
|
||||||
{
|
{
|
||||||
wxCFStringRef resultpath( [[[oPanel filenames] objectAtIndex:0] retain] );
|
wxCFStringRef resultpath( [[[oPanel filenames] objectAtIndex:0] retain] );
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user