banshee r4171 - in trunk/banshee: . src/Libraries/Hyena.Gui/Hyena.Widgets



Author: gburt
Date: Thu Jun 19 16:42:17 2008
New Revision: 4171
URL: http://svn.gnome.org/viewvc/banshee?rev=4171&view=rev

Log:
2008-06-19  Gabriel Burt  <gabriel burt gmail com>

	* src/Libraries/Hyena.Gui/Hyena.Widgets/RoundedFrame.cs: Fix the
	OnSizeRequested override so that the Recommendations pane is the right
	height.  Proper implementation gleaned from gtkframe.c.


Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Widgets/RoundedFrame.cs

Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Widgets/RoundedFrame.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Widgets/RoundedFrame.cs	(original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Widgets/RoundedFrame.cs	Thu Jun 19 16:42:17 2008
@@ -93,20 +93,23 @@
         protected override void OnSizeRequested (ref Requisition requisition)
         {
             if (child == null) {
+                base.OnSizeRequested (ref requisition);
                 return;
             }
             
-            int width = requisition.Width;
-            int height = requisition.Height;
-                
-            child.SizeRequest ();
-            child.GetSizeRequest (out width, out height);
-            if (width == -1 || height == -1) {
-                width = height = 80;
-            }
-                
-            SetSizeRequest (width + ((int)BorderWidth + frame_width) * 2, 
-                height + ((int)BorderWidth + frame_width) * 2);
+            requisition.Width = 0;
+            requisition.Height = 0;
+            
+            // Add the child's width/height        
+            Requisition child_requisition = child.SizeRequest ();
+            requisition.Width = Math.Max (requisition.Width, child_requisition.Width);
+            requisition.Height += child_requisition.Height;
+            
+            // Add the frame border
+            requisition.Width += ((int)BorderWidth + frame_width) * 2;
+            requisition.Height += ((int)BorderWidth + frame_width) * 2;
+            
+            base.OnSizeRequested (ref requisition);
         }
 
         protected override void OnSizeAllocated (Gdk.Rectangle allocation)
@@ -118,7 +121,7 @@
             if (child == null || !child.Visible) {
                 return;
             }
-                
+            
             child_allocation.X = (int)BorderWidth + frame_width;
             child_allocation.Y = (int)BorderWidth + frame_width;
             child_allocation.Width = (int)Math.Max (1, Allocation.Width - child_allocation.X * 2);
@@ -127,7 +130,7 @@
                 
             child_allocation.X += Allocation.X;
             child_allocation.Y += Allocation.Y;
-                
+            
             child.SizeAllocate (child_allocation);
         }
         



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