void OnChildRemoved(object ob, ActionTreeNodeArgs args) { OpenSubmenu = null; Widget wrapper = Widget.Lookup (this); IDesignArea area = wrapper.GetDesignArea (); IObjectSelection asel = area.GetSelection (); ActionMenuItem curSel = asel != null ? asel.DataObject as ActionMenuItem : null; int pos = menuItems.IndexOf (curSel); foreach (Gtk.Widget w in Children) { if (w is CustomMenuBarItem && ((CustomMenuBarItem)w).ActionMenuItem.Node == args.Node) { Remove (w); menuItems.Remove (((CustomMenuBarItem)w).ActionMenuItem); if (menuItems.Count == 0 && !showPlaceholder) AddSpacerItem (); break; } } if (pos != -1 && pos < menuItems.Count) ((ActionMenuItem)menuItems[pos]).Select (); else if (menuItems.Count > 0) ((ActionMenuItem)menuItems[menuItems.Count-1]).Select (); }
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)); } }
void OnChildAdded(object ob, ActionTreeNodeArgs args) { Refresh (); }
void OnChildRemoved (object ob, ActionTreeNodeArgs args) { Widget wrapper = Stetic.Wrapper.Widget.Lookup (this); IDesignArea area = wrapper.GetDesignArea (); IObjectSelection asel = area.GetSelection (); ActionToolItem curSel = asel != null ? asel.DataObject as ActionToolItem : null; int pos = toolItems.IndexOf (curSel); foreach (Gtk.Widget w in Children) { if (w is CustomToolbarItem && ((CustomToolbarItem)w).ActionToolItem.Node == args.Node) { Remove (w); toolItems.Remove (((CustomToolbarItem)w).ActionToolItem); w.Destroy (); if (!showPlaceholder && toolItems.Count == 0) AddSpacerItem (); break; } } if (pos != -1 && pos < toolItems.Count) ((ActionToolItem)toolItems[pos]).Select (); else if (toolItems.Count > 0) ((ActionToolItem)toolItems[toolItems.Count-1]).Select (); }