diff --git a/samples/dialogs/dialogs.cpp b/samples/dialogs/dialogs.cpp index 8a8f1998fc..a7ed02b5f5 100644 --- a/samples/dialogs/dialogs.cpp +++ b/samples/dialogs/dialogs.cpp @@ -203,6 +203,7 @@ wxBEGIN_EVENT_TABLE(MyFrame, wxFrame) EVT_MENU(DIALOGS_FILES_OPEN_WINDOW_MODAL, MyFrame::FilesOpenWindowModal) EVT_MENU(DIALOGS_FILE_SAVE, MyFrame::FileSave) EVT_MENU(DIALOGS_FILE_SAVE_WINDOW_MODAL, MyFrame::FileSaveWindowModal) + EVT_MENU(DIALOGS_MAC_TOGGLE_ALWAYS_SHOW_TYPES, MyFrame::MacToggleAlwaysShowTypes) #endif // wxUSE_FILEDLG #if USE_FILEDLG_GENERIC @@ -504,6 +505,13 @@ bool MyApp::OnInit() filedlg_menu->Append(DIALOGS_FILE_SAVE_GENERIC, "Sa&ve file (generic)"); #endif // USE_FILEDLG_GENERIC +#ifdef __WXOSX_COCOA__ + filedlg_menu->AppendSeparator(); + filedlg_menu->AppendCheckItem(DIALOGS_MAC_TOGGLE_ALWAYS_SHOW_TYPES, + "macOS only: Toggle open file " + "\"Always show types\"\tRawCtrl+Ctrl+S"); +#endif + menuDlg->Append(wxID_ANY,"&File operations",filedlg_menu); #endif // wxUSE_FILEDLG @@ -1853,6 +1861,16 @@ void MyFrame::FileSaveWindowModalClosed(wxWindowModalDialogEvent& event) #endif // wxUSE_FILEDLG +void MyFrame::MacToggleAlwaysShowTypes(wxCommandEvent& event) +{ +#ifdef wxOSX_FILEDIALOG_ALWAYS_SHOW_TYPES + wxSystemOptions::SetOption(wxOSX_FILEDIALOG_ALWAYS_SHOW_TYPES, + event.IsChecked()); +#else + wxUnusedVar(event); +#endif +} + #if USE_FILEDLG_GENERIC void MyFrame::FileOpenGeneric(wxCommandEvent& WXUNUSED(event) ) { diff --git a/samples/dialogs/dialogs.h b/samples/dialogs/dialogs.h index 8b7cf00b2b..4972a537e4 100644 --- a/samples/dialogs/dialogs.h +++ b/samples/dialogs/dialogs.h @@ -433,6 +433,7 @@ public: void FileSave(wxCommandEvent& event); void FileSaveWindowModal(wxCommandEvent& event); void FileSaveWindowModalClosed(wxWindowModalDialogEvent& event); + void MacToggleAlwaysShowTypes(wxCommandEvent& event); #endif // wxUSE_FILEDLG #if USE_FILEDLG_GENERIC @@ -616,6 +617,7 @@ enum DIALOGS_FILE_OPEN_GENERIC, DIALOGS_FILES_OPEN_GENERIC, DIALOGS_FILE_SAVE_GENERIC, + DIALOGS_MAC_TOGGLE_ALWAYS_SHOW_TYPES, DIALOGS_DIR_CHOOSE, DIALOGS_DIR_CHOOSE_WINDOW_MODAL, DIALOGS_DIRNEW_CHOOSE,