Demonstrate wxOSX_FILEDIALOG_ALWAYS_SHOW_TYPES in dialogs sample
Add a menu option (Ctrl+Cmd+S) to toggle showing of the filter choice with file types in open dialogs on macOS.
This commit is contained in:
parent
ae9b55712d
commit
25f981bfad
@ -203,6 +203,7 @@ wxBEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
|||||||
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)
|
EVT_MENU(DIALOGS_FILE_SAVE_WINDOW_MODAL, MyFrame::FileSaveWindowModal)
|
||||||
|
EVT_MENU(DIALOGS_MAC_TOGGLE_ALWAYS_SHOW_TYPES, MyFrame::MacToggleAlwaysShowTypes)
|
||||||
#endif // wxUSE_FILEDLG
|
#endif // wxUSE_FILEDLG
|
||||||
|
|
||||||
#if USE_FILEDLG_GENERIC
|
#if USE_FILEDLG_GENERIC
|
||||||
@ -504,6 +505,13 @@ bool MyApp::OnInit()
|
|||||||
filedlg_menu->Append(DIALOGS_FILE_SAVE_GENERIC, "Sa&ve file (generic)");
|
filedlg_menu->Append(DIALOGS_FILE_SAVE_GENERIC, "Sa&ve file (generic)");
|
||||||
#endif // USE_FILEDLG_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);
|
menuDlg->Append(wxID_ANY,"&File operations",filedlg_menu);
|
||||||
|
|
||||||
#endif // wxUSE_FILEDLG
|
#endif // wxUSE_FILEDLG
|
||||||
@ -1853,6 +1861,16 @@ void MyFrame::FileSaveWindowModalClosed(wxWindowModalDialogEvent& event)
|
|||||||
|
|
||||||
#endif // wxUSE_FILEDLG
|
#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
|
#if USE_FILEDLG_GENERIC
|
||||||
void MyFrame::FileOpenGeneric(wxCommandEvent& WXUNUSED(event) )
|
void MyFrame::FileOpenGeneric(wxCommandEvent& WXUNUSED(event) )
|
||||||
{
|
{
|
||||||
|
@ -433,6 +433,7 @@ public:
|
|||||||
void FileSave(wxCommandEvent& event);
|
void FileSave(wxCommandEvent& event);
|
||||||
void FileSaveWindowModal(wxCommandEvent& event);
|
void FileSaveWindowModal(wxCommandEvent& event);
|
||||||
void FileSaveWindowModalClosed(wxWindowModalDialogEvent& event);
|
void FileSaveWindowModalClosed(wxWindowModalDialogEvent& event);
|
||||||
|
void MacToggleAlwaysShowTypes(wxCommandEvent& event);
|
||||||
#endif // wxUSE_FILEDLG
|
#endif // wxUSE_FILEDLG
|
||||||
|
|
||||||
#if USE_FILEDLG_GENERIC
|
#if USE_FILEDLG_GENERIC
|
||||||
@ -616,6 +617,7 @@ enum
|
|||||||
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_MAC_TOGGLE_ALWAYS_SHOW_TYPES,
|
||||||
DIALOGS_DIR_CHOOSE,
|
DIALOGS_DIR_CHOOSE,
|
||||||
DIALOGS_DIR_CHOOSE_WINDOW_MODAL,
|
DIALOGS_DIR_CHOOSE_WINDOW_MODAL,
|
||||||
DIALOGS_DIRNEW_CHOOSE,
|
DIALOGS_DIRNEW_CHOOSE,
|
||||||
|
Loading…
Reference in New Issue
Block a user