X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/631f1bfed5d2df0215035207355d838328237578..e6045e08ed5218ad303ee1f3cb70dd2ad621b322:/src/msw/menu.cpp diff --git a/src/msw/menu.cpp b/src/msw/menu.cpp index 670372224f..77923bb06a 100644 --- a/src/msw/menu.cpp +++ b/src/msw/menu.cpp @@ -341,7 +341,21 @@ void wxMenu::SetTitle(const wxString& label) } } - // TODO use SetMenuItemInfo(MFS_DEFAULT) to put it in bold face +#ifndef __WIN16__ + // put the title string in bold face + if ( !m_title.IsEmpty() ) + { + MENUITEMINFO mii; + mii.cbSize = sizeof(mii); + mii.fMask = MIIM_STATE; + mii.fState = MFS_DEFAULT; + + if ( !SetMenuItemInfo(hMenu, (unsigned)idMenuTitle, FALSE, &mii) ) + { + wxLogLastError("SetMenuItemInfo"); + } + } +#endif } const wxString wxMenu::GetTitle() const @@ -413,12 +427,19 @@ wxString wxMenu::GetLabel(int id) const bool wxMenu::MSWCommand(WXUINT WXUNUSED(param), WXWORD id) { - wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED); - event.SetEventObject( this ); - event.SetId( id ); - event.SetInt( id ); - ProcessCommand(event); - return TRUE; + // ignore commands from the menu title + + // NB: VC++ generates wrong assembler for `if ( id != idMenuTitle )'!! + if ( id != (WXWORD)idMenuTitle ) + { + wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED); + event.SetEventObject( this ); + event.SetId( id ); + event.SetInt( id ); + ProcessCommand(event); + } + + return TRUE; } // Finds the item id matching the given string, -1 if not found. @@ -541,7 +562,16 @@ bool wxWindow::PopupMenu(wxMenu *menu, int x, int y) wxMenuBar::wxMenuBar() { m_eventHandler = this; + m_menuCount = 0; + m_menus = NULL; + m_titles = NULL; + m_menuBarFrame = NULL; + m_hMenu = 0; +} +wxMenuBar::wxMenuBar( long WXUNUSED(style) ) +{ + m_eventHandler = this; m_menuCount = 0; m_menus = NULL; m_titles = NULL;