public object SaveStatus() { ArrayList status = new ArrayList(); for (int n = 0; n < menuItems.Count; n++) { ActionMenuItem item = (ActionMenuItem)menuItems [n]; if (item.IsSubmenuVisible) { status.Add(n); OpenSubmenu.SaveStatus(status); break; } } return(status); }
public void RestoreStatus(object data) { ArrayList status = (ArrayList)data; if (status.Count == 0) { return; } int pos = (int)status [0]; if (pos >= menuItems.Count) { return; } ActionMenuItem item = (ActionMenuItem)menuItems [pos]; if (status.Count == 1) { // The last position in the status is the selected item item.Select(); if (item.Node.Action != null && item.Node.Action.Name.Length == 0) { // Then only case when there can have an action when an empty name // is when the user clicked on the "add action" link. In this case, // start editing the item again item.EditingDone += OnEditingDone; item.StartEditing(); } } else { item.ShowSubmenu(); if (OpenSubmenu != null) { OpenSubmenu.RestoreStatus(status, 1); } } }
public void Unselect() { // Unselects any selected item and hides any open submenu menu Widget wrapper = Widget.Lookup(this); if (OpenSubmenu != null) { OpenSubmenu.ResetSelection(); } IDesignArea area = wrapper.GetDesignArea(); if (area != null) { foreach (Gtk.Widget w in Children) { CustomMenuBarItem it = w as CustomMenuBarItem; if (it != null) { area.ResetSelection(it.ActionMenuItem); } } } OpenSubmenu = null; }