Repository navigation
OptionButton
Home | API by Category | Complete API Index | API Status
| Field | Value |
|---|---|
| Full name | Electron2D.OptionButton |
| Namespace | Electron2D |
| Kind | class |
| Category | API Rendering |
Displays one selected item and opens an owned themed dropdown menu.
public class Electron2D.OptionButtonThe internal popup owns item records and borrows icons/shortcuts. IDs are independent of indices; metadata uses exact generic types and remains runtime-only. Programmatic selection emits no ItemSelected. An active embedded or native desktop host is required for dropdown presentation. Transparent native menus require the compatibility renderer; an opaque borrowed popup also executes with the GPU backend. Mutations follow scene ownership.
Inherits: Button
| Member | Kind | Summary |
|---|---|---|
public OptionButton() |
constructor | Creates an empty toggle button with leading alignment, press-edge activation and an internal menu. |
public OptionButton(System.String text) |
constructor | Creates an empty choice button with initial source text. |
public event System.Action<System.Int32> ItemFocused |
event | Occurs after keyboard/controller navigation focuses a menu item, carrying its first matching ID index. |
public event System.Action<System.Int32> ItemSelected |
event | Occurs after a user activation commits the selected index and caption. |
public System.Void AddIconItem(Electron2D.Texture icon, System.String label, System.Int32 id = -1) |
method | Adds a radio item with a borrowed icon. |
public System.Void AddItem(System.String label, System.Int32 id = -1) |
method | Adds a radio item, selecting it if it is the first selectable record. |
public System.Void AddSeparator(System.String text = "") |
method | Adds a nonselectable separator with an optional source title. |
public System.Void Clear() |
method | Clears item records, selection and caption without ItemSelected. |
protected override System.Func<Electron2D.Node> CreateSceneInstanceFactory() |
method | |
protected override System.Void Dispose(System.Boolean disposing) |
method | |
public Electron2D.NodeAutoTranslateMode GetItemAutoTranslateMode(System.Int32 index) |
method | Gets an item's AutoTranslateMode value. |
public System.Int32 GetItemID(System.Int32 index) |
method | Gets an item's ID value. |
public Electron2D.Texture GetItemIcon(System.Int32 index) |
method | Gets an item's Icon value. |
public System.Int32 GetItemIndex(System.Int32 id) |
method | Gets the first record index with an exact ID. |
public T GetItemMetadata<T>(System.Int32 index) |
method | Gets runtime metadata with its exact generic type. |
public System.String GetItemText(System.Int32 index) |
method | Gets an item's Text value. |
public System.String GetItemTooltip(System.Int32 index) |
method | Gets an item's Tooltip value. |
public Electron2D.PopupMenu GetPopup() |
method | Gets the stable borrowed internal popup. Its lifetime remains owned by this button. |
protected override System.Collections.Generic.IEnumerable<Electron2D.PropertyDescriptor> GetPropertyDescriptors() |
method | |
public System.Int32 GetSelectableItem(System.Boolean fromLast = false) |
method | Finds the first or last enabled nonseparator record. |
public System.Int32 GetSelectedID() |
method | Gets the current signed ID, or -1 without selection. |
public T GetSelectedMetadata<T>() |
method | Gets selected exact generic metadata. |
public System.Boolean HasSelectableItems() |
method | Reports whether any record is enabled and not a separator. |
public System.Boolean IsItemDisabled(System.Int32 index) |
method | Reports an item's Disabled flag. |
public System.Boolean IsItemSeparator(System.Int32 index) |
method | Reports an item's Separator flag. |
protected override Electron2D.Vector2 OnGetMinimumSize() |
method | |
protected override System.Void OnNotification(System.Int32 what) |
method | |
protected override System.Void OnPressed() |
method | |
protected override System.Void OnShortcutInput(Electron2D.InputEvent inputEvent) |
method | |
public System.Void RemoveItem(System.Int32 index) |
method | Removes one record, retaining selection by identity or clearing a removed selection. |
public System.Void Select(System.Int32 index) |
method | Selects an existing record or clears selection, without ItemSelected. |
public System.Void SetDisableShortcuts(System.Boolean disabled) |
method | Disables this button's shortcut input stage, including popup item shortcuts. |
public System.Void SetItemAutoTranslateMode(System.Int32 index, Electron2D.NodeAutoTranslateMode value) |
method | Sets an item's AutoTranslateMode value and refreshes a selected caption/icon when applicable. |
public System.Void SetItemDisabled(System.Int32 index, System.Boolean disabled) |
method | Changes an enabled/disabled flag without changing programmatic selection. |
public System.Void SetItemID(System.Int32 index, System.Int32 value) |
method | Sets an item's ID value and refreshes a selected caption/icon when applicable. |
public System.Void SetItemIcon(System.Int32 index, Electron2D.Texture value) |
method | Sets an item's Icon value and refreshes a selected caption/icon when applicable. |
public System.Void SetItemMetadata<T>(System.Int32 index, T value) |
method | Sets exact generic runtime metadata. |
public System.Void SetItemText(System.Int32 index, System.String value) |
method | Sets an item's Text value and refreshes a selected caption/icon when applicable. |
public System.Void SetItemTooltip(System.Int32 index, System.String value) |
method | Sets an item's Tooltip value and refreshes a selected caption/icon when applicable. |
public System.Void ShowPopup() |
method | Opens the owned menu beneath the button; keyboard/programmatic opening focuses selection or the first selectable item. |
public System.Boolean AllowReselect { get; set; } |
property | Gets or sets whether activating the current item reports selection again. |
public System.Boolean FitToLongestItem { get; set; } |
property | Gets or sets whether the longest item and popup width contribute to the button minimum. |
public System.Int32 ItemCount { get; set; } |
property | Gets or sets the item count, retaining records and selected identity. |
public System.Boolean SearchBarEnabled { get; set; } |
property | Gets or sets the owned menu's SearchBarEnabled policy. |
public System.Boolean SearchBarFuzzySearchEnabled { get; set; } |
property | Gets or sets the owned menu's SearchBarFuzzySearchEnabled policy. |
public System.Int32 SearchBarFuzzySearchMaxMisses { get; set; } |
property | Gets or sets the owned menu's SearchBarFuzzySearchMaxMisses policy. |
public System.Int32 SearchBarMinItemCount { get; set; } |
property | Gets or sets the owned menu's SearchBarMinItemCount policy. |
public System.Int32 Selected { get; set; } |
property | Gets or sets the selected index without a user-selection event; an initial out-of-range assignment queues. |
Kind: constructor
public OptionButton()Creates an empty toggle button with leading alignment, press-edge activation and an internal menu.
Kind: constructor
public OptionButton(System.String text)Creates an empty choice button with initial source text.
-
text: Nonnull text; later selection owns the caption.
Kind: event
public event System.Action<System.Int32> ItemFocusedOccurs after keyboard/controller navigation focuses a menu item, carrying its first matching ID index.
Kind: event
public event System.Action<System.Int32> ItemSelectedOccurs after a user activation commits the selected index and caption.
Kind: method
public System.Void AddIconItem(Electron2D.Texture icon, System.String label, System.Int32 id = -1)Adds a radio item with a borrowed icon.
-
icon: A live borrowed icon or null. -
label: Nonnull source title. -
id: Signed ID or -1 for automatic.
Kind: method
public System.Void AddItem(System.String label, System.Int32 id = -1)Adds a radio item, selecting it if it is the first selectable record.
-
label: Nonnull source title. -
id: Signed ID; -1 derives from the new index.
Kind: method
public System.Void AddSeparator(System.String text = "")Adds a nonselectable separator with an optional source title.
-
text: Nonnull source title.
Kind: method
public System.Void Clear()Clears item records, selection and caption without ItemSelected.
Kind: method
protected override System.Func<Electron2D.Node> CreateSceneInstanceFactory()Kind: method
protected override System.Void Dispose(System.Boolean disposing)Kind: method
public Electron2D.NodeAutoTranslateMode GetItemAutoTranslateMode(System.Int32 index)Gets an item's AutoTranslateMode value.
The stored value; resources remain borrowed.
-
index: A nonnegative index.
Kind: method
public System.Int32 GetItemID(System.Int32 index)Gets an item's ID value.
The stored value; resources remain borrowed.
-
index: A nonnegative index; -1 returns -1.
Kind: method
public Electron2D.Texture GetItemIcon(System.Int32 index)Gets an item's Icon value.
The stored value; resources remain borrowed.
-
index: A nonnegative index.
Kind: method
public System.Int32 GetItemIndex(System.Int32 id)Gets the first record index with an exact ID.
The first index or -1.
-
id: The signed ID.
Kind: method
public T GetItemMetadata<T>(System.Int32 index)Gets runtime metadata with its exact generic type.
The borrowed value.
-
index: A nonnegative index.
Kind: method
public System.String GetItemText(System.Int32 index)Gets an item's Text value.
The stored value; resources remain borrowed.
-
index: A nonnegative index.
Kind: method
public System.String GetItemTooltip(System.Int32 index)Gets an item's Tooltip value.
The stored value; resources remain borrowed.
-
index: A nonnegative index.
Kind: method
public Electron2D.PopupMenu GetPopup()Gets the stable borrowed internal popup. Its lifetime remains owned by this button.
The owned menu.
Kind: method
protected override System.Collections.Generic.IEnumerable<Electron2D.PropertyDescriptor> GetPropertyDescriptors()Kind: method
public System.Int32 GetSelectableItem(System.Boolean fromLast = false)Finds the first or last enabled nonseparator record.
The index or -1.
-
fromLast: Searches backward when true.
Kind: method
public System.Int32 GetSelectedID()Gets the current signed ID, or -1 without selection.
The selected ID.
Kind: method
public T GetSelectedMetadata<T>()Gets selected exact generic metadata.
The borrowed value.
-
T:System.Collections.Generic.KeyNotFoundException: Selection or matching metadata is absent.
Kind: method
public System.Boolean HasSelectableItems()Reports whether any record is enabled and not a separator.
True when user selection is possible.
Kind: method
public System.Boolean IsItemDisabled(System.Int32 index)Reports an item's Disabled flag.
The stored flag.
-
index: A nonnegative index.
Kind: method
public System.Boolean IsItemSeparator(System.Int32 index)Reports an item's Separator flag.
The stored flag.
-
index: A nonnegative index.
Kind: method
protected override Electron2D.Vector2 OnGetMinimumSize()Kind: method
protected override System.Void OnNotification(System.Int32 what)Kind: method
protected override System.Void OnPressed()Kind: method
protected override System.Void OnShortcutInput(Electron2D.InputEvent inputEvent)Kind: method
public System.Void RemoveItem(System.Int32 index)Removes one record, retaining selection by identity or clearing a removed selection.
-
index: A nonnegative index.
Kind: method
public System.Void Select(System.Int32 index)Selects an existing record or clears selection, without ItemSelected.
-
index: A nonnegative existing index or -1.
Kind: method
public System.Void SetDisableShortcuts(System.Boolean disabled)Disables this button's shortcut input stage, including popup item shortcuts.
-
disabled: Whether shortcut handling is disabled.
Kind: method
public System.Void SetItemAutoTranslateMode(System.Int32 index, Electron2D.NodeAutoTranslateMode value)Sets an item's AutoTranslateMode value and refreshes a selected caption/icon when applicable.
-
index: An index, optionally counted from the end. -
value: The new typed value.
Kind: method
public System.Void SetItemDisabled(System.Int32 index, System.Boolean disabled)Changes an enabled/disabled flag without changing programmatic selection.
-
index: An index, optionally negative. -
disabled: The flag.
Kind: method
public System.Void SetItemID(System.Int32 index, System.Int32 value)Sets an item's ID value and refreshes a selected caption/icon when applicable.
-
index: An index, optionally counted from the end. -
value: The new typed value.
Kind: method
public System.Void SetItemIcon(System.Int32 index, Electron2D.Texture value)Sets an item's Icon value and refreshes a selected caption/icon when applicable.
-
index: An index, optionally counted from the end. -
value: The new typed value.
Kind: method
public System.Void SetItemMetadata<T>(System.Int32 index, T value)Sets exact generic runtime metadata.
-
index: An index, optionally counted from the end. -
value: The borrowed value, including typed null.
Kind: method
public System.Void SetItemText(System.Int32 index, System.String value)Sets an item's Text value and refreshes a selected caption/icon when applicable.
-
index: An index, optionally counted from the end. -
value: The new typed value.
Kind: method
public System.Void SetItemTooltip(System.Int32 index, System.String value)Sets an item's Tooltip value and refreshes a selected caption/icon when applicable.
-
index: An index, optionally counted from the end. -
value: The new typed value.
Kind: method
public System.Void ShowPopup()Opens the owned menu beneath the button; keyboard/programmatic opening focuses selection or the first selectable item.
Detached buttons return without opening. Attached presentation uses its containing viewport and native or embedded host.
Kind: property
public System.Boolean AllowReselect { get; set; }Gets or sets whether activating the current item reports selection again.
False initially.
Kind: property
public System.Boolean FitToLongestItem { get; set; }Gets or sets whether the longest item and popup width contribute to the button minimum.
True initially.
Kind: property
public System.Int32 ItemCount { get; set; }Gets or sets the item count, retaining records and selected identity.
Zero through 65536; new slots use radio decoration and automatic IDs.
Kind: property
public System.Boolean SearchBarEnabled { get; set; }Gets or sets the owned menu's SearchBarEnabled policy.
Uses the PopupMenu default and validation.
Kind: property
public System.Boolean SearchBarFuzzySearchEnabled { get; set; }Gets or sets the owned menu's SearchBarFuzzySearchEnabled policy.
Uses the PopupMenu default and validation.
Kind: property
public System.Int32 SearchBarFuzzySearchMaxMisses { get; set; }Gets or sets the owned menu's SearchBarFuzzySearchMaxMisses policy.
Uses the PopupMenu default and validation.
Kind: property
public System.Int32 SearchBarMinItemCount { get; set; }Gets or sets the owned menu's SearchBarMinItemCount policy.
Uses the PopupMenu default and validation.
Kind: property
public System.Int32 Selected { get; set; }Gets or sets the selected index without a user-selection event; an initial out-of-range assignment queues.
-1 initially. Existing disabled/separator records may be selected programmatically.