add member for sheetdialog

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67897 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2011-06-09 00:29:13 +00:00
parent 681bf55c1c
commit 4d3e2dc993
3 changed files with 26 additions and 13 deletions

View File

@@ -45,6 +45,13 @@ wxDirDialog::wxDirDialog(wxWindow *parent, const wxString& message,
SetMessage( message ); SetMessage( message );
SetWindowStyle(style); SetWindowStyle(style);
SetPath(defaultPath); SetPath(defaultPath);
m_sheetDelegate = [[ModalDialogDelegate alloc] init];
[(ModalDialogDelegate*)m_sheetDelegate setImplementation: this];
}
wxDirDialog::~wxDirDialog()
{
[m_sheetDelegate release];
} }
void wxDirDialog::ShowWindowModal() void wxDirDialog::ShowWindowModal()
@@ -74,10 +81,8 @@ void wxDirDialog::ShowWindowModal()
if (parentWindow) if (parentWindow)
{ {
NSWindow* nativeParent = parentWindow->GetWXWindow(); NSWindow* nativeParent = parentWindow->GetWXWindow();
ModalDialogDelegate* sheetDelegate = [[ModalDialogDelegate alloc] init];
[sheetDelegate setImplementation: this];
[oPanel beginSheetForDirectory:dir.AsNSString() file:nil types: nil [oPanel beginSheetForDirectory:dir.AsNSString() file:nil types: nil
modalForWindow: nativeParent modalDelegate: sheetDelegate modalForWindow: nativeParent modalDelegate: m_sheetDelegate
didEndSelector: @selector(sheetDidEnd:returnCode:contextInfo:) didEndSelector: @selector(sheetDidEnd:returnCode:contextInfo:)
contextInfo: nil]; contextInfo: nil];
} }

View File

@@ -65,7 +65,7 @@
- (id) init - (id) init
{ {
[super init]; self = [super init];
_dialog = NULL; _dialog = NULL;
return self; return self;
} }
@@ -164,6 +164,13 @@ wxFileDialog::wxFileDialog(
: wxFileDialogBase(parent, message, defaultDir, defaultFileName, wildCard, style, pos, sz, name) : wxFileDialogBase(parent, message, defaultDir, defaultFileName, wildCard, style, pos, sz, name)
{ {
m_filterIndex = -1; m_filterIndex = -1;
m_sheetDelegate = [[ModalDialogDelegate alloc] init];
[(ModalDialogDelegate*)m_sheetDelegate setImplementation: this];
}
wxFileDialog::~wxFileDialog()
{
[m_sheetDelegate release];
} }
bool wxFileDialog::SupportsExtraControl() const bool wxFileDialog::SupportsExtraControl() const
@@ -308,10 +315,8 @@ void wxFileDialog::ShowWindowModal()
[sPanel setAllowsOtherFileTypes:NO]; [sPanel setAllowsOtherFileTypes:NO];
NSWindow* nativeParent = parentWindow->GetWXWindow(); NSWindow* nativeParent = parentWindow->GetWXWindow();
ModalDialogDelegate* sheetDelegate = [[ModalDialogDelegate alloc] init];
[sheetDelegate setImplementation: this];
[sPanel beginSheetForDirectory:dir.AsNSString() file:file.AsNSString() [sPanel beginSheetForDirectory:dir.AsNSString() file:file.AsNSString()
modalForWindow: nativeParent modalDelegate: sheetDelegate modalForWindow: nativeParent modalDelegate: m_sheetDelegate
didEndSelector: @selector(sheetDidEnd:returnCode:contextInfo:) didEndSelector: @selector(sheetDidEnd:returnCode:contextInfo:)
contextInfo: nil]; contextInfo: nil];
} }
@@ -329,11 +334,9 @@ void wxFileDialog::ShowWindowModal()
[oPanel setAllowsMultipleSelection: (HasFlag(wxFD_MULTIPLE) ? YES : NO )]; [oPanel setAllowsMultipleSelection: (HasFlag(wxFD_MULTIPLE) ? YES : NO )];
NSWindow* nativeParent = parentWindow->GetWXWindow(); NSWindow* nativeParent = parentWindow->GetWXWindow();
ModalDialogDelegate* sheetDelegate = [[ModalDialogDelegate alloc] init];
[sheetDelegate setImplementation: this];
[oPanel beginSheetForDirectory:dir.AsNSString() file:file.AsNSString() [oPanel beginSheetForDirectory:dir.AsNSString() file:file.AsNSString()
types: types modalForWindow: nativeParent types: types modalForWindow: nativeParent
modalDelegate: sheetDelegate modalDelegate: m_sheetDelegate
didEndSelector: @selector(sheetDidEnd:returnCode:contextInfo:) didEndSelector: @selector(sheetDidEnd:returnCode:contextInfo:)
contextInfo: nil]; contextInfo: nil];
} }

View File

@@ -49,6 +49,13 @@ wxMessageDialog::wxMessageDialog(wxWindow *parent,
const wxPoint& WXUNUSED(pos)) const wxPoint& WXUNUSED(pos))
: wxMessageDialogBase(parent, message, caption, style) : wxMessageDialogBase(parent, message, caption, style)
{ {
m_sheetDelegate = [[ModalDialogDelegate alloc] init];
[(ModalDialogDelegate*)m_sheetDelegate setImplementation: this];
}
wxMessageDialog::~wxMessageDialog()
{
[m_sheetDelegate release];
} }
int wxMessageDialog::ShowModal() int wxMessageDialog::ShowModal()
@@ -167,9 +174,7 @@ void wxMessageDialog::ShowWindowModal()
if (parentWindow) if (parentWindow)
{ {
NSWindow* nativeParent = parentWindow->GetWXWindow(); NSWindow* nativeParent = parentWindow->GetWXWindow();
ModalDialogDelegate* sheetDelegate = [[ModalDialogDelegate alloc] init]; [alert beginSheetModalForWindow: nativeParent modalDelegate: m_sheetDelegate
[sheetDelegate setImplementation: this];
[alert beginSheetModalForWindow: nativeParent modalDelegate: sheetDelegate
didEndSelector: @selector(sheetDidEnd:returnCode:contextInfo:) didEndSelector: @selector(sheetDidEnd:returnCode:contextInfo:)
contextInfo: nil]; contextInfo: nil];
} }