private void init(Orientation orientation, Widget widget1, Widget widget2,bool initChildPaned) { Orientation = orientation; // Gtk.Button bt = new Gtk.Button(); // bt.Label = "asd§"; // bt.Visible = true; // Add(bt); // paned = new Paned(Orientation); // paned.Visible = true; // Add(paned); container1 = new Box(Orientation,0); Pack1(container1,true,false); container1.Expand = true; container1.BorderWidth = 1; if (initChildPaned) { container2 = new PanedBox(this, widget2); Pack2(container2,true,false); container2.Visible = true; } // if(widget2 == null) // { // paned.Visible = false; // } if ((container1 != null) && (widget1 != null)) { widget1.Reparent(container1); container1.PackStart(widget1,true,true,0); container1.Visible = true; } //Add(paned); }
private void Reparent (Widget widget, HBox box, int index) { if (widget.Parent == box) { return; } if (widget.Parent == null) { box.PackStart (widget, false, false, 0); } else { widget.Reparent (box); box.SetChildPacking (widget, false, false, 0, PackType.Start); } box.ReorderChild (widget, index); widget.Show (); }
/// <summary> /// Adds a new Widget to the box /// </summary> /// <param name='widget'> /// Widget. /// </param> public void AddItem(Widget widget) { if (container1.Children.Length == 0) { //Console.WriteLine("panedbox: no children add: " + widget.Name + " widget: " + widget.Visible); //Console.WriteLine("container1: " +container1.Visible); if (widget.Parent != null) { widget.Reparent(container1); //TODO check if parent id not container1 } if (!container1.Visible) { container1.Visible = true; } container1.PackStart(widget,true,true,0); } else { //Console.WriteLine("have children"); PanedBox lb = getLastChild(this); PanedBox newbox = new PanedBox(lb,widget); lb.Append(newbox); } }