virtual void OnDismiss();
// called when a submenu is dismissed
- void OnSubmenuDismiss() { m_hasOpenSubMenu = false; }
+ void OnSubmenuDismiss(bool dismissParent);
// get the currently selected item (may be NULL)
wxMenuItem *GetCurrentItem() const
if ( item->IsSubMenu() && item->GetSubMenu()->IsShown() )
{
item->GetSubMenu()->Dismiss();
- OnSubmenuDismiss();
+ OnSubmenuDismiss( false );
}
RefreshItem(item);
wxCHECK_RET( win, _T("opened submenu is not opened?") );
win->Dismiss();
- OnSubmenuDismiss();
+ OnSubmenuDismiss( false );
}
wxPopupTransientWindow::Dismiss();
HandleDismiss(true);
}
+void wxPopupMenuWindow::OnSubmenuDismiss(bool dismissParent)
+{
+ m_hasOpenSubMenu = false;
+
+ // we are closing whole menu so remove current highlight
+ if ( dismissParent )
+ ResetCurrent();
+}
+
void wxPopupMenuWindow::HandleDismiss(bool dismissParent)
{
ResetCurrent();
bool notUnique = false;
// translate everything to lower case before comparing
- wxChar chAccel = wxTolower(key);
+ wxChar chAccel = (wxChar)wxTolower(key);
// loop through all items searching for the item with this
// accel
wxPopupMenuWindow *win = m_menuParent->m_popupMenu;
if ( win )
{
- win->OnSubmenuDismiss();
+ win->OnSubmenuDismiss( true );
}
else
{
wxString wxMenuBar::GetLabelTop(size_t pos) const
{
- wxCHECK_MSG( pos < GetCount(), _T(""), _T("invalid index in GetLabelTop") );
+ wxCHECK_MSG( pos < GetCount(), wxEmptyString, _T("invalid index in GetLabelTop") );
return m_menuInfos[pos].GetLabel();
}
// the menu when up/down one is
switch ( key )
{
- case WXK_MENU:
+ case WXK_ALT:
// Alt must be processed at wxWindow level too
event.Skip();
// fall through
*unique = true;
// translate everything to lower case before comparing
- wxChar chAccel = wxTolower(key);
+ wxChar chAccel = (wxChar)wxTolower(key);
// the index of the item with this accel
int idxFound = -1;
// wxLogDebug( "Name of invoking window %s", menu->GetInvokingWindow()->GetName().c_str() );
- menu->Popup(ClientToScreen(wxPoint(x, y)), wxSize(0, 0));
+ menu->Popup(ClientToScreen(wxPoint(x, y)), wxSize(0,0));
// this is not very useful if the menu was popped up because of the mouse
// click but I think it is nice to do when it appears because of a key