X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/98742322cdecc1f91bb90d9c804318058722eab0..07aaf32633ecf18ec3edfbb41793a112914792d0:/src/ribbon/page.cpp?ds=sidebyside diff --git a/src/ribbon/page.cpp b/src/ribbon/page.cpp index 17d8c316dc..0fecb1c0a2 100644 --- a/src/ribbon/page.cpp +++ b/src/ribbon/page.cpp @@ -383,7 +383,7 @@ void wxRibbonPage::DoSetSize(int x, int y, int width, int height, int sizeFlags) // When a resize triggers the scroll buttons to become visible, the page is resized. // This resize from within a resize event can cause (MSW) wxWidgets some confusion, // and report the 1st size to the 2nd size event. Hence the most recent size is - // remembered internally and used in Layout() where appropiate. + // remembered internally and used in Layout() where appropriate. if(GetMajorAxis() == wxHORIZONTAL) { @@ -640,6 +640,8 @@ bool wxRibbonPage::DoActualLayout() ShowScrollButtons(); else if(todo_hide_scroll_buttons) HideScrollButtons(); + else if(m_scroll_buttons_visible) + ShowScrollButtons(); Refresh(); return true; @@ -679,29 +681,33 @@ void wxRibbonPage::ShowScrollButtons() if(show_left) { - if(m_scroll_left_btn == NULL) + wxMemoryDC temp_dc; + wxSize size; + long direction; + if(GetMajorAxis() == wxHORIZONTAL) { - wxMemoryDC temp_dc; - wxSize size; - long direction; - if(GetMajorAxis() == wxHORIZONTAL) - { - direction = wxRIBBON_SCROLL_BTN_LEFT; - size = m_art->GetScrollButtonMinimumSize(temp_dc, GetParent(), direction); - size.SetHeight(GetSize().GetHeight()); - } - else - { - direction = wxRIBBON_SCROLL_BTN_UP; - size = m_art->GetScrollButtonMinimumSize(temp_dc, GetParent(), direction); - size.SetWidth(GetSize().GetWidth()); - } - m_scroll_left_btn = new wxRibbonPageScrollButton(this, wxID_ANY, GetPosition(), size, direction); - if(!IsShown()) - { - m_scroll_left_btn->Hide(); - } - reposition = true; + direction = wxRIBBON_SCROLL_BTN_LEFT; + size = m_art->GetScrollButtonMinimumSize(temp_dc, GetParent(), direction); + size.SetHeight(GetSize().GetHeight()); + } + else + { + direction = wxRIBBON_SCROLL_BTN_UP; + size = m_art->GetScrollButtonMinimumSize(temp_dc, GetParent(), direction); + size.SetWidth(GetSize().GetWidth()); + } + if (m_scroll_left_btn) + { + m_scroll_left_btn->SetSize(size); + } + else + { + m_scroll_left_btn = new wxRibbonPageScrollButton(this, wxID_ANY, GetPosition(), size, direction); + reposition = true; + } + if(!IsShown()) + { + m_scroll_left_btn->Hide(); } } else @@ -716,30 +722,34 @@ void wxRibbonPage::ShowScrollButtons() if(show_right) { - if(m_scroll_right_btn == NULL) + wxMemoryDC temp_dc; + wxSize size; + long direction; + if(GetMajorAxis() == wxHORIZONTAL) { - wxMemoryDC temp_dc; - wxSize size; - long direction; - if(GetMajorAxis() == wxHORIZONTAL) - { - direction = wxRIBBON_SCROLL_BTN_RIGHT; - size = m_art->GetScrollButtonMinimumSize(temp_dc, GetParent(), direction); - size.SetHeight(GetSize().GetHeight()); - } - else - { - direction = wxRIBBON_SCROLL_BTN_DOWN; - size = m_art->GetScrollButtonMinimumSize(temp_dc, GetParent(), direction); - size.SetWidth(GetSize().GetWidth()); - } - wxPoint initial_pos = GetPosition() + GetSize() - size; - m_scroll_right_btn = new wxRibbonPageScrollButton(this, wxID_ANY, initial_pos, size, direction); - if(!IsShown()) - { - m_scroll_right_btn->Hide(); - } - reposition = true; + direction = wxRIBBON_SCROLL_BTN_RIGHT; + size = m_art->GetScrollButtonMinimumSize(temp_dc, GetParent(), direction); + size.SetHeight(GetSize().GetHeight()); + } + else + { + direction = wxRIBBON_SCROLL_BTN_DOWN; + size = m_art->GetScrollButtonMinimumSize(temp_dc, GetParent(), direction); + size.SetWidth(GetSize().GetWidth()); + } + wxPoint initial_pos = GetPosition() + GetSize() - size; + if (m_scroll_right_btn) + { + m_scroll_right_btn->SetSize(size); + } + else + { + m_scroll_right_btn = new wxRibbonPageScrollButton(this, wxID_ANY, initial_pos, size, direction); + reposition = true; + } + if(!IsShown()) + { + m_scroll_right_btn->Hide(); } } else @@ -1091,4 +1101,9 @@ wxSize wxRibbonPage::DoGetBestSize() const return best; } +void wxRibbonPage::HideIfExpanded() +{ + wxStaticCast(m_parent, wxRibbonBar)->HideIfExpanded(); +} + #endif // wxUSE_RIBBON