X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/98742322cdecc1f91bb90d9c804318058722eab0..3a4cf8a84d9a41c63125c1c1cdd6d0fbb98f41f0:/src/ribbon/toolbar.cpp?ds=sidebyside diff --git a/src/ribbon/toolbar.cpp b/src/ribbon/toolbar.cpp index 6c6c8b7f5a..fe337405f4 100644 --- a/src/ribbon/toolbar.cpp +++ b/src/ribbon/toolbar.cpp @@ -4,7 +4,6 @@ // Author: Peter Cawley // Modified by: // Created: 2009-07-06 -// RCS-ID: $Id$ // Copyright: (C) Peter Cawley // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -57,8 +56,8 @@ public: wxSize size; }; -wxDEFINE_EVENT(wxEVT_COMMAND_RIBBONTOOL_CLICKED, wxRibbonToolBarEvent); -wxDEFINE_EVENT(wxEVT_COMMAND_RIBBONTOOL_DROPDOWN_CLICKED, wxRibbonToolBarEvent); +wxDEFINE_EVENT(wxEVT_RIBBONTOOLBAR_CLICKED, wxRibbonToolBarEvent); +wxDEFINE_EVENT(wxEVT_RIBBONTOOLBAR_DROPDOWN_CLICKED, wxRibbonToolBarEvent); IMPLEMENT_DYNAMIC_CLASS(wxRibbonToolBarEvent, wxCommandEvent) IMPLEMENT_CLASS(wxRibbonToolBar, wxRibbonControl) @@ -949,14 +948,11 @@ wxSize wxRibbonToolBar::GetBestSizeForParentSize(const wxSize& parentSize) const // Choose row count with largest possible area wxSize size = parentSize; - int row_count = m_nrows_max; - wxOrientation major_axis = m_art->GetFlags() & wxRIBBON_BAR_FLOW_VERTICAL ? - wxVERTICAL : wxHORIZONTAL; // A toolbar should maximize its width whether vertical or horizontal, so // force the major axis to be horizontal. Without this, there will be // redundant horizontal space. - major_axis = wxHORIZONTAL; + wxOrientation major_axis = wxHORIZONTAL; wxSize bestSize = m_sizes[0]; if(m_nrows_max != m_nrows_min) @@ -968,7 +964,6 @@ wxSize wxRibbonToolBar::GetBestSizeForParentSize(const wxSize& parentSize) const GetSizeInOrientation(m_sizes[i], major_axis) > area) { area = GetSizeInOrientation(m_sizes[i], major_axis); - row_count = m_nrows_min + i; bestSize = m_sizes[i]; } } @@ -1137,9 +1132,9 @@ void wxRibbonToolBar::OnMouseUp(wxMouseEvent& WXUNUSED(evt)) { if(m_active_tool->state & wxRIBBON_TOOLBAR_TOOL_ACTIVE_MASK) { - wxEventType evt_type = wxEVT_COMMAND_RIBBONTOOL_CLICKED; + wxEventType evt_type = wxEVT_RIBBONTOOLBAR_CLICKED; if(m_active_tool->state & wxRIBBON_TOOLBAR_TOOL_DROPDOWN_ACTIVE) - evt_type = wxEVT_COMMAND_RIBBONTOOL_DROPDOWN_CLICKED; + evt_type = wxEVT_RIBBONTOOLBAR_DROPDOWN_CLICKED; wxRibbonToolBarEvent notification(evt_type, m_active_tool->id); if(m_active_tool->kind == wxRIBBON_BUTTON_TOGGLE) { @@ -1151,6 +1146,8 @@ void wxRibbonToolBar::OnMouseUp(wxMouseEvent& WXUNUSED(evt)) notification.SetEventObject(this); notification.SetBar(this); ProcessEvent(notification); + + wxStaticCast(m_parent, wxRibbonPanel)->HideIfExpanded(); } // Notice that m_active_tool could have been reset by the event handler