예제 #1
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);
        }
예제 #2
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);
        }