Fix ribbon bar scroll buttons visibility bug.

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
This commit is contained in:
Vadim Zeitlin
2012-11-23 14:34:31 +00:00
parent 3c3b6f6063
commit b31d6326be

View File

@@ -640,6 +640,8 @@ bool wxRibbonPage::DoActualLayout()
ShowScrollButtons(); ShowScrollButtons();
else if(todo_hide_scroll_buttons) else if(todo_hide_scroll_buttons)
HideScrollButtons(); HideScrollButtons();
else if(m_scroll_buttons_visible)
ShowScrollButtons();
Refresh(); Refresh();
return true; return true;
@@ -679,29 +681,33 @@ void wxRibbonPage::ShowScrollButtons()
if(show_left) if(show_left)
{ {
if(m_scroll_left_btn == NULL) wxMemoryDC temp_dc;
wxSize size;
long direction;
if(GetMajorAxis() == wxHORIZONTAL)
{ {
wxMemoryDC temp_dc; direction = wxRIBBON_SCROLL_BTN_LEFT;
wxSize size; size = m_art->GetScrollButtonMinimumSize(temp_dc, GetParent(), direction);
long direction; size.SetHeight(GetSize().GetHeight());
if(GetMajorAxis() == wxHORIZONTAL) }
{ else
direction = wxRIBBON_SCROLL_BTN_LEFT; {
size = m_art->GetScrollButtonMinimumSize(temp_dc, GetParent(), direction); direction = wxRIBBON_SCROLL_BTN_UP;
size.SetHeight(GetSize().GetHeight()); size = m_art->GetScrollButtonMinimumSize(temp_dc, GetParent(), direction);
} size.SetWidth(GetSize().GetWidth());
else }
{ if (m_scroll_left_btn)
direction = wxRIBBON_SCROLL_BTN_UP; {
size = m_art->GetScrollButtonMinimumSize(temp_dc, GetParent(), direction); m_scroll_left_btn->SetSize(size);
size.SetWidth(GetSize().GetWidth()); }
} else
m_scroll_left_btn = new wxRibbonPageScrollButton(this, wxID_ANY, GetPosition(), size, direction); {
if(!IsShown()) m_scroll_left_btn = new wxRibbonPageScrollButton(this, wxID_ANY, GetPosition(), size, direction);
{ reposition = true;
m_scroll_left_btn->Hide(); }
} if(!IsShown())
reposition = true; {
m_scroll_left_btn->Hide();
} }
} }
else else
@@ -716,30 +722,34 @@ void wxRibbonPage::ShowScrollButtons()
if(show_right) if(show_right)
{ {
if(m_scroll_right_btn == NULL) wxMemoryDC temp_dc;
wxSize size;
long direction;
if(GetMajorAxis() == wxHORIZONTAL)
{ {
wxMemoryDC temp_dc; direction = wxRIBBON_SCROLL_BTN_RIGHT;
wxSize size; size = m_art->GetScrollButtonMinimumSize(temp_dc, GetParent(), direction);
long direction; size.SetHeight(GetSize().GetHeight());
if(GetMajorAxis() == wxHORIZONTAL) }
{ else
direction = wxRIBBON_SCROLL_BTN_RIGHT; {
size = m_art->GetScrollButtonMinimumSize(temp_dc, GetParent(), direction); direction = wxRIBBON_SCROLL_BTN_DOWN;
size.SetHeight(GetSize().GetHeight()); size = m_art->GetScrollButtonMinimumSize(temp_dc, GetParent(), direction);
} size.SetWidth(GetSize().GetWidth());
else }
{ wxPoint initial_pos = GetPosition() + GetSize() - size;
direction = wxRIBBON_SCROLL_BTN_DOWN; if (m_scroll_right_btn)
size = m_art->GetScrollButtonMinimumSize(temp_dc, GetParent(), direction); {
size.SetWidth(GetSize().GetWidth()); m_scroll_right_btn->SetSize(size);
} }
wxPoint initial_pos = GetPosition() + GetSize() - size; else
m_scroll_right_btn = new wxRibbonPageScrollButton(this, wxID_ANY, initial_pos, size, direction); {
if(!IsShown()) m_scroll_right_btn = new wxRibbonPageScrollButton(this, wxID_ANY, initial_pos, size, direction);
{ reposition = true;
m_scroll_right_btn->Hide(); }
} if(!IsShown())
reposition = true; {
m_scroll_right_btn->Hide();
} }
} }
else else