bool wxFileDialog::SupportsExtraControl() const
{
- return false;
+ return true;
}
NSArray* GetTypesFromFilter( const wxString filter )
if (HasFlag(wxFD_SAVE))
{
NSSavePanel* sPanel = [NSSavePanel savePanel];
+
+ SetupExtraControls(sPanel);
+
// makes things more convenient:
[sPanel setCanCreateDirectories:YES];
[sPanel setMessage:cf.AsNSString()];
{
NSArray* types = GetTypesFromFilter( m_wildCard ) ;
NSOpenPanel* oPanel = [NSOpenPanel openPanel];
+
+ SetupExtraControls(oPanel);
+
[oPanel setTreatsFilePackagesAsDirectories:NO];
[oPanel setCanChooseDirectories:NO];
[oPanel setResolvesAliases:YES];
}
}
-int wxFileDialog::ShowModal()
+void wxFileDialog::SetupExtraControls(WXWindow nativeWindow)
{
- NSSavePanel *panel = nil;
+ NSSavePanel* panel = (NSSavePanel*) nativeWindow;
+
+ wxNonOwnedWindow::Create( GetParent(), nativeWindow );
+
+ if (HasExtraControlCreator())
+ {
+ CreateExtraControl();
+ wxWindow* control = GetExtraControl();
+ if ( control )
+ {
+ NSView* accView = control->GetHandle();
+ [accView removeFromSuperview];
+ [panel setAccessoryView:accView];
+ }
+ else
+ {
+ [panel setAccessoryView:nil];
+ }
+ }
+}
+int wxFileDialog::ShowModal()
+{
wxCFStringRef cf( m_message );
wxCFStringRef dir( m_dir );
if (HasFlag(wxFD_SAVE))
{
NSSavePanel* sPanel = [NSSavePanel savePanel];
+
+ SetupExtraControls(sPanel);
+
// makes things more convenient:
[sPanel setCanCreateDirectories:YES];
[sPanel setMessage:cf.AsNSString()];
returnCode = [sPanel runModalForDirectory:dir.AsNSString() file:file.AsNSString() ];
ModalFinishedCallback(sPanel, returnCode);
+
+ [sPanel setAccessoryView:nil];
}
else
{
NSArray* types = GetTypesFromFilter( m_wildCard ) ;
NSOpenPanel* oPanel = [NSOpenPanel openPanel];
+
+ SetupExtraControls(oPanel);
+
[oPanel setTreatsFilePackagesAsDirectories:NO];
[oPanel setCanChooseDirectories:NO];
[oPanel setResolvesAliases:YES];
ModalFinishedCallback(oPanel, returnCode);
+ [oPanel setAccessoryView:nil];
+
if ( types != nil )
[types release];
}
if (GetModality() == wxDIALOG_MODALITY_WINDOW_MODAL)
SendWindowModalDialogEvent ( wxEVT_WINDOW_MODAL_DIALOG_CLOSED );
+
+ [(NSSavePanel*) panel setAccessoryView:nil];
}
#endif // wxUSE_FILEDLG