[Monodevelop-patches-list] r1714 - trunk/MonoDevelop/src/Libraries/Gdl

commit-watcher at mono-cvs.ximian.com commit-watcher at mono-cvs.ximian.com
Tue Jun 8 13:51:53 EDT 2004


Author: tberman
Date: 2004-06-08 13:51:53 -0400 (Tue, 08 Jun 2004)
New Revision: 1714

Modified:
   trunk/MonoDevelop/src/Libraries/Gdl/DockItem.cs
   trunk/MonoDevelop/src/Libraries/Gdl/DockNotebook.cs
   trunk/MonoDevelop/src/Libraries/Gdl/DockPaned.cs
   trunk/MonoDevelop/src/Libraries/Gdl/DockPlaceholder.cs
Log:
more code


Modified: trunk/MonoDevelop/src/Libraries/Gdl/DockItem.cs
===================================================================
--- trunk/MonoDevelop/src/Libraries/Gdl/DockItem.cs	2004-06-08 17:19:58 UTC (rev 1713)
+++ trunk/MonoDevelop/src/Libraries/Gdl/DockItem.cs	2004-06-08 17:51:53 UTC (rev 1714)
@@ -170,7 +170,7 @@
 			get { return ((this.Behavior & DockItemBehavior.CantIconify) != 0); }
 		}
 		
