void wxRibbonBar::HideIfExpanded() { if ( m_ribbon_state == wxRIBBON_BAR_EXPANDED ) { HidePanels(); m_ribbon_state = wxRIBBON_BAR_MINIMIZED; } else { ShowPanels(); m_ribbon_state = wxRIBBON_BAR_PINNED; } }
void wxRibbonBar::OnMouseDoubleClick(wxMouseEvent& evt) { wxRibbonPageTabInfo *tab = HitTestTabs(evt.GetPosition()); SetFocus(); if ( tab && tab == &m_pages.Item(m_current_page) ) { if ( m_ribbon_state == wxRIBBON_BAR_PINNED ) { HidePanels(); } else { ShowPanels(wxRIBBON_BAR_PINNED); } } }
void wxRibbonBar::HideIfExpanded() { switch ( m_ribbon_state ) { case wxRIBBON_BAR_EXPANDED: m_ribbon_state = wxRIBBON_BAR_MINIMIZED; // Fall through case wxRIBBON_BAR_MINIMIZED: HidePanels(); break; case wxRIBBON_BAR_PINNED: ShowPanels(); break; } }
void wxRibbonBar::OnMouseLeftDown(wxMouseEvent& evt) { wxRibbonPageTabInfo *tab = HitTestTabs(evt.GetPosition()); SetFocus(); if ( tab ) { if ( m_ribbon_state == wxRIBBON_BAR_MINIMIZED ) { ShowPanels(); m_ribbon_state = wxRIBBON_BAR_EXPANDED; } else if ( (tab == &m_pages.Item(m_current_page)) && (m_ribbon_state == wxRIBBON_BAR_EXPANDED) ) { HidePanels(); m_ribbon_state = wxRIBBON_BAR_MINIMIZED; } } else { if ( m_ribbon_state == wxRIBBON_BAR_EXPANDED ) { HidePanels(); m_ribbon_state = wxRIBBON_BAR_MINIMIZED; } } if(tab && tab != &m_pages.Item(m_current_page)) { wxRibbonBarEvent query(wxEVT_RIBBONBAR_PAGE_CHANGING, GetId(), tab->page); query.SetEventObject(this); ProcessWindowEvent(query); if(query.IsAllowed()) { SetActivePage(query.GetPage()); wxRibbonBarEvent notification(wxEVT_RIBBONBAR_PAGE_CHANGED, GetId(), m_pages.Item(m_current_page).page); notification.SetEventObject(this); ProcessWindowEvent(notification); } } else if(tab == NULL) { if(m_tab_scroll_left_button_rect.Contains(evt.GetPosition())) { m_tab_scroll_left_button_state |= wxRIBBON_SCROLL_BTN_ACTIVE | wxRIBBON_SCROLL_BTN_HOVERED; RefreshTabBar(); } else if(m_tab_scroll_right_button_rect.Contains(evt.GetPosition())) { m_tab_scroll_right_button_state |= wxRIBBON_SCROLL_BTN_ACTIVE | wxRIBBON_SCROLL_BTN_HOVERED; RefreshTabBar(); } } wxPoint position = evt.GetPosition(); if(position.x >= 0 && position.y >= 0) { wxSize size = GetSize(); if(position.x < size.GetWidth() && position.y < size.GetHeight()) { if(m_toggle_button_rect.Contains(position)) { bool pshown = ArePanelsShown(); ShowPanels(!pshown); if ( pshown ) m_ribbon_state = wxRIBBON_BAR_MINIMIZED; else m_ribbon_state = wxRIBBON_BAR_PINNED; wxRibbonBarEvent event(wxEVT_RIBBONBAR_TOGGLED, GetId()); event.SetEventObject(this); ProcessWindowEvent(event); } if ( m_help_button_rect.Contains(position) ) { wxRibbonBarEvent event(wxEVT_RIBBONBAR_HELP_CLICK, GetId()); event.SetEventObject(this); ProcessWindowEvent(event); } } } }
void wxRibbonBar::HideIfExpanded() { if ( m_ribbon_state == wxRIBBON_BAR_EXPANDED) HidePanels(); }