static public DMElementInfo CreateSubmenu(string inLabel, DMInfo inSubmenu, DMPredicate inPredicate = null, int inIndent = 0) { return(new DMElementInfo() { Type = DMElementType.Submenu, Label = inLabel, Submenu = new DMSubmenuInfo() { Submenu = inSubmenu }, Indent = inIndent, Predicate = inPredicate }); }
static public DMElementInfo CreateToggle(string inLabel, DMPredicate inGetter, DMToggleCallback inSetter, DMPredicate inPredicate = null, int inIndent = 0) { return(new DMElementInfo() { Type = DMElementType.Toggle, Label = inLabel, Toggle = new DMToggleInfo() { Getter = inGetter, Setter = inSetter }, Predicate = inPredicate }); }
/// <summary> /// Returns if the given predicate passes, or is null. /// </summary> static public bool EvaluateOptionalPredicate(DMPredicate inPredicate) { return(inPredicate == null || inPredicate()); }
/// <summary> /// Adds a submenu element to the menu. /// </summary> public DMInfo AddSubmenu(string inLabel, DMInfo inSubmenu, DMPredicate inPredicate = null, int inIndent = 0) { Elements.PushBack(DMElementInfo.CreateSubmenu(inLabel, inSubmenu, inPredicate)); return(this); }
/// <summary> /// Adds a submenu element to the menu. /// </summary> public DMInfo AddSubmenu(DMInfo inSubmenu, DMPredicate inPredicate = null, int inIndent = 0) { Elements.PushBack(DMElementInfo.CreateSubmenu(inSubmenu.Header.Label + " >", inSubmenu, inPredicate)); return(this); }
/// <summary> /// Adds a toggle element to the menu. /// </summary> public DMInfo AddToggle(string inLabel, DMPredicate inGetter, DMToggleCallback inSetter, DMPredicate inPredicate = null, int inIndent = 0) { Elements.PushBack(DMElementInfo.CreateToggle(inLabel, inGetter, inSetter, inPredicate, inIndent)); return(this); }
/// <summary> /// Adds a button element to the menu. /// </summary> public DMInfo AddButton(string inLabel, DMBUttonCallback inCallback, DMPredicate inPredicate = null, int inIndent = 0) { Elements.PushBack(DMElementInfo.CreateButton(inLabel, inCallback, inPredicate, inIndent)); return(this); }
static public DMElementInfo CreateButton(string inLabel, DMBUttonCallback inCallback, DMPredicate inPredicate = null, int inIndent = 0) { return(new DMElementInfo() { Type = DMElementType.Button, Label = inLabel, Button = new DMButtonInfo() { Callback = inCallback, }, Indent = inIndent, Predicate = inPredicate }); }