-		protected override OnAdded (Gtk.Widget widget)
+		protected override void OnAdded (Gtk.Widget widget)
 		{
 			if (widget is DockObject) {
 				Console.WriteLine ("You can't add a DockObject to a DockItem");
@@ -184,7 +184,7 @@
 			this.Child = widget;
 		}
 		
-		protected override OnRemoved (Gtk.Widget widget)
+		protected override void OnRemoved (Gtk.Widget widget)
 		{
 			if (this.grip == widget) {
 				bool grip_was_visible = widget.Visible;
@@ -262,7 +262,7 @@
 			this.SetSizeRequest (requisition.Width, requisition.Height);
 		}
 		
-		protected override OnSizeAllocated (ref Gdk.Rectangle allocation)
+		protected override void OnSizeAllocated (ref Gdk.Rectangle allocation)
 		{
 			this.Allocation = allocation;
 			if (this.IsRealized) {
@@ -296,7 +296,7 @@
 			}
 		}
 		
-		protected override OnMapped ()
+		protected override void OnMapped ()
 		{
 			this.Flags |= (int)Gtk.WidgetFlags.Mapped;
 			this.GdkWindow.Show ();
@@ -306,7 +306,7 @@
 				this.grip.Map ();
 		}
 		
-		protected override OnUnmapped ()
+		protected override void OnUnmapped ()
 		{
 			this.Flags &= ~((int)Gtk.WidgetFlags.Mapped);
 			this.GdkWindow.Hide ();
@@ -314,7 +314,7 @@
 				this.grip.Unmap ();
 		}
 		
-		protected override OnRealized ()
+		protected override void OnRealized ()
 		{
 			this.Flags |= (int)Gtk.WidgetFlags.Realized;
 			Gdk.WindowAttr attributes;
@@ -339,7 +339,7 @@
 				this.grip.ParentWindow = this.GdkWindow;
 		}
 		
-		protected override OnStyleSet (Gtk.Style previous_style)
+		protected override void OnStyleSet (Gtk.Style previous_style)
 		{
 			if (this.IsRealized && !this.NoWindow) {
 				this.Style.SetBackground (this.GdkWindow, this.State);
@@ -455,10 +455,12 @@
 			return base.OnKeyPressEvent (evnt);
 		}
 		
-		protected static PreferredSize (DockItem item, ref Gdk.Rectangle req)
+		protected static Gtk.Requisition PreferredSize (DockItem item)
 		{
+			Gtk.Requisition req;
 			req.Width = Math.Max (item.preferred_width, item.Allocation.Width);
 			req.Height = Math.Max (item.preferred_height, item.Allocation.Height);
+			return req;
 		}
 		
 		public override bool DockRequest (int x, int y, DockRequest request)
@@ -478,7 +480,7 @@
 				if (rx < 0.4) {
 					request.Position = DockPlacement.Left;
 					divider = other.Width;
-				} else if (rx > (1 - 0.4) {
+				} else if (rx > (1 - 0.4)) {
 					request.Position = DockPlacement.Right;
 					rx = 1 - rx;
 					divider = Math.Max (0, my.Width - other.Width);
@@ -531,8 +533,8 @@
 				if (request.Position != DockPlacement.Center && divider >= 0)
 					request.Extra = divider;
 				return true;
-			} else
-				return false;
+			}
+			return false;
 		}
 		
 		public override void Dock (DockObject requestor, DockPlacement position, object other_data)

Modified: trunk/MonoDevelop/src/Libraries/Gdl/DockNotebook.cs
===================================================================
--- trunk/MonoDevelop/src/Libraries/Gdl/DockNotebook.cs	2004-06-08 17:19:58 UTC (rev 1713)
+++ trunk/MonoDevelop/src/Libraries/Gdl/DockNotebook.cs	2004-06-08 17:51:53 UTC (rev 1714)
@@ -23,9 +23,9 @@
 			this.Child = new Gtk.Notebook ();
 			this.Child.Parent = this;
 			((Gtk.Notebook)this.Child).TabPos = Gtk.PositionType.Bottom;
-			((Gtk.Notebook)this.Child).SwitchPage += new Gtk.SwitchPageHandler (SwitchPageCb);
-			((Gtk.Notebook)this.Child).ButtonPressEvent += new Gtk.ButtonPressEvent (ButtonPressCb);
-			((Gtk.Notebook)this.Child).ButtonReleaseEvent += new Gtk.ButtonReleaseEvent (ButtonReleaseCb);
+			//((Gtk.Notebook)this.Child).SwitchPage += new Gtk.SwitchPageHandler (SwitchPageCb);
+			//((Gtk.Notebook)this.Child).ButtonPressEvent += new Gtk.ButtonPressEvent (ButtonPressCb);
+			//((Gtk.Notebook)this.Child).ButtonReleaseEvent += new Gtk.ButtonReleaseEvent (ButtonReleaseCb);
 			((Gtk.Notebook)this.Child).Scrollable = true;
 			this.Child.Show ();
 			this.DockObjectFlags &= DockObjectFlags.Automatic;
@@ -50,7 +50,6 @@
 				base.ForAll (include_internals, invoker);
 			} else {
 				if (this.Child != null) {
-					Console.WriteLine ("Missing a foreach here we prolly need");
 					stored_invoker = invoker;
 					lock (stored_invoker) {
 						((Gtk.Notebook)this.Child).Foreach (new Gtk.Callback (childForall));
@@ -101,17 +100,17 @@
 						label = new Gtk.Label (requestor_item.LongName);
 						requestor_item.TabLabel = label;
 					}
-					int position = -1;
+					int new_position = -1;
 					if (extra_data is Int32)
-						position = Convert.ToInt32 (extra_data);
-					((Gtk.Notebook)this.Child).InsertPage (requestor, label, position);
+						new_position = Convert.ToInt32 (extra_data);
+					((Gtk.Notebook)this.Child).InsertPage (requestor, label, new_position);
 					requestor.DockObjectFlags |= DockObjectFlags.Attached;
 				}
 			} else
 				base.Dock (requestor, position, extra_data);
 		}
 		
