Show all other supported window modal dialogs in the sample too
This commit is contained in:
committed by
Vadim Zeitlin
parent
f585878136
commit
be9216b6b1
@@ -143,6 +143,7 @@ wxBEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
|||||||
EVT_MENU(DIALOGS_MESSAGE_BOX, MyFrame::MessageBox)
|
EVT_MENU(DIALOGS_MESSAGE_BOX, MyFrame::MessageBox)
|
||||||
EVT_MENU(DIALOGS_MESSAGE_BOX_WINDOW_MODAL, MyFrame::MessageBoxWindowModal)
|
EVT_MENU(DIALOGS_MESSAGE_BOX_WINDOW_MODAL, MyFrame::MessageBoxWindowModal)
|
||||||
EVT_MENU(DIALOGS_MESSAGE_DIALOG, MyFrame::MessageBoxDialog)
|
EVT_MENU(DIALOGS_MESSAGE_DIALOG, MyFrame::MessageBoxDialog)
|
||||||
|
EVT_MENU(DIALOGS_MESSAGE_DIALOG_WINDOW_MODAL, MyFrame::MessageBoxDialogWindowModal)
|
||||||
EVT_MENU(DIALOGS_MESSAGE_BOX_WXINFO, MyFrame::MessageBoxInfo)
|
EVT_MENU(DIALOGS_MESSAGE_BOX_WXINFO, MyFrame::MessageBoxInfo)
|
||||||
#endif // wxUSE_MSGDLG
|
#endif // wxUSE_MSGDLG
|
||||||
#if wxUSE_RICHMSGDLG
|
#if wxUSE_RICHMSGDLG
|
||||||
@@ -196,6 +197,7 @@ wxBEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
|||||||
EVT_MENU(DIALOGS_FILES_OPEN, MyFrame::FilesOpen)
|
EVT_MENU(DIALOGS_FILES_OPEN, MyFrame::FilesOpen)
|
||||||
EVT_MENU(DIALOGS_FILES_OPEN_WINDOW_MODAL, MyFrame::FilesOpenWindowModal)
|
EVT_MENU(DIALOGS_FILES_OPEN_WINDOW_MODAL, MyFrame::FilesOpenWindowModal)
|
||||||
EVT_MENU(DIALOGS_FILE_SAVE, MyFrame::FileSave)
|
EVT_MENU(DIALOGS_FILE_SAVE, MyFrame::FileSave)
|
||||||
|
EVT_MENU(DIALOGS_FILE_SAVE_WINDOW_MODAL, MyFrame::FileSaveWindowModal)
|
||||||
#endif // wxUSE_FILEDLG
|
#endif // wxUSE_FILEDLG
|
||||||
|
|
||||||
#if USE_FILEDLG_GENERIC
|
#if USE_FILEDLG_GENERIC
|
||||||
@@ -206,6 +208,7 @@ wxBEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
|||||||
|
|
||||||
#if wxUSE_DIRDLG
|
#if wxUSE_DIRDLG
|
||||||
EVT_MENU(DIALOGS_DIR_CHOOSE, MyFrame::DirChoose)
|
EVT_MENU(DIALOGS_DIR_CHOOSE, MyFrame::DirChoose)
|
||||||
|
EVT_MENU(DIALOGS_DIR_CHOOSE_WINDOW_MODAL, MyFrame::DirChooseWindowModal)
|
||||||
EVT_MENU(DIALOGS_DIRNEW_CHOOSE, MyFrame::DirChooseNew)
|
EVT_MENU(DIALOGS_DIRNEW_CHOOSE, MyFrame::DirChooseNew)
|
||||||
EVT_MENU(DIALOGS_DIRMULTIPLE_CHOOSE, MyFrame::DirChooseMultiple)
|
EVT_MENU(DIALOGS_DIRMULTIPLE_CHOOSE, MyFrame::DirChooseMultiple)
|
||||||
#endif // wxUSE_DIRDLG
|
#endif // wxUSE_DIRDLG
|
||||||
@@ -402,6 +405,7 @@ bool MyApp::OnInit()
|
|||||||
menuDlg->Append(DIALOGS_MESSAGE_BOX, "&Message box\tCtrl-M");
|
menuDlg->Append(DIALOGS_MESSAGE_BOX, "&Message box\tCtrl-M");
|
||||||
menuDlg->Append(DIALOGS_MESSAGE_BOX_WINDOW_MODAL, "Window-Modal Message box ");
|
menuDlg->Append(DIALOGS_MESSAGE_BOX_WINDOW_MODAL, "Window-Modal Message box ");
|
||||||
menuDlg->Append(DIALOGS_MESSAGE_DIALOG, "Message dialog\tShift-Ctrl-M");
|
menuDlg->Append(DIALOGS_MESSAGE_DIALOG, "Message dialog\tShift-Ctrl-M");
|
||||||
|
menuDlg->Append(DIALOGS_MESSAGE_DIALOG_WINDOW_MODAL, "Window-Modal Message dialog");
|
||||||
#if wxUSE_RICHMSGDLG
|
#if wxUSE_RICHMSGDLG
|
||||||
menuDlg->Append(DIALOGS_RICH_MESSAGE_DIALOG, "Rich message dialog");
|
menuDlg->Append(DIALOGS_RICH_MESSAGE_DIALOG, "Rich message dialog");
|
||||||
#endif // wxUSE_RICHMSGDLG
|
#endif // wxUSE_RICHMSGDLG
|
||||||
@@ -480,8 +484,9 @@ bool MyApp::OnInit()
|
|||||||
filedlg_menu->Append(DIALOGS_FILE_OPEN, "&Open file\tCtrl-O");
|
filedlg_menu->Append(DIALOGS_FILE_OPEN, "&Open file\tCtrl-O");
|
||||||
filedlg_menu->Append(DIALOGS_FILE_OPEN2, "&Second open file\tCtrl-2");
|
filedlg_menu->Append(DIALOGS_FILE_OPEN2, "&Second open file\tCtrl-2");
|
||||||
filedlg_menu->Append(DIALOGS_FILES_OPEN, "Open &files\tShift-Ctrl-O");
|
filedlg_menu->Append(DIALOGS_FILES_OPEN, "Open &files\tShift-Ctrl-O");
|
||||||
filedlg_menu->Append(DIALOGS_FILES_OPEN_WINDOW_MODAL, "Window Modal Open files");
|
filedlg_menu->Append(DIALOGS_FILES_OPEN_WINDOW_MODAL, "Window-Modal Open files");
|
||||||
filedlg_menu->Append(DIALOGS_FILE_SAVE, "Sa&ve file\tCtrl-S");
|
filedlg_menu->Append(DIALOGS_FILE_SAVE, "Sa&ve file\tCtrl-S");
|
||||||
|
filedlg_menu->Append(DIALOGS_FILE_SAVE_WINDOW_MODAL, "Window-Modal Save file");
|
||||||
|
|
||||||
#if USE_FILEDLG_GENERIC
|
#if USE_FILEDLG_GENERIC
|
||||||
filedlg_menu->AppendSeparator();
|
filedlg_menu->AppendSeparator();
|
||||||
@@ -498,6 +503,7 @@ bool MyApp::OnInit()
|
|||||||
wxMenu *dir_menu = new wxMenu;
|
wxMenu *dir_menu = new wxMenu;
|
||||||
|
|
||||||
dir_menu->Append(DIALOGS_DIR_CHOOSE, "&Choose a directory\tCtrl-D");
|
dir_menu->Append(DIALOGS_DIR_CHOOSE, "&Choose a directory\tCtrl-D");
|
||||||
|
dir_menu->Append(DIALOGS_DIR_CHOOSE_WINDOW_MODAL, "Choose a directory window-modally");
|
||||||
dir_menu->Append(DIALOGS_DIRNEW_CHOOSE, "Choose a directory (with \"Ne&w\" button)\tShift-Ctrl-D");
|
dir_menu->Append(DIALOGS_DIRNEW_CHOOSE, "Choose a directory (with \"Ne&w\" button)\tShift-Ctrl-D");
|
||||||
dir_menu->Append(DIALOGS_DIRMULTIPLE_CHOOSE, "Choose multiple and hidden directories\tAlt-Ctrl-D");
|
dir_menu->Append(DIALOGS_DIRMULTIPLE_CHOOSE, "Choose multiple and hidden directories\tAlt-Ctrl-D");
|
||||||
menuDlg->Append(wxID_ANY,"&Directory operations",dir_menu);
|
menuDlg->Append(wxID_ANY,"&Directory operations",dir_menu);
|
||||||
@@ -1042,6 +1048,20 @@ void MyFrame::MessageBoxDialog(wxCommandEvent& WXUNUSED(event))
|
|||||||
dlg.ShowModal();
|
dlg.ShowModal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MyFrame::MessageBoxDialogWindowModal(wxCommandEvent& WXUNUSED(event))
|
||||||
|
{
|
||||||
|
TestMessageBoxDialog* dlg = new TestMessageBoxDialog(this);
|
||||||
|
dlg->Create();
|
||||||
|
dlg->ShowWindowModal();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyFrame::MessageBoxDialogWindowModalClosed(wxWindowModalDialogEvent& event)
|
||||||
|
{
|
||||||
|
TestMessageBoxDialog* dialog = dynamic_cast<TestMessageBoxDialog*>(event.GetDialog());
|
||||||
|
delete dialog;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void MyFrame::MessageBoxInfo(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::MessageBoxInfo(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
::wxInfoMessageBox(this);
|
::wxInfoMessageBox(this);
|
||||||
@@ -1749,15 +1769,9 @@ void MyFrame::FilesOpenWindowModalClosed(wxWindowModalDialogEvent& event)
|
|||||||
wxMessageDialog dialog2(this, msg, "Selected files");
|
wxMessageDialog dialog2(this, msg, "Selected files");
|
||||||
dialog2.ShowModal();
|
dialog2.ShowModal();
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
wxLogError("Unexpected window modal wxFileDialog return code!");
|
|
||||||
}
|
|
||||||
delete dialog;
|
delete dialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void MyFrame::FileSave(wxCommandEvent& WXUNUSED(event) )
|
void MyFrame::FileSave(wxCommandEvent& WXUNUSED(event) )
|
||||||
{
|
{
|
||||||
wxFileDialog dialog(this,
|
wxFileDialog dialog(this,
|
||||||
@@ -1775,6 +1789,35 @@ void MyFrame::FileSave(wxCommandEvent& WXUNUSED(event) )
|
|||||||
dialog.GetPath(), dialog.GetFilterIndex());
|
dialog.GetPath(), dialog.GetFilterIndex());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MyFrame::FileSaveWindowModal(wxCommandEvent& WXUNUSED(event) )
|
||||||
|
{
|
||||||
|
wxFileDialog* dialog = new wxFileDialog(this,
|
||||||
|
"Testing save file dialog",
|
||||||
|
wxEmptyString,
|
||||||
|
"myletter.doc",
|
||||||
|
"Text files (*.txt)|*.txt|Document files (*.doc;*.ods)|*.doc;*.ods",
|
||||||
|
wxFD_SAVE|wxFD_OVERWRITE_PROMPT);
|
||||||
|
|
||||||
|
dialog->SetFilterIndex(1);
|
||||||
|
|
||||||
|
dialog->Bind(wxEVT_WINDOW_MODAL_DIALOG_CLOSED,
|
||||||
|
&MyFrame::FileSaveWindowModalClosed, this);
|
||||||
|
|
||||||
|
dialog->ShowWindowModal();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyFrame::FileSaveWindowModalClosed(wxWindowModalDialogEvent& event)
|
||||||
|
{
|
||||||
|
wxFileDialog* dialog = dynamic_cast<wxFileDialog*>(event.GetDialog());
|
||||||
|
if ( dialog->GetReturnCode() == wxID_OK)
|
||||||
|
{
|
||||||
|
wxLogMessage("%s, filter %d",
|
||||||
|
dialog->GetPath(), dialog->GetFilterIndex());
|
||||||
|
}
|
||||||
|
delete dialog;
|
||||||
|
}
|
||||||
|
|
||||||
#endif // wxUSE_FILEDLG
|
#endif // wxUSE_FILEDLG
|
||||||
|
|
||||||
#if USE_FILEDLG_GENERIC
|
#if USE_FILEDLG_GENERIC
|
||||||
@@ -1910,6 +1953,30 @@ void MyFrame::DirChooseMultiple(wxCommandEvent& WXUNUSED(event))
|
|||||||
dialog2.ShowModal();
|
dialog2.ShowModal();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MyFrame::DirChooseWindowModal(wxCommandEvent& WXUNUSED(event) )
|
||||||
|
{
|
||||||
|
// pass some initial dir to wxDirDialog
|
||||||
|
wxString dirHome;
|
||||||
|
wxGetHomeDir(&dirHome);
|
||||||
|
|
||||||
|
wxDirDialog* dialog = new wxDirDialog(this, "Testing directory picker", dirHome, wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST);
|
||||||
|
|
||||||
|
dialog->Bind(wxEVT_WINDOW_MODAL_DIALOG_CLOSED,
|
||||||
|
&MyFrame::DirChooseWindowModalClosed, this);
|
||||||
|
|
||||||
|
dialog->ShowWindowModal();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyFrame::DirChooseWindowModalClosed(wxWindowModalDialogEvent& event)
|
||||||
|
{
|
||||||
|
wxDirDialog* dialog = dynamic_cast<wxDirDialog*>(event.GetDialog());
|
||||||
|
if ( dialog->GetReturnCode() == wxID_OK)
|
||||||
|
{
|
||||||
|
wxLogMessage("Selected path: %s", dialog->GetPath());
|
||||||
|
}
|
||||||
|
delete dialog;
|
||||||
|
}
|
||||||
#endif // wxUSE_DIRDLG
|
#endif // wxUSE_DIRDLG
|
||||||
|
|
||||||
#if USE_DIRDLG_GENERIC
|
#if USE_DIRDLG_GENERIC
|
||||||
|
@@ -368,6 +368,8 @@ public:
|
|||||||
#if wxUSE_MSGDLG
|
#if wxUSE_MSGDLG
|
||||||
void MessageBox(wxCommandEvent& event);
|
void MessageBox(wxCommandEvent& event);
|
||||||
void MessageBoxDialog(wxCommandEvent& event);
|
void MessageBoxDialog(wxCommandEvent& event);
|
||||||
|
void MessageBoxDialogWindowModal(wxCommandEvent& event);
|
||||||
|
void MessageBoxDialogWindowModalClosed(wxWindowModalDialogEvent& event);
|
||||||
void MessageBoxInfo(wxCommandEvent& event);
|
void MessageBoxInfo(wxCommandEvent& event);
|
||||||
void MessageBoxWindowModal(wxCommandEvent& event);
|
void MessageBoxWindowModal(wxCommandEvent& event);
|
||||||
void MessageBoxWindowModalClosed(wxWindowModalDialogEvent& event);
|
void MessageBoxWindowModalClosed(wxWindowModalDialogEvent& event);
|
||||||
@@ -425,6 +427,8 @@ public:
|
|||||||
void FilesOpenWindowModal(wxCommandEvent& event);
|
void FilesOpenWindowModal(wxCommandEvent& event);
|
||||||
void FilesOpenWindowModalClosed(wxWindowModalDialogEvent& event);
|
void FilesOpenWindowModalClosed(wxWindowModalDialogEvent& event);
|
||||||
void FileSave(wxCommandEvent& event);
|
void FileSave(wxCommandEvent& event);
|
||||||
|
void FileSaveWindowModal(wxCommandEvent& event);
|
||||||
|
void FileSaveWindowModalClosed(wxWindowModalDialogEvent& event);
|
||||||
#endif // wxUSE_FILEDLG
|
#endif // wxUSE_FILEDLG
|
||||||
|
|
||||||
#if USE_FILEDLG_GENERIC
|
#if USE_FILEDLG_GENERIC
|
||||||
@@ -435,6 +439,8 @@ public:
|
|||||||
|
|
||||||
#if wxUSE_DIRDLG
|
#if wxUSE_DIRDLG
|
||||||
void DirChoose(wxCommandEvent& event);
|
void DirChoose(wxCommandEvent& event);
|
||||||
|
void DirChooseWindowModal(wxCommandEvent& event);
|
||||||
|
void DirChooseWindowModalClosed(wxWindowModalDialogEvent& event);
|
||||||
void DirChooseNew(wxCommandEvent& event);
|
void DirChooseNew(wxCommandEvent& event);
|
||||||
void DirChooseMultiple(wxCommandEvent& event);
|
void DirChooseMultiple(wxCommandEvent& event);
|
||||||
#endif // wxUSE_DIRDLG
|
#endif // wxUSE_DIRDLG
|
||||||
@@ -586,6 +592,7 @@ enum
|
|||||||
DIALOGS_MESSAGE_BOX,
|
DIALOGS_MESSAGE_BOX,
|
||||||
DIALOGS_MESSAGE_BOX_WINDOW_MODAL,
|
DIALOGS_MESSAGE_BOX_WINDOW_MODAL,
|
||||||
DIALOGS_MESSAGE_DIALOG,
|
DIALOGS_MESSAGE_DIALOG,
|
||||||
|
DIALOGS_MESSAGE_DIALOG_WINDOW_MODAL,
|
||||||
DIALOGS_MESSAGE_BOX_WXINFO,
|
DIALOGS_MESSAGE_BOX_WXINFO,
|
||||||
DIALOGS_RICH_MESSAGE_DIALOG,
|
DIALOGS_RICH_MESSAGE_DIALOG,
|
||||||
DIALOGS_SINGLE_CHOICE,
|
DIALOGS_SINGLE_CHOICE,
|
||||||
@@ -600,10 +607,12 @@ enum
|
|||||||
DIALOGS_FILES_OPEN,
|
DIALOGS_FILES_OPEN,
|
||||||
DIALOGS_FILES_OPEN_WINDOW_MODAL,
|
DIALOGS_FILES_OPEN_WINDOW_MODAL,
|
||||||
DIALOGS_FILE_SAVE,
|
DIALOGS_FILE_SAVE,
|
||||||
|
DIALOGS_FILE_SAVE_WINDOW_MODAL,
|
||||||
DIALOGS_FILE_OPEN_GENERIC,
|
DIALOGS_FILE_OPEN_GENERIC,
|
||||||
DIALOGS_FILES_OPEN_GENERIC,
|
DIALOGS_FILES_OPEN_GENERIC,
|
||||||
DIALOGS_FILE_SAVE_GENERIC,
|
DIALOGS_FILE_SAVE_GENERIC,
|
||||||
DIALOGS_DIR_CHOOSE,
|
DIALOGS_DIR_CHOOSE,
|
||||||
|
DIALOGS_DIR_CHOOSE_WINDOW_MODAL,
|
||||||
DIALOGS_DIRNEW_CHOOSE,
|
DIALOGS_DIRNEW_CHOOSE,
|
||||||
DIALOGS_DIRMULTIPLE_CHOOSE,
|
DIALOGS_DIRMULTIPLE_CHOOSE,
|
||||||
DIALOGS_GENERIC_DIR_CHOOSE,
|
DIALOGS_GENERIC_DIR_CHOOSE,
|
||||||
|
Reference in New Issue
Block a user