Exemplo n.º 1
0
        /// <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);
            }
        }
Exemplo n.º 2
0
 public void Append(PanedBox box)
 {
     if (container2 == null)
     {
         container2 = box;
         Pack2(box, true, false);
         container2.Visible = true;
     }
 }
Exemplo n.º 3
0
//		protected override void OnRemoved (Widget widget)
//		{
//			base.OnRemoved (widget);
//		}

        public void removeChildbox()
        {
            //PanedBox tmp = container2;
            //container2 = null;
            Remove(container2);
            container2 = null;
//			Remove(tmp);
//			tmp.Reparent(null);
//			tmp = null;
        }
Exemplo n.º 4
0
 /// <summary>
 /// add all widgets to list (recursiv)
 /// </summary>
 /// <param name='panedbox'>
 /// Panedbox.
 /// </param>
 /// <param name='list'>
 /// List.
 /// </param>
 private static void getChildWidgets(PanedBox panedbox, List <Widget> list)
 {
     if (panedbox.Widget1 != null)
     {
         list.Add(panedbox.Widget1);
     }
     if (panedbox.ChildBox != null)
     {
         getChildWidgets(panedbox.ChildBox, list);
     }
 }
Exemplo n.º 5
0
 private static void getChildBoxes(PanedBox panedbox, List <PanedBox> list)
 {
     if (panedbox.ChildBox != null)
     {
         list.Add(panedbox.ChildBox);
     }
     if (panedbox.ChildBox != null)
     {
         getChildBoxes(panedbox.ChildBox, list);
     }
 }
Exemplo n.º 6
0
 private PanedBox getLastChild(PanedBox parent)
 {
     parent.Visible = true;
     if (parent.ChildBox == null)
     {
         return(parent);
     }
     else
     {
         return(getLastChild(parent.ChildBox));
     }
 }
Exemplo n.º 7
0
        private Widget removeItem(Widget widget, bool x)
        {
            Widget w = container1.Children[0];

            if (w == widget)
            {
                container1.Remove(w);
                //w.Reparent(null); //TODO needed ?
                w.Parent = null;
                if (ParentBox != null)
                {
                    PanedBox temp = ChildBox;
                    if (temp != null)
                    {
                        ParentBox.removeChildbox();
                        temp.Reparent(this);
                        ParentBox.Append(temp);
                        //temp.Reparent(this);
                    }
                }
                else
                {
                    PanedBox temp = ChildBox;
                    if (temp != null)
                    {
                        Widget chld = temp.Widget1;
                        if (chld != null)
                        {
                            container1.PackStart(chld, true, true, 0);
                            chld.Reparent(container1);
                            container1.Visible = true;
                            chld.Visible       = true;
                            PanedBox temp2 = temp.ChildBox;
                            removeChildbox();
                            if (temp2 != null)
                            {
                                temp2.Reparent(this);
                                Append(temp2);
                            }
                        }
                    }
                }
                //Console.WriteLine(this.Name);
                return(w);
            }
            return(null);
        }
Exemplo n.º 8
0
        public static Widget removeItem(Widget w)
        {
            PanedBox pb = (w.Parent.Parent as PanedBox);

            if (pb != null)
            {
                if (pb.ParentBox != null)
                {
                    Widget wdg = pb.Widget1;
                    if (w == wdg)
                    {
                        pb.removeItem(w, true);
                        wdg.Reparent(null);

                        PanedBox parent = pb.ParentBox;
                        PanedBox temp   = pb.ChildBox;
                        parent.removeChildbox();
                        if (temp != null)
                        {
                            temp.Reparent(parent);
                            parent.Append(temp);
                            //temp.Visible = true;
                        }

                        pb.Dispose();
                        pb = null;

                        return(w);
                    }
                }
                else
                {
                    return(pb.removeItem(w, false));
                }
            }
            return(null);
        }
Exemplo n.º 9
0
        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);
        }
Exemplo n.º 10
0
 /// <summary>
 /// add all widgets to list (recursiv)
 /// </summary>
 /// <param name='panedbox'>
 /// Panedbox.
 /// </param>
 /// <param name='list'>
 /// List.
 /// </param>
 private static void getChildWidgets(PanedBox panedbox, List<Widget> list)
 {
     if (panedbox.Widget1 != null)
     {
         list.Add(panedbox.Widget1);
     }
     if (panedbox.ChildBox != null)
     {
         getChildWidgets(panedbox.ChildBox,list);
     }
 }
Exemplo n.º 11
0
 private static void getChildBoxes(PanedBox panedbox, List<PanedBox> list)
 {
     if (panedbox.ChildBox != null)
     {
         list.Add(panedbox.ChildBox);
     }
     if (panedbox.ChildBox != null)
     {
         getChildBoxes(panedbox.ChildBox,list);
     }
 }
Exemplo n.º 12
0
 //        protected override void OnRemoved (Widget widget)
 //        {
 //            base.OnRemoved (widget);
 //        }
 public void removeChildbox()
 {
     //PanedBox tmp = container2;
     //container2 = null;
     Remove(container2);
     container2 = null;
     //			Remove(tmp);
     //			tmp.Reparent(null);
     //			tmp = null;
 }
Exemplo n.º 13
0
 public void Append(PanedBox box)
 {
     if (container2 == null)
     {
         container2 = box;
         Pack2(box,true,false);
         container2.Visible = true;
     }
 }
Exemplo n.º 14
0
        /// <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);
            }
        }
Exemplo n.º 15
0
 private PanedBox(PanedBox parent, Widget widget1)
     : base(parent.Orientation)
 {
     ParentBox = parent;
     init(ParentBox.Orientation,widget1,null,false);
 }
Exemplo n.º 16
0
 private PanedBox getLastChild(PanedBox parent)
 {
     parent.Visible = true;
     if (parent.ChildBox == null)
     {
         return parent;
     } else
     {
         return getLastChild(parent.ChildBox);
     }
 }
Exemplo n.º 17
0
        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);
        }
Exemplo n.º 18
0
 private PanedBox(PanedBox parent, Widget widget1) : base(parent.Orientation)
 {
     ParentBox = parent;
     init(ParentBox.Orientation, widget1, null, false);
 }