-		public override SetOrientation (Gtk.Orientation orientation)
+		public override void SetOrientation (Gtk.Orientation orientation)
 		{
 			if (this.Child != null && this.Child is Gtk.Notebook) {
 				if (orientation == Gtk.Orientation.Horizontal)

Modified: trunk/MonoDevelop/src/Libraries/Gdl/DockPaned.cs
===================================================================
--- trunk/MonoDevelop/src/Libraries/Gdl/DockPaned.cs	2004-06-08 17:19:58 UTC (rev 1713)
+++ trunk/MonoDevelop/src/Libraries/Gdl/DockPaned.cs	2004-06-08 17:51:53 UTC (rev 1714)
@@ -1 +1,94 @@
-// created on 07/06/2004 at 5:43 P
\ No newline at end of file
+// created on 07/06/2004 at 5:43 P
+
+using System;
+using Gtk;
+
+namespace Gdl
+{
+	public class DockPaned : Gdl.DockItem
+	{
+		private bool position_changed = false;
+		
+		public override bool HasGrip {
+			get { return false; }
+		}
+		
+		public override bool IsCompound {
+			get { return true; }
+		}
+		
+		public int Position {
+			get {
+				if (this.Child != null && this.Child is Gtk.Paned) {
+					return ((Gtk.Paned)this.Child).Position;
+				}
+				return 0;
+			}
+			set {
+				if (this.Child != null && this.Child is Gtk.Paned) {
+					((Gtk.Paned)this.Child).Position = value;
+				}
+			}
+		}
+		
+		private void CreateChild (Gtk.Orientation orientation)
+		{
+			if (this.Child != null)
+				this.Child.Unparent ();
+				
+			if (orientation == Gtk.Orientation.Horizontal)
+				this.Child = new Gtk.HPaned ();
+			else
+				this.Child = new Gtk.VPaned ();
+			
+			//Signal connects?
+			
+			this.Child.Parent = this;
+			this.Child.Show ();
+		}
+		
+		protected override void OnAdded (Gtk.Widget widget)
+		{
+			DockItem item = widget as Gdl.DockItem;
+			if (item == null)
+				return;
+			Gtk.Paned paned = (Gtk.Paned)this.Child;
+			if (paned.Child1 != null && paned.Child2 != null)
+				return;
+			
+			DockPlacement pos = DockPlacement.None;
+			
+			if (paned.Child1 == null)
+				pos = item.Orientation == Gtk.Orientation.Horizontal ? DockPlacement.Left : DockPlacement.Top;
+			else
+				pos = item.Orientation == Gtk.Orientation.Vertical ? DockPlacement.Right : DockPlacement.Bottom;
+			
+			if (pos != DockPlacement.None)
+				this.Dock (item, pos, null);
+		}
+		
+		protected override void OnAdded (Gtk.Widget widget)
+		{
+			if (widget == null || !(widget is DockItem))
+				return;
+			this.Dock ((DockObject)widget, DockPlacement.Center, null);
+		}
+		
+		private CallbackInvoker stored_invoker;
+		protected override void ForAll (bool include_internals, CallbackInvoker invoker)
+		{
+			if (include_internals) {
+				base.ForAll (include_internals, invoker);
+			} else {
+				if (this.Child != null) {
+					stored_invoker = invoker;
+					lock (stored_invoker) {
+						((Gtk.Paned)this.Child).Foreach (new Gtk.Callback (childForall));
+					}
+				}
+			}
+		}
+		
+		
+	}
+}
\ No newline at end of file

Modified: trunk/MonoDevelop/src/Libraries/Gdl/DockPlaceholder.cs
===================================================================
--- trunk/MonoDevelop/src/Libraries/Gdl/DockPlaceholder.cs	2004-06-08 17:19:58 UTC (rev 1713)
+++ trunk/MonoDevelop/src/Libraries/Gdl/DockPlaceholder.cs	2004-06-08 17:51:53 UTC (rev 1714)
@@ -44,7 +44,7 @@
 		
 		public DockObject Host {
 			get { return host; }
-			set { this.Attach (value) }
+			set { this.Attach (value); }
 		}
 		
 		public DockPlacement NextPlacement {
@@ -96,7 +96,7 @@
 			if (this.host != null && !this.Sticky && this.placement_stack != null && this.host.IsCompound) {
 				DockPlacement pos;
 				DockPlacement stack_pos = this.NextPlacement;
-				foreach (Gtk.Widget child = this.host.Children) {
+				foreach (Gtk.Widget child in this.host.Children) {
 					DockObject item = child as DockObject;
 					if (item == null)
 						continue;




More information about the Monodevelop-patches-list mailing list