From: Włodzimierz Skiba Date: Fri, 18 Jun 2004 09:36:05 +0000 (+0000) Subject: Flatening menu for Smartphones when menubar has only one menu X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/ed679e7422b03da13d979f78240e9a0300dfbcd0?ds=sidebyside Flatening menu for Smartphones when menubar has only one menu git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27880 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/samples/dialogs/dialogs.cpp b/samples/dialogs/dialogs.cpp index 07192e6846..22ff54978c 100644 --- a/samples/dialogs/dialogs.cpp +++ b/samples/dialogs/dialogs.cpp @@ -350,13 +350,9 @@ bool MyApp::OnInit() file_menu->AppendSeparator(); file_menu->Append(wxID_EXIT, _T("E&xit\tAlt-X")); -#if !defined( __SMARTPHONE__ ) wxMenuBar *menu_bar = new wxMenuBar; menu_bar->Append(file_menu, _T("&File")); frame->SetMenuBar(menu_bar); -#else - frame->SetRightMenu(wxID_ANY, _T("Menu"), file_menu); -#endif // __SMARTPHONE__ myCanvas = new MyCanvas(frame); myCanvas->SetBackgroundColour(*wxWHITE); diff --git a/src/msw/frame.cpp b/src/msw/frame.cpp index fd160920d6..1ca248342e 100644 --- a/src/msw/frame.cpp +++ b/src/msw/frame.cpp @@ -319,17 +319,29 @@ void wxFrame::PositionStatusBar() void wxFrame::AttachMenuBar(wxMenuBar *menubar) { #if defined(__SMARTPHONE__) - wxMenu *autoMenu = new wxMenu; - for( size_t n = 0; n < menubar->GetMenuCount(); n++ ) + wxMenu *autoMenu = NULL; + + if( menubar->GetMenuCount() == 1 ) + { + autoMenu = wxTopLevelWindowMSW::ButtonMenu::DuplicateMenu(menubar->GetMenu(0)); + SetRightMenu(wxID_ANY, menubar->GetLabelTop(0), autoMenu); + } + else { - wxMenu *item = menubar->GetMenu(n); - wxString label = menubar->GetLabelTop(n); - wxMenu *new_item = wxTopLevelWindowMSW::ButtonMenu::DuplicateMenu(item); - autoMenu->Append(wxID_ANY, label, new_item); + autoMenu = new wxMenu; + + for( size_t n = 0; n < menubar->GetMenuCount(); n++ ) + { + wxMenu *item = menubar->GetMenu(n); + wxString label = menubar->GetLabelTop(n); + wxMenu *new_item = wxTopLevelWindowMSW::ButtonMenu::DuplicateMenu(item); + autoMenu->Append(wxID_ANY, label, new_item); + } + + SetRightMenu(wxID_ANY, _("Menu"), autoMenu); } - SetRightMenu(wxID_ANY, _("Menu"), autoMenu); #elif defined(WINCE_WITHOUT_COMMANDBAR) if (!GetToolBar()) {