Allow to add extra accelerators to wxMenuItem
These accelerators are not shown in wxMenuItem label, but still will work. Implement support for them in all major ports and XRC. Co-Authored-By: Vadim Zeitlin <vadim@wxwidgets.org>
This commit is contained in:
committed by
Vadim Zeitlin
parent
e729791222
commit
0cd898975c
@@ -84,6 +84,7 @@ wxBEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||
EVT_MENU(XRCID("derived_tool_or_menuitem"), MyFrame::OnDerivedDialogToolOrMenuCommand)
|
||||
EVT_MENU(XRCID("controls_tool_or_menuitem"), MyFrame::OnControlsToolOrMenuCommand)
|
||||
EVT_MENU(XRCID("uncentered_tool_or_menuitem"), MyFrame::OnUncenteredToolOrMenuCommand)
|
||||
EVT_MENU(XRCID("multiple_accels"), MyFrame::OnMultipleAccels)
|
||||
EVT_MENU(XRCID("aui_demo_tool_or_menuitem"), MyFrame::OnAuiDemoToolOrMenuCommand)
|
||||
EVT_MENU(XRCID("obj_ref_tool_or_menuitem"), MyFrame::OnObjRefToolOrMenuCommand)
|
||||
EVT_MENU(XRCID("custom_class_tool_or_menuitem"), MyFrame::OnCustomClassToolOrMenuCommand)
|
||||
@@ -285,6 +286,26 @@ void MyFrame::OnUncenteredToolOrMenuCommand(wxCommandEvent& WXUNUSED(event))
|
||||
dlg.ShowModal();
|
||||
}
|
||||
|
||||
void MyFrame::OnMultipleAccels(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxString msg;
|
||||
#if defined(__WXOSX_COCOA__)
|
||||
wxString main = "Cmd-W";
|
||||
wxString extra1 = "Cmd-T";
|
||||
wxString extra2 = "Shift-Cmd-W";
|
||||
#else
|
||||
wxString main = "Ctrl-W";
|
||||
wxString extra1 = "Ctrl-T";
|
||||
wxString extra2 = "Shift-Ctrl-W";
|
||||
#endif
|
||||
msg.Printf(
|
||||
"You can open this dialog with any of '%s' (main), '%s' or '%s' (extra) accelerators.",
|
||||
main, extra1, extra2
|
||||
);
|
||||
|
||||
wxMessageBox(msg, _("Multiple accelerators demo"), wxOK | wxICON_INFORMATION, this);
|
||||
}
|
||||
|
||||
void MyFrame::OnAuiDemoToolOrMenuCommand(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
#if wxUSE_AUI
|
||||
|
||||
Reference in New Issue
Block a user