Fix incorrect behaviour of wxRibbonGallery::EnsureVisible when the ribbon is vertical rather than horizontal.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65544 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Peter Cawley 2010-09-14 17:35:26 +00:00
parent ed84dc74d9
commit 6f7e96d843

View File

@ -443,10 +443,20 @@ void wxRibbonGallery::EnsureVisible(const wxRibbonGalleryItem* item)
if(item == NULL || !item->IsVisible() || IsEmpty())
return;
int y = item->GetPosition().GetTop();
int base_y = m_items.Item(0)->GetPosition().GetTop();
int delta = y - base_y - m_scroll_amount;
ScrollLines(delta / m_bitmap_padded_size.GetHeight());
if(m_art->GetFlags() & wxRIBBON_BAR_FLOW_VERTICAL)
{
int x = item->GetPosition().GetLeft();
int base_x = m_items.Item(0)->GetPosition().GetLeft();
int delta = x - base_x - m_scroll_amount;
ScrollLines(delta / m_bitmap_padded_size.GetWidth());
}
else
{
int y = item->GetPosition().GetTop();
int base_y = m_items.Item(0)->GetPosition().GetTop();
int delta = y - base_y - m_scroll_amount;
ScrollLines(delta / m_bitmap_padded_size.GetHeight());
}
}
bool wxRibbonGallery::IsHovered() const