[banshee] [RoundedFrame] use theme context radius



commit 0885637e2d9a0c3c728f5468b60577839372dba7
Author: Aaron Bockover <abockover novell com>
Date:   Sun May 2 16:24:25 2010 -0400

    [RoundedFrame] use theme context radius
    
    Do not use a hard-coded frame width, instead use the radius from the
    theme context to compute the inner padding.

 .../Hyena.Gui/Hyena.Widgets/RoundedFrame.cs        |   20 +++++++++-----------
 1 files changed, 9 insertions(+), 11 deletions(-)
---
diff --git a/src/Libraries/Hyena.Gui/Hyena.Widgets/RoundedFrame.cs b/src/Libraries/Hyena.Gui/Hyena.Widgets/RoundedFrame.cs
index 5c6a125..e7ab951 100644
--- a/src/Libraries/Hyena.Gui/Hyena.Widgets/RoundedFrame.cs
+++ b/src/Libraries/Hyena.Gui/Hyena.Widgets/RoundedFrame.cs
@@ -43,8 +43,6 @@ namespace Hyena.Widgets
             get { return theme; }
         }
 
-        private int frame_width = 3;
-
         private Widget child;
         private Gdk.Rectangle child_allocation;
         private bool fill_color_set;
@@ -108,8 +106,8 @@ namespace Hyena.Widgets
             }
 
             // Add the frame border
-            requisition.Width += ((int)BorderWidth + frame_width) * 2;
-            requisition.Height += ((int)BorderWidth + frame_width) * 2;
+            requisition.Width += ((int)BorderWidth + (int)theme.Context.Radius) * 2;
+            requisition.Height += ((int)BorderWidth + (int)theme.Context.Radius) * 2;
         }
 
         protected override void OnSizeAllocated (Gdk.Rectangle allocation)
@@ -122,11 +120,11 @@ namespace Hyena.Widgets
                 return;
             }
 
-            child_allocation.X = (int)BorderWidth + frame_width;
-            child_allocation.Y = (int)BorderWidth + frame_width;
+            child_allocation.X = (int)BorderWidth + (int)theme.Context.Radius;
+            child_allocation.Y = (int)BorderWidth + (int)theme.Context.Radius;
             child_allocation.Width = (int)Math.Max (1, Allocation.Width - child_allocation.X * 2);
             child_allocation.Height = (int)Math.Max (1, Allocation.Height - child_allocation.Y -
-                (int)BorderWidth - frame_width);
+                (int)BorderWidth - (int)theme.Context.Radius);
 
             child_allocation.X += Allocation.X;
             child_allocation.Y += Allocation.Y;
@@ -162,10 +160,10 @@ namespace Hyena.Widgets
 
         private void DrawFrame (Cairo.Context cr, Gdk.Rectangle clip)
         {
-            int x = child_allocation.X - frame_width;
-            int y = child_allocation.Y - frame_width;
-            int width = child_allocation.Width + 2 * frame_width;
-            int height = child_allocation.Height + 2 * frame_width;
+            int x = child_allocation.X - (int)theme.Context.Radius;
+            int y = child_allocation.Y - (int)theme.Context.Radius;
+            int width = child_allocation.Width + 2 * (int)theme.Context.Radius;
+            int height = child_allocation.Height + 2 * (int)theme.Context.Radius;
 
             Gdk.Rectangle rect = new Gdk.Rectangle (x, y, width, height);
 



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