void OnProjectReloaded(object s, EventArgs a) { Gtk.Widget topWidget = project.GetWidget(sourceWidget); if (topWidget != null) { rootWidget = Stetic.Wrapper.Container.Lookup(topWidget); undoManager.RootObject = rootWidget; if (rootWidget != null) { Gtk.Widget oldWidget = designer; if (widget != null) { widget.SelectionChanged -= OnSelectionChanged; widget = null; } OnRootWidgetChanged(); if (oldWidget != null) { // Delay the destruction of the old widget, so the designer has time to // show the new widget. This avoids flickering. GLib.Timeout.Add(500, delegate { oldWidget.Destroy(); return(false); }); } project.NotifyComponentTypesChanged(); return; } } SetErrorMode(); }
public void ClearChild() { if (Children.Length > 0) { Gtk.Widget w = Children [0]; Remove(w); w.Destroy(); } }
internal virtual void OnBackendChanged(ApplicationBackend oldBackend) { if (!initialized) { return; } Gtk.Widget w = book.GetNthPage(0); book.RemovePage(0); w.Destroy(); socket.Dispose(); ConnectPlug(); }
void ShowDocumentation(object ob) { if (docView != null) { paned.Remove(docView); docView.Destroy(); docView = null; } ITreeNavigator nav = tree.GetSelectedNode(); RegistryInfo regInfo = (RegistryInfo)nav.GetParentDataItem(typeof(RegistryInfo), true); AddinRegistry reg = regInfo.CachedRegistry; if (ob is AddinDescription) { AddinView view = new AddinView(); view.Fill((AddinDescription)ob); docView = view; } else if (ob is ExtensionPoint) { ExtensionPointView view = new ExtensionPointView(); view.Fill((ExtensionPoint)ob, reg); docView = view; } else if (ob is Extension) { ExtensionView view = new ExtensionView(); view.Fill((Extension)ob, nav); docView = view; } else if (ob is ExtensionNodeInfo) { ExtensionNodeView view = new ExtensionNodeView(); view.Fill(((ExtensionNodeInfo)ob).Node); docView = view; } if (docView == null) { docView = new Gtk.Label(); } docView.ShowAll(); paned.Add2(docView); }
public override void Dispose() { if (widget != null) { widget.KeyPressEvent -= toolbox.OnKeyPressed; widget.KeyReleaseEvent -= toolbox.KeyReleased; widget.Destroy(); widget.Dispose(); widget = null; } if (toolbox != null) { toolbox.Dispose(); toolbox = null; } base.Dispose(); }
protected void AddCustomWidget(Gtk.Widget w) { w.ShowAll(); book.AppendPage(w, null); book.Page = book.NPages - 1; if (initialized) { Gtk.Widget cw = book.GetNthPage(0); book.RemovePage(0); cw.Destroy(); } else { initialized = true; } }
void OnProjectReloaded(object s, EventArgs a) { // Update the actions group list if (!autoCommitChanges) { gproject.AttachActionGroups(sourceProject.ActionGroups); gproject.WidgetLibraries = (ArrayList)sourceProject.WidgetLibraries.Clone(); gproject.InternalWidgetLibraries = (ArrayList)sourceProject.InternalWidgetLibraries.Clone(); } Gtk.Widget[] tops = gproject.Toplevels; if (tops.Length > 0) { rootWidget = Stetic.Wrapper.Container.Lookup(tops[0]); undoManager.RootObject = rootWidget; if (rootWidget != null) { Gtk.Widget oldWidget = designer; if (widget != null) { widget.SelectionChanged -= OnSelectionChanged; widget = null; } OnRootWidgetChanged(); if (oldWidget != null) { // Delay the destruction of the old widget, so the designer has time to // show the new widget. This avoids flickering. GLib.Timeout.Add(500, delegate { oldWidget.Destroy(); return(false); }); } gproject.NotifyComponentTypesChanged(); return; } } SetErrorMode(); }
protected virtual void OnDestroyWidget(Gtk.Widget w) { w.Destroy(); }
void CreateControls() { Gtk.Widget icon = null; Gtk.Widget label = null; dropButton = null; if (Child != null) { Gtk.Widget w = Child; Remove(w); w.Destroy(); } if (node.Type == Gtk.UIManagerItemType.Separator) { Gtk.Widget sep; if (parentToolbar.Orientation == Gtk.Orientation.Horizontal) { sep = new Gtk.VSeparator(); } else { sep = new Gtk.HSeparator(); } Gtk.HBox box = new Gtk.HBox(); box.BorderWidth = 6; box.PackStart(sep, true, true, 0); Add(box); return; } if (node.Action == null) { return; } Gtk.Action gaction = node.Action.GtkAction; bool showText = parentToolbar.ToolbarStyle == Gtk.ToolbarStyle.Text; bool showIcon = parentToolbar.ToolbarStyle == Gtk.ToolbarStyle.Icons; if (parentToolbar.ToolbarStyle == Gtk.ToolbarStyle.Both) { showText = showIcon = true; } else if (parentToolbar.ToolbarStyle == Gtk.ToolbarStyle.BothHoriz) { showText = parentToolbar.Orientation == Gtk.Orientation.Vertical || gaction.IsImportant; showIcon = true; } string text = node.Action.ToolLabel; showingText = showText; if (showIcon) { if (gaction.StockId != null) { icon = node.Action.CreateIcon(parentToolbar.IconSize); } else if (!gaction.IsImportant) { icon = CreateFakeItem(); } } Gtk.Tooltips tooltips = null; if (editing) { tooltips = new Gtk.Tooltips(); } if (editing) { Gtk.HBox bbox = new Gtk.HBox(); bbox.Spacing = 3; if (icon != null) { bbox.PackStart(icon, false, false, 0); } bbox.PackStart(new Gtk.Arrow(Gtk.ArrowType.Down, Gtk.ShadowType.In), false, false, 0); Gtk.Button b = new Gtk.Button(bbox); tooltips.SetTip(b, "Select action type", ""); b.Relief = Gtk.ReliefStyle.None; b.ButtonPressEvent += OnSelectIcon; dropButton = b; icon = b; if (showText) { Gtk.Entry entry = new Gtk.Entry(); entry.Text = text; entry.Changed += OnLabelChanged; entry.Activated += OnLabelActivated; entry.HasFrame = false; label = entry; tooltips.SetTip(entry, "Action label", ""); } } else if (showText && text != null && text.Length > 0) { label = new Gtk.Label(text); label.Sensitive = editing || node.Action == null || node.Action.GtkAction.Sensitive; } if (icon != null && label != null) { if (parentToolbar.ToolbarStyle == Gtk.ToolbarStyle.BothHoriz) { Gtk.HBox box = new Gtk.HBox(); box.PackStart(icon, false, false, 0); box.PackStart(label, true, true, 0); icon = box; } else if (parentToolbar.ToolbarStyle == Gtk.ToolbarStyle.Both) { Gtk.VBox box = new Gtk.VBox(); Gtk.Alignment al = new Gtk.Alignment(0.5f, 0f, 0f, 0f); al.Add(icon); box.PackStart(al, false, false, 0); box.PackStart(label, true, true, 0); icon = box; } } else if (label != null) { icon = label; } if (icon == null) { icon = CreateFakeItem(); } icon.Sensitive = editing || node.Action == null || node.Action.GtkAction.Sensitive; if (!editing) { Gtk.Button but = new Gtk.Button(icon); but.Relief = Gtk.ReliefStyle.None; but.ButtonPressEvent += OnToolItemPress; but.ButtonReleaseEvent += OnMemuItemRelease; but.MotionNotifyEvent += OnMotionNotify; but.Events |= Gdk.EventMask.PointerMotionMask; icon = but; } Add(icon); ShowAll(); }
public virtual void Drop(Gtk.Widget widget, object faultId) { widget.Destroy(); }