Fix unwanted ribbon expansion on focus loss.

The ribbon unexpectedly showed itself on focus loss when it was minimized.

Fix this and also use switch statement on m_ribbon_state to ensure that the
compiler warns us if we forget to add the code for handling any new elements
of wxRibbonDisplayMode enum.

Closes #15381.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74953 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2013-10-07 09:59:03 +00:00
parent d3a9b6a331
commit 62fe7a015a

View File

@@ -1269,15 +1269,19 @@ void wxRibbonBar::HitTestRibbonButton(const wxRect& rect, const wxPoint& positio
void wxRibbonBar::HideIfExpanded()
{
if ( m_ribbon_state == wxRIBBON_BAR_EXPANDED )
switch ( m_ribbon_state )
{
HidePanels();
m_ribbon_state = wxRIBBON_BAR_MINIMIZED;
}
else
{
ShowPanels();
m_ribbon_state = wxRIBBON_BAR_PINNED;
case wxRIBBON_BAR_EXPANDED:
m_ribbon_state = wxRIBBON_BAR_MINIMIZED;
// Fall through
case wxRIBBON_BAR_MINIMIZED:
HidePanels();
break;
case wxRIBBON_BAR_PINNED:
ShowPanels();
break;
}
}