X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4cf018e14ea61679b99874765f232b2032b3d3f8..c13d6ac1ea199d1e3908d40d129e2fd5a4d82df7:/src/ribbon/bar.cpp diff --git a/src/ribbon/bar.cpp b/src/ribbon/bar.cpp index e8f6d4fe26..625324fa7d 100644 --- a/src/ribbon/bar.cpp +++ b/src/ribbon/bar.cpp @@ -38,6 +38,7 @@ wxDEFINE_EVENT(wxEVT_COMMAND_RIBBONBAR_TAB_MIDDLE_DOWN, wxRibbonBarEvent); wxDEFINE_EVENT(wxEVT_COMMAND_RIBBONBAR_TAB_MIDDLE_UP, wxRibbonBarEvent); wxDEFINE_EVENT(wxEVT_COMMAND_RIBBONBAR_TAB_RIGHT_DOWN, wxRibbonBarEvent); wxDEFINE_EVENT(wxEVT_COMMAND_RIBBONBAR_TAB_RIGHT_UP, wxRibbonBarEvent); +wxDEFINE_EVENT(wxEVT_COMMAND_RIBBONBAR_TAB_LEFT_DCLICK, wxRibbonBarEvent); IMPLEMENT_CLASS(wxRibbonBar, wxRibbonControl) IMPLEMENT_DYNAMIC_CLASS(wxRibbonBarEvent, wxNotifyEvent) @@ -53,6 +54,7 @@ BEGIN_EVENT_TABLE(wxRibbonBar, wxRibbonControl) EVT_PAINT(wxRibbonBar::OnPaint) EVT_RIGHT_DOWN(wxRibbonBar::OnMouseRightDown) EVT_RIGHT_UP(wxRibbonBar::OnMouseRightUp) + EVT_LEFT_DCLICK(wxRibbonBar::OnMouseDoubleClick) EVT_SIZE(wxRibbonBar::OnSize) END_EVENT_TABLE() @@ -107,6 +109,14 @@ bool wxRibbonBar::DismissExpandedPanel() return m_pages.Item(m_current_page).page->DismissExpandedPanel(); } +void wxRibbonBar::ShowPanels(bool show) +{ + m_arePanelsShown = show; + SetMinSize(wxSize(GetSize().GetWidth(), DoGetBestSize().GetHeight())); + Realise(); + GetParent()->Layout(); +} + void wxRibbonBar::SetWindowStyleFlag(long style) { m_flags = style; @@ -536,6 +546,7 @@ wxRibbonBar::wxRibbonBar() m_tab_scroll_left_button_state = wxRIBBON_SCROLL_BTN_NORMAL; m_tab_scroll_right_button_state = wxRIBBON_SCROLL_BTN_NORMAL; m_tab_scroll_buttons_shown = false; + m_arePanelsShown = true; } wxRibbonBar::wxRibbonBar(wxWindow* parent, @@ -583,6 +594,7 @@ void wxRibbonBar::CommonInit(long style) m_tab_scroll_left_button_state = wxRIBBON_SCROLL_BTN_NORMAL; m_tab_scroll_right_button_state = wxRIBBON_SCROLL_BTN_NORMAL; m_tab_scroll_buttons_shown = false; + m_arePanelsShown = true; if(m_art == NULL) { @@ -902,6 +914,11 @@ void wxRibbonBar::OnMouseRightUp(wxMouseEvent& evt) DoMouseButtonCommon(evt, wxEVT_COMMAND_RIBBONBAR_TAB_RIGHT_UP); } +void wxRibbonBar::OnMouseDoubleClick(wxMouseEvent& evt) +{ + DoMouseButtonCommon(evt, wxEVT_COMMAND_RIBBONBAR_TAB_LEFT_DCLICK); +} + void wxRibbonBar::DoMouseButtonCommon(wxMouseEvent& evt, wxEventType tab_event_type) { wxRibbonPageTabInfo *tab = HitTestTabs(evt.GetPosition()); @@ -939,7 +956,7 @@ void wxRibbonBar::RecalculateMinSize() } m_minWidth = min_size.GetWidth(); - m_minHeight = min_size.GetHeight(); + m_minHeight = m_arePanelsShown ? min_size.GetHeight() : m_tab_height; } wxSize wxRibbonBar::DoGetBestSize() const @@ -957,6 +974,10 @@ wxSize wxRibbonBar::DoGetBestSize() const { best.IncBy(0, m_tab_height); } + if(!m_arePanelsShown) + { + best.SetHeight(m_tab_height); + } return best; }