From 6f7e96d8432dc78bd9b0fa7db78090ca6d8cc04c Mon Sep 17 00:00:00 2001 From: Peter Cawley Date: Tue, 14 Sep 2010 17:35:26 +0000 Subject: [PATCH] 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 --- src/ribbon/gallery.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/ribbon/gallery.cpp b/src/ribbon/gallery.cpp index 0234762b43..6d7c300e92 100644 --- a/src/ribbon/gallery.cpp +++ b/src/ribbon/gallery.cpp @@ -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 -- 2.45.2