]> git.saurik.com Git - wxWidgets.git/commitdiff
Fix ribbon bar scroll buttons visibility bug.
authorVadim Zeitlin <vadim@wxwidgets.org>
Fri, 23 Nov 2012 14:34:31 +0000 (14:34 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Fri, 23 Nov 2012 14:34:31 +0000 (14:34 +0000)
Fix scroll buttons update code in wxRibbonPage.

Closes #14844.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72998 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/ribbon/page.cpp

index 215866213bbe69ab075fec441ed94dd3b417aa92..4a6a534bbb08491ad68288881f644ec9ec10c8d0 100644 (file)
@@ -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