public ClosableExpander AddListItem(string name, Widget widget, PObject obj)
        {
            if (noContentLabel != null)
            {
                contentBox.Remove(noContentLabel);
                noContentLabel.Destroy();
                noContentLabel = null;
            }

            var expander = new ClosableExpander();

            expanders++;
            expander.ContentLabel = name;
            expander.SetWidget(widget);
            expander.BorderWidth = 4;
            expander.Closed     += delegate(object sender, EventArgs e)
            {
                var expanderWidget = (ClosableExpander)sender;
                if (!RequestClose(expanderWidget))
                {
                    return;
                }
                expanders--;
                obj.Remove();
                if (expanderWidget.Parent == contentBox)
                {
                    contentBox.Remove(expanderWidget);
                }
                expanderWidget.Destroy();
                if (expanders == 0)
                {
                    Clear();
                }
            };
            contentBox.PackStart(expander, true, true, 0);
            contentBox.Show();
            expander.Expanded = false;
            return(expander);
        }
Exemple #2
0
 public ExpanderHeader(ClosableExpander container)
 {
     this.container = container;
     Events        |= EventMask.AllEventsMask;
 }
 public virtual bool RequestClose(ClosableExpander expander)
 {
     return(true);
 }
		public ClosableExpander AddListItem (string name, Widget widget, PObject obj)
		{
			if (noContentLabel != null) {
				contentBox.Remove (noContentLabel);
				noContentLabel.Destroy ();
				noContentLabel = null;
			}
			
			var expander = new ClosableExpander ();
			expanders++;
			expander.ContentLabel = name;
			expander.SetWidget (widget);
			expander.BorderWidth = 4;
			expander.Closed += delegate(object sender, EventArgs e) {
				var expanderWidget = (ClosableExpander)sender;
				if (!RequestClose (expanderWidget))
					return;
				expanders--;
				obj.Remove ();
				if (expanderWidget.Parent == contentBox)
					contentBox.Remove (expanderWidget);
				expanderWidget.Destroy ();
				if (expanders == 0)
					Clear ();
			};
			contentBox.PackStart (expander, true, true, 0);
			contentBox.Show ();
			expander.Expanded = false;
			return expander;
		}
		public virtual bool RequestClose (ClosableExpander expander)
		{
			return true;
		}
			public ExpanderHeader (ClosableExpander container)
			{
				this.container = container;
				Events |= EventMask.AllEventsMask;
			}