]> git.saurik.com Git - wxWidgets.git/commitdiff
Fix incorrect behaviour of wxRibbonGallery::EnsureVisible when the ribbon is vertical...
authorPeter Cawley <corsix@corsix.org>
Tue, 14 Sep 2010 17:35:26 +0000 (17:35 +0000)
committerPeter Cawley <corsix@corsix.org>
Tue, 14 Sep 2010 17:35:26 +0000 (17:35 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65544 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/ribbon/gallery.cpp

index 0234762b43b36d0056946147ee22c5de0cd0092d..6d7c300e9254cb9262827308d609dcbb50f9185b 100644 (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