[Monodevelop-patches-list] r752 - trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui.Widgets/PropertyGrid

commit-watcher at mono-cvs.ximian.com commit-watcher at mono-cvs.ximian.com
Mon Feb 2 00:41:04 EST 2004


Author: tberman
Date: 2004-02-02 00:41:04 -0500 (Mon, 02 Feb 2004)
New Revision: 752

Modified:
   trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui.Widgets/PropertyGrid/PropertyGridGroup.cs
Log:
now the button shows/hides the properties


Modified: trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui.Widgets/PropertyGrid/PropertyGridGroup.cs
===================================================================
--- trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui.Widgets/PropertyGrid/PropertyGridGroup.cs	2004-02-02 05:20:37 UTC (rev 751)
+++ trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui.Widgets/PropertyGrid/PropertyGridGroup.cs	2004-02-02 05:41:04 UTC (rev 752)
@@ -13,19 +13,44 @@
 		Table internalTable;
 
 		ArrayList PropertyGridItems;
+
+		bool visible = true;
 		
 		public PropertyGridGroup (string header) : base (2, 2, false)
 		{
 			PropertyGridItems = new ArrayList ();
 			this.expandButton = new Button (".");
-			Attach (this.expandButton, 0, 1, 0, 1, Gtk.AttachOptions.Shrink, Gtk.AttachOptions.Shrink, 0, 0);
+			expandButton.Clicked += new EventHandler (OnExpandClicked);
 			this.header = new ELabel (header);
-			Attach (this.header, 1, 2, 0, 1, Gtk.AttachOptions.Fill, Gtk.AttachOptions.Shrink, 0, 0);
-
 			internalTable = new Gtk.Table (1, 2, true);
-			Attach (internalTable, 1, 2, 1, 2, Gtk.AttachOptions.Expand, Gtk.AttachOptions.Shrink, 0, 0);
+			Setup ();
 		}
 
+		void Setup ()
+		{
+			foreach (Gtk.Widget child in Children) {
+				Remove (child);
+			}
+			Attach (this.expandButton, 0, 1, 0, 1, Gtk.AttachOptions.Shrink, Gtk.AttachOptions.Shrink, 0, 0);
+			if (visible) {
+				Attach (this.header, 1, 2, 0, 1, Gtk.AttachOptions.Fill, Gtk.AttachOptions.Shrink, 0, 0);
+				Attach (internalTable, 1, 2, 1, 2, Gtk.AttachOptions.Expand, Gtk.AttachOptions.Shrink, 0, 0);
+			} else {
+				Attach (this.header, 1, 2, 0, 1);
+			}
+		}
+
+		void OnExpandClicked (object o, EventArgs e)
+		{
+			if (visible) {
+				visible = false;
+				Setup ();
+			} else {
+				visible = true;
+				Setup ();
+			}
+		}
+
 		public void AddGridItem (string name, Gtk.Widget editor)
 		{
 			PropertyGridItem newItem = new PropertyGridItem (name, editor);




More information about the Monodevelop-patches-list mailing list