public void toggleFilter(NSMenuItem sender) { string name = sender.title().description(); int i = name.IndexOf(' '); name = name.Substring(i + 1); m_filter[name] = !m_filter[name]; DoRebuildItems(); }
public bool validateMenuItem(NSMenuItem item) { Selector sel = item.action(); if (sel.Name == "openSelection:") { NSRange range = m_output.Value.selectedRange(); return range.length > 0; } else if (sel.Name == "dirHandler:") { NSWindow window = DoGetDirEditor(); if (window != null) return window.windowController().Call("validateUserInterfaceItem:", item).To<bool>(); else return false; } else if (respondsToSelector(sel)) { return true; } else if (SuperCall(NSWindowController.Class, "respondsToSelector:", new Selector("validateMenuItem:")).To<bool>()) { return SuperCall(NSWindowController.Class, "validateMenuItem:", item).To<bool>(); } return false; }