static HMENU makeMenu(uiMenu *m) { HMENU menu; size_t i; menu = CreatePopupMenu(); if (menu == NULL) logLastError(L"error creating menu"); for (i = 0; i < m->len; i++) appendMenuItem(menu, m->items[i]); return menu; }
void WFileList::OnContextMenu(wxContextMenuEvent& WXUNUSED(event)) { wxMenu* menu = new wxMenu; appendMenuItem(menu, myID_MENU_SUBFILE_OPEN, _("&Open SubFile"), _("Open subfile in editor.")); appendMenuItem(menu, myID_MENU_SUBFILE_NEW, _("&Add New SubFile"), _("Add new text subfile to container and open it in the editor.")); appendMenuItem(menu, myID_MENU_SUBFILE_IMPORT, _("&Import New SubFile"), _("Import any file from the disk into the container.")); appendMenuItem(menu, myID_MENU_SUBFILE_EXPORT, _("&Export SubFiles"), _("Export subfiles from encrypted container to disk.")); appendMenuItem(menu, myID_MENU_SUBFILE_DELETE, _("&Delete SubFiles"), _("Delete selected subfiles from encrypted container.")); menu->AppendSeparator(); wxMenu* viewmenu = new wxMenu; appendMenuItem(viewmenu, myID_MENU_VIEW_BIGICONS, _("Big &Icons"), wxEmptyString); appendMenuItem(viewmenu, myID_MENU_VIEW_LIST, _("&List"), wxEmptyString); appendMenuItem(viewmenu, myID_MENU_VIEW_REPORT, _("&Report"), wxEmptyString); menu->AppendSubMenu(viewmenu, _("&View")); menu->AppendSeparator(); appendMenuItem(menu, myID_MENU_SUBFILE_RENAME, _("&Rename"), _("Rename selected subfile.")); appendMenuItem(menu, myID_MENU_SUBFILE_PROPERTIES, _("&Properties"), _("Show metadata properties of selected subfile.")); // disable items not applicable int si = GetSelectedItemCount(); menu->Enable(myID_MENU_SUBFILE_OPEN, (si > 0)); menu->Enable(myID_MENU_SUBFILE_EXPORT, (si > 0)); menu->Enable(myID_MENU_SUBFILE_DELETE, (si > 0)); menu->Enable(myID_MENU_SUBFILE_RENAME, (si == 1)); menu->Enable(myID_MENU_SUBFILE_PROPERTIES, (si == 1)); PopupMenu(menu); }