public override void Load(string url, Dictionary <string, object> globals) { // Get the list of options to show: List = Get <OptionList>("options", globals); // Build now: StringBuilder builder = new System.Text.StringBuilder(); BuildOptions(builder); // Get the HTML: string html = builder.ToString(); // Write it out into the template: SetHtml(html); if (element == null) { return; } // Position the root element: int x = GetInteger("x", globals, -1); int y = GetInteger("y", globals, -1); if (x != -1 || y != -1) { element.style.left = x + "fpx"; element.style.top = y + "fpx"; } }
/// <summary>Resolves an option from a context menu widget's document.</summary> public static Option ResolveOption(int index, Widgets.Widget widget) { // These widgets are always 'ContextMenuWidget' objects. // They also only ever display one list - submenus are separate widgets. OptionList list = (widget as ContextMenuWidget).List; if (list == null) { return(null); } // Awesome - we can now get the actual option instance: return(list[index]); }