[Monodevelop-patches-list] r2368 - trunk/MonoDevelop/Core/src/MonoDevelop.Dock
John Luke <jluke@cfl.rr.com>
jluke at mono-cvs.ximian.com
Thu Mar 17 14:31:49 EST 2005
Author: jluke
Date: 2005-03-17 14:31:48 -0500 (Thu, 17 Mar 2005)
New Revision: 2368
Modified:
trunk/MonoDevelop/Core/src/MonoDevelop.Dock/ChangeLog
trunk/MonoDevelop/Core/src/MonoDevelop.Dock/Dock.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Dock/DockItem.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Dock/DockItemGrip.cs
Log:
clean up SizeRequest and SizeAlloc
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Dock/ChangeLog
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Dock/ChangeLog 2005-03-17 18:24:15 UTC (rev 2367)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Dock/ChangeLog 2005-03-17 19:31:48 UTC (rev 2368)
@@ -1,3 +1,10 @@
+2005-03-17 John Luke <john.luke at gmail.com>
+
+ * Dock.cs:
+ * DockItem.cs:
+ * DockItemGrip.cs: clean up SizeRequest and SizeAllocate
+ fixes one of our resizing bugs
+
2005-03-15 John Luke <john.luke at gmail.com>
* DockBar.cs:
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Dock/Dock.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Dock/Dock.cs 2005-03-17 18:24:15 UTC (rev 2367)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Dock/Dock.cs 2005-03-17 19:31:48 UTC (rev 2368)
@@ -176,33 +176,29 @@
protected override void OnSizeRequested (ref Requisition requisition)
{
- requisition.Width = 2 * (int)BorderWidth;
- requisition.Height = 2 * (int)BorderWidth;
-
// make request to root
- if (root != null && root.Visible) {
- Requisition rootReq = root.SizeRequest ();
- requisition.Width += rootReq.Width;
- requisition.Height += rootReq.Height;
- }
+ if (root != null && root.Visible)
+ requisition = root.SizeRequest ();
+ else
+ requisition.Width = requisition.Height = 0;
+
+ requisition.Width += 2 * (int)BorderWidth;
+ requisition.Height += 2 * (int)BorderWidth;
}
protected override void OnSizeAllocated (Gdk.Rectangle allocation)
{
base.OnSizeAllocated (allocation);
- if (root != null && root.Visible) {
- int bw = (int)BorderWidth;
- Gdk.Rectangle childAlloc;
-
- // reduce allocation by border width
- childAlloc.X = allocation.X + bw;
- childAlloc.Y = allocation.Y + bw;
- childAlloc.Width = Math.Max (1, allocation.Width - 2 * bw);
- childAlloc.Height = Math.Max (1, allocation.Height - 2 * bw);
-
- root.SizeAllocate (childAlloc);
- }
+ // reduce allocation by border width
+ int bw = (int)BorderWidth;
+ allocation.X += bw;
+ allocation.Y += bw;
+ allocation.Width = Math.Max (1, allocation.Width - 2 * bw);
+ allocation.Height = Math.Max (1, allocation.Height - 2 * bw);
+
+ if (root != null && root.Visible)
+ root.SizeAllocate (allocation);
}
protected override void OnMapped ()
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Dock/DockItem.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Dock/DockItem.cs 2005-03-17 18:24:15 UTC (rev 2367)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Dock/DockItem.cs 2005-03-17 19:31:48 UTC (rev 2368)
@@ -277,7 +277,9 @@
requisition.Height = ((int)BorderWidth + Style.YThickness) * 2;
Requisition childReq;
- if (Child != null && Child.Visible) {
+ // If our child is not visible, we still request its size, since
+ // we won't have any useful hint for our size otherwise.
+ if (Child != null) {
childReq = Child.SizeRequest ();
} else {
childReq.Width = 0;
@@ -290,26 +292,28 @@
if (Orientation == Orientation.Horizontal) {
if (GripShown) {
gripReq = grip.SizeRequest ();
- requisition.Width += gripReq.Width;
+ requisition.Width = gripReq.Width;
}
if (Child != null) {
requisition.Width += childReq.Width;
- requisition.Height += Math.Max (childReq.Height,
+ requisition.Height = Math.Max (childReq.Height,
gripReq.Height);
}
} else {
if (GripShown) {
gripReq = grip.SizeRequest ();
- requisition.Height += gripReq.Height;
+ requisition.Height = gripReq.Height;
}
if (Child != null) {
- requisition.Width += Math.Max (childReq.Width,
- gripReq.Width);
+ requisition.Width = childReq.Width;
requisition.Height += childReq.Height;
}
}
+
+ requisition.Width += (int) (this.BorderWidth + this.Style.XThickness) * 2;
+ requisition.Height += (int) (this.BorderWidth + this.Style.XThickness) * 2;
}
protected override void OnSizeAllocated (Gdk.Rectangle allocation)
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Dock/DockItemGrip.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Dock/DockItemGrip.cs 2005-03-17 18:24:15 UTC (rev 2367)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Dock/DockItemGrip.cs 2005-03-17 19:31:48 UTC (rev 2368)
@@ -351,18 +351,23 @@
requisition.Width = (int)BorderWidth * 2;
requisition.Height = (int)BorderWidth * 2;
+ // ensure_title_and_icon_pixbuf (grip);
+ int layoutHeight, layoutWidth;
+ this.Layout.GetPixelSize (out layoutWidth, out layoutHeight);
+
Requisition childReq = closeButton.SizeRequest ();
requisition.Width += childReq.Width;
- requisition.Height = Math.Max (requisition.Height, childReq.Height);
+ layoutHeight = Math.Max (requisition.Height, childReq.Height);
childReq = iconifyButton.SizeRequest ();
requisition.Width += childReq.Width;
- requisition.Height = Math.Max (requisition.Height, childReq.Height);
+ layoutHeight = Math.Max (requisition.Height, childReq.Height);
+
+ requisition.Height = layoutHeight;
if (Icon != null) {
requisition.Width += icon.Width + 1;
- requisition.Height = Math.Max (requisition.Height,
- icon.Height);
+ requisition.Height = Math.Max (requisition.Height, icon.Height);
}
}
More information about the Monodevelop-patches-list
mailing list