Esempio n. 1
0
 public void Clear()
 {
     foreach (var child in container.Children)
     {
         container.Remove(child);
     }
 }
Esempio n. 2
0
        internal void AutoHide(DockItem item, AutoHideBox widget, bool animate)
        {
            if (animate)
            {
                widget.Hidden += delegate {
                    if (!widget.Disposed)
                    {
                        AutoHide(item, widget, false);
                    }
                };
                widget.AnimateHide();
            }
            else
            {
                // The widget may already be removed from the parent
                // so 'parent' can be null
                Gtk.Container parent = (Gtk.Container)item.Widget.Parent;
                if (parent != null)
                {
                    //removing the widget from its parent causes it to unrealize without unmapping
                    //so make sure it's unmapped
                    if (item.Widget.IsMapped)
                    {
                        item.Widget.Unmap();
                    }
                    parent.Remove(item.Widget);
                }
                parent = (Gtk.Container)item.TitleTab.Parent;
                if (parent != null)
                {
                    //removing the widget from its parent causes it to unrealize without unmapping
                    //so make sure it's unmapped
                    if (item.TitleTab.IsMapped)
                    {
                        item.TitleTab.Unmap();
                    }
                    parent.Remove(item.TitleTab);
                }
                if (widget.ContainerWindow != null)
                {
                    widget.ContainerWindow.Destroy();
                }
                else
                {
                    RemoveTopLevel(widget);
                }

                widget.Disposed = true;
                widget.Destroy();
            }
        }
Esempio n. 3
0
 public override void DefaultDetach(object target, object chld)
 {
     Gtk.Container parent = target as Gtk.Container;
     Gtk.Widget    child  = chld as Gtk.Widget;
     if (parent != null && child != null)
     {
         parent.Remove(child);
     }
 }
Esempio n. 4
0
    void DestroyMenuBar()
    {
        if (topMenu == null)
        {
            return;
        }

        rootWidget.Remove(topMenu);
        topMenu = null;
    }
Esempio n. 5
0
        protected override void HandleError(Exception e)
        {
            //remove the grid in case it was the source of the exception, as GTK# expose exceptions can fire repeatedly
            //also user should not be able to edit things when showing exceptions
            if (propertyGrid != null)
            {
                Gtk.Container parent = propertyGrid.Parent as Gtk.Container;
                if (parent != null)
                {
                    parent.Remove(propertyGrid);
                }

                propertyGrid.Destroy();
                propertyGrid = null;
            }

            //show the error message
            base.HandleError(e);
        }
Esempio n. 6
0
 internal void AutoHide(DockItem item, AutoHideBox widget, bool animate)
 {
     if (animate)
     {
         widget.Hidden += delegate {
             if (!widget.Disposed)
             {
                 AutoHide(item, widget, false);
             }
         };
         widget.AnimateHide();
     }
     else
     {
         Gtk.Container parent = (Gtk.Container)item.Widget.Parent;
         parent.Remove(item.Widget);
         RemoveTopLevel(widget);
         widget.Disposed = true;
         widget.Destroy();
     }
 }
Esempio n. 7
0
        void SetObject(ObjectDefinition obj)
        {
            if (activeObject == obj)
            {
                return;
            }
            activeObject = obj;

            foreach (Gtk.Widget widget in objectDataContainer.Children)
            {
                objectDataContainer.Remove(widget);
                widget.Dispose();
            }
            if (ObjectDataEditor != null)
            {
                ObjectDataEditor.RemoveDataModifiedHandler(OnObjectDataModified);
                ObjectDataEditor = null;
            }

            if (RoomEditor != null)
            {
                RoomEditor.OnObjectSelected();
            }

            if (obj == null)
            {
                frameLabel.Text = "";
                return;
            }
            frameLabel.Text = ObjectNames[(int)activeObject.GetObjectType()];

            ObjectDataEditor = new ValueReferenceEditor(Project, obj);
            ObjectDataEditor.AddDataModifiedHandler(OnObjectDataModified);

            objectDataContainer.Add(ObjectDataEditor);
            objectDataContainer.ShowAll();

            UpdateDocumentation();
        }
		void clearContainer (Container c)
		{
			while (c.Children.Length > 0)
				c.Remove (c.Children [0]);
		}
Esempio n. 9
0
        private void RemoveContainerEntries(Container widget)
        {
            if(widget.Children == null) {
                return;
            }

            while(widget.Children.Length > 0) {
                widget.Remove(widget.Children[0]);
            }
        }
Esempio n. 10
0
        /// <summary>
        /// switch to notebook mode
        /// </summary>
        /// <exception cref='Exception'>
        /// Represents errors that occur during application execution.
        /// </exception>
        protected void addPages()
        {
            if (notebook.Visible)
            {
                throw new Exception("this should not happen");                 //TODO
            }
            else
            {
                //Console.WriteLine("addPages()");
                List <PanedBox> lst = ChildBoxes;

                int pos = 0;

                notebook.Visible = false;

                foreach (PanedBox pb in lst)
                {
                    Widget w = PanedBox.removeItem(pb.Widget1);
                    if (w != null)
                    {
                        String            title = w.Name;
                        DockItemContainer dc    = w as DockItemContainer;
                        if (dc != null)
                        {
                            if (dc.CurrentWidget != null)
                            {
                                if (dc.CurrentWidget is DockableWidget)
                                {
                                    if (!String.IsNullOrEmpty(((DockableWidget)dc.CurrentWidget).Title))
                                    {
                                        title = ((DockableWidget)dc.CurrentWidget).Title;
                                    }
                                }
                            }
                        }

                        Gtk.Label lbl2 = new Gtk.Label(title);
                        //w.Parent = null;
                        //w.Reparent(notebook);
                        Gtk.Container c = (w.Parent as Gtk.Container);
                        if (c != null)
                        {
                            c.Remove(w);
                        }

                        //Console.WriteLine("insert page: " + w.Name + " visible: " + w.Visible);
                        //Console.WriteLine("notebook: " + notebook.Visible);
                        notebook.InsertPage(w, lbl2, pos);

                        pos++;
                    }
                    else
                    {
                        throw new Exception("item " + w.Name + "is to in the panedbox");
                    }
                }

                Widget first = removeItem(Widget1);

                String tt2 = first.Name;
                if (first is DockItemContainer)
                {
                    DockItemContainer dc = first as DockItemContainer;

                    if (!String.IsNullOrEmpty(((DockableWidget)dc.CurrentWidget).Title))
                    {
                        tt2 = ((DockableWidget)dc.CurrentWidget).Title;
                    }
                }

                Gtk.Label lbl = new Gtk.Label(tt2);

                notebook.Visible = true;
                //Console.WriteLine("insert page: " + first.Name + " visible: " + first.Visible);
                //Console.WriteLine("notebook: " + notebook.Visible);
                notebook.InsertPage(first, lbl, pos);

                AddItem(notebook);
                notebook.Page = 0;
                Mode          = ViewMode.Notebook;
            }
        }