WxMenu
Keyboard shortcut
단축키 생성방법은 아래와 같다.
Simple example
간단한 메뉴 생성방법은 아래와 같다.
// MainFrame EVENT Table.
wxBEGIN_EVENT_TABLE(MainFrame, wxFrame)
// {
// ...
// MENU EVENTS.
EVT_MENU(ID_MENU__FILE_OPEN, MainFrame::onMenuFileOpen)
EVT_MENU(ID_MENU__FILE_CLOSE, MainFrame::onMenuFileClose)
// }
wxEND_EVENT_TABLE()
// ...
void MainFrame::createMenu()
{
wxMenuBar * menu = new wxMenuBar();
wxMenu * submenu = new wxMenu();
submenu->AppendRadioItem(ID_MENU__FILE_MODE_NORMAL, wxT("Normal"));
submenu->AppendRadioItem(ID_MENU__FILE_MODE_CHANGE, wxT("Change"));
wxMenu * fileMenu = new wxMenu();
fileMenu->Append(ID_MENU__FILE_OPEN, wxT("Open"));
fileMenu->Append(ID_MENU__FILE_CLOSE, wxT("Close"));
fileMenu->Enable(ID_MENU__FILE_CLOSE, false);
fileMenu->Append(ID_MENU__FILE_MODE, wxT("Mode"), submenu);
fileMenu->AppendSeparator();
{//fileMenu->Append(ID_MENU__FILE_EXIT, wxT("Exit"));
wxMenuItem * exit_item = new wxMenuItem(fileMenu, ID_MENU__FILE_EXIT
, wxT("Exit"), wxT("Exit program"));
exit_item->SetBitmap(wxBitmap(wxT("res/icon/application-exit-5.png"), wxBITMAP_TYPE_PNG));
fileMenu->Append(exit_item);
}
menu->Append(fileMenu, wxT("&File"));
SetMenuBar(menu);
}
// ...
void MainFrame::onMenuFileOpen(wxCommandEvent & event)
{
}
void MainFrame::onMenuFileClose(wxCommandEvent & event)
{
}