[hyena/gtk3] GtkTheme: Fix arrow drawing and size in header cells



commit d5e4bfca701acc84020432e0937d7f33ab991037
Author: Bertrand Lorentz <bertrand lorentz gmail com>
Date:   Sat Jul 30 15:37:05 2011 +0200

    GtkTheme: Fix arrow drawing and size in header cells

 Hyena.Gui/Hyena.Data.Gui/ColumnHeaderCellText.cs |    2 +-
 Hyena.Gui/Hyena.Gui.Theming/GtkTheme.cs          |    8 ++++++--
 2 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/Hyena.Gui/Hyena.Data.Gui/ColumnHeaderCellText.cs b/Hyena.Gui/Hyena.Data.Gui/ColumnHeaderCellText.cs
index 3110bb0..48864fe 100644
--- a/Hyena.Gui/Hyena.Data.Gui/ColumnHeaderCellText.cs
+++ b/Hyena.Gui/Hyena.Data.Gui/ColumnHeaderCellText.cs
@@ -64,7 +64,7 @@ namespace Hyena.Data.Gui
             }
 
             Gdk.Rectangle arrow_alloc = new Gdk.Rectangle ();
-            arrow_alloc.Width = (int)(cellHeight / 3.0);
+            arrow_alloc.Width = (int)(cellHeight / 2.0);
             arrow_alloc.Height = (int)((double)arrow_alloc.Width / 1.6);
             arrow_alloc.X = (int)cellWidth - arrow_alloc.Width - (int)Padding.Left;
             arrow_alloc.Y = ((int)cellHeight - arrow_alloc.Height) / 2;
diff --git a/Hyena.Gui/Hyena.Gui.Theming/GtkTheme.cs b/Hyena.Gui/Hyena.Gui.Theming/GtkTheme.cs
index af63902..6fefbdc 100644
--- a/Hyena.Gui/Hyena.Gui.Theming/GtkTheme.cs
+++ b/Hyena.Gui/Hyena.Gui.Theming/GtkTheme.cs
@@ -97,8 +97,12 @@ namespace Hyena.Gui.Theming
 
         public override void DrawArrow (Context cr, Gdk.Rectangle alloc, double rotation)
         {
-            rotation -= Math.PI / 2.0;
-            Widget.StyleContext.RenderArrow (cr, rotation, alloc.X, alloc.Y, alloc.Width * alloc.Height);
+            // 0 means pointing to the right for us, but it means pointing to the top for RenderArrow
+            rotation += Math.PI / 2.0;
+
+            int size = Math.Min (alloc.Height, alloc.Width);
+
+            Widget.StyleContext.RenderArrow (cr, rotation, alloc.X, alloc.Y, size);
         }
 
         public override void DrawFrameBackground (Cairo.Context cr, Gdk.Rectangle alloc, Cairo.Color color, Cairo.Pattern pattern)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]