Manages navigation logic for menu systems
The MenuNavigator handles all navigation-related functionality including:
- Menu item selection and movement
- Wrapping navigation behavior
- Enabled item filtering
- Navigation state validation
Constructors
new(total_items : Int32 = 0)
SourceInstance methods
allow_empty_selection=(allow_empty_selection : Bool)
Sourcecreate_snapshot
Creates a snapshot of current navigation state
Sourcecurrent_index=(current_index : Int32)
Sourceenabled_item_count
Gets count of enabled items
Sourceget_enabled_indices
Gets list of enabled item indices
Sourceget_navigation_stats
Gets navigation statistics for debugging
Sourceget_previous_index
Gets the previously selected index
Sourceget_selected_index
Gets the currently selected index
Sourcehas_enabled_items?
Checks if any items are enabled
Sourcehas_valid_selection?
Checks if current selection is valid
Sourceitem_enabled?(index : Int32) : Bool
Checks if an item is enabled
Sourcenavigate_next
Navigates to the next item
Sourcenavigate_previous
Navigates to the previous item
Sourcenavigate_to(index : Int32) : Bool
Navigates to a specific index
Sourcenavigate_to_first
Navigates to the first enabled item
Sourcenavigate_to_last
Navigates to the last enabled item
Sourceon_invalid_navigation=(on_invalid_navigation : Proc(Nil) | Nil)
Sourceon_selection_changed
Callbacks for navigation events
Sourceon_selection_changed=(on_selection_changed : Proc(Int32, Int32, Nil) | Nil)
Callbacks for navigation events
Sourceon_wrap_around=(on_wrap_around : Proc(Int32, Nil) | Nil)
Sourceprevious_index=(previous_index : Int32)
Sourcerestore_from_snapshot(snapshot : Hash(String, Int32 | Bool | Array(Bool)))
Restores navigation state from snapshot
Sourceset_enabled_items(enabled : Array(Bool))
Sets which items are enabled for navigation
Sourceset_item_enabled(index : Int32, enabled : Bool)
Sets enabled state for a specific item
Sourceset_total_items(count : Int32)
Sets the total number of menu items
Sourceskip_disabled_items=(skip_disabled_items : Bool)
Sourcetotal_items=(total_items : Int32)
Sourcevalidate_configuration
Validates navigation configuration
Sourcewrap_navigation=(wrap_navigation : Bool)
Source