void OnEditDone(object sender, EventArgs args) { ActionMenuItem item = (ActionMenuItem)sender; item.EditingDone -= OnEditDone; if (item.Node.Action.GtkAction.Label.Length > 0 || item.Node.Action.GtkAction.StockId != null) { actionGroup.Actions.Add(item.Node.Action); } else { IDesignArea designArea = GetDesignArea(); designArea.ResetSelection(item); item.Detach(); item.Node.Dispose(); items.Remove(item); item.Destroy(); PlaceAddLabel(actionGroup.Actions.Count); ShowAll(); } }
void OnChildRemoved(object ob, ActionTreeNodeArgs args) { IDesignArea area = wrapper.GetDesignArea(); IObjectSelection asel = area.GetSelection(); ActionMenuItem curSel = asel != null ? asel.DataObject as ActionMenuItem : null; int pos = menuItems.IndexOf(curSel); ActionMenuItem mi = FindMenuItem(args.Node); if (mi != null) { // Remove the table row that contains the menu item Gtk.Table.TableChild tc = (Gtk.Table.TableChild)table [mi]; uint row = tc.TopAttach; mi.Detach(); menuItems.Remove(mi); foreach (Gtk.Widget w in table.Children) { tc = (Gtk.Table.TableChild)table [w]; if (tc.TopAttach >= row) { tc.TopAttach--; } if (tc.BottomAttach > row) { tc.BottomAttach--; } } if (pos != -1 && pos < menuItems.Count) { ((ActionMenuItem)menuItems[pos]).Select(); } else { SelectLastItem(); } GLib.Timeout.Add(50, new GLib.TimeoutHandler(RepositionSubmenu)); } }