A cycle selection widget with left/right arrows to scroll through options.
Requires activation (A) to enter manipulation mode.
_properties: Dict[str, Dict[str, Any]] = {**UIElement._properties, 'options': {'name': 'options', 'key': 'options', 'type': List[str], 'editable': True, 'description': 'List of selectable strings.'}, 'selected_index': {'name': 'selected index', 'key': 'selected_index', 'type': int, 'editable': True, 'description': 'Currently selected index.'}, 'font_size': {'name': 'font size', 'key': 'font_size', 'type': int, 'editable': True, 'description': 'Text size.'}}
def __init__(self: Any, x: int, y: int, width: int, height: int, options: List[str], font_size: int = 20, font_name: Optional[str] = None, pivot: Tuple[float, float] = (0, 0), theme: Optional[ThemeType] = None, element_id: Optional[str] = None) -> None
def can_focus(self: Any) -> bool
def on_activate(self: Any) -> None
def on_directional_input(self: Any, direction: str) -> bool
def _get_init_args(self: Any) -> Dict[str, Any]
def _create_arrow_surfaces(self: Any) -> None
def font(self: Any) -> pygame.font.Font
def next_option(self: Any) -> None
def previous_option(self: Any) -> None
def set_selected_index(self: Any, index: int) -> None
def set_on_selection_changed(self: Any, callback: Callable[[int, str], None]) -> None
def update(self: Any, dt: float, inputState: InputState) -> None
def render(self: Any, renderer: Renderer) -> None
def _render_select_content(self: Any, renderer: Renderer, actual_x: int, actual_y: int, theme: Any) -> None
def _draw_fallback_arrows(self: Any, renderer: Renderer, actual_x: int, actual_y: int, arrow_color: Any) -> None
A toggle switch with animated sliding thumb.
_properties: Dict[str, Dict[str, Any]] = {**UIElement._properties, 'checked': {'name': 'checked', 'key': 'checked', 'type': bool, 'editable': True, 'description': 'Switch state (ON/OFF).'}}
def __init__(self: Any, x: int, y: int, width: int = 60, height: int = 30, checked: bool = False, pivot: Tuple[float, float] = (0, 0), theme: Optional[ThemeType] = None, element_id: Optional[str] = None) -> None
def can_focus(self: Any) -> bool
def on_activate(self: Any) -> None
def set_value(self: Any, value: bool) -> None
def on_directional_input(self: Any, direction: str) -> bool
def _get_init_args(self: Any) -> Dict[str, Any]
def toggle(self: Any) -> None
def set_checked(self: Any, checked: bool) -> None
def set_on_toggle(self: Any, callback: Callable[[bool], None]) -> None
def update(self: Any, dt: float, inputState: InputState) -> None
def _get_colors(self: Any) -> Tuple[Tuple[int, int, int], Tuple[int, int, int]]
def render(self: Any, renderer: Renderer) -> None
A horizontal or vertical slider with draggable thumb.
Requires activation (A) to enter manipulation mode.
_properties: Dict[str, Dict[str, Any]] = {**UIElement._properties, 'min_val': {'name': 'min value', 'key': 'min_val', 'type': float, 'editable': True, 'description': 'Minimum value.'}, 'max_val': {'name': 'max value', 'key': 'max_val', 'type': float, 'editable': True, 'description': 'Maximum value.'}, 'value': {'name': 'value', 'key': 'value', 'type': float, 'editable': True, 'description': 'Current value.'}, 'orientation': {'name': 'orientation', 'key': 'orientation', 'type': str, 'editable': True, 'description': '"horizontal" or "vertical".', 'options': ['horizontal', 'vertical']}, 'render_text': {'name': 'render text', 'key': 'render_text', 'type': bool, 'editable': True, 'description': 'Render value as text.'}}
def __init__(self: Any, x: int | float, y: int | float, width: int, height: int, min_val: float = 0, max_val: float = 100, value: float = 50, orientation: Literal['horizontal', 'vertical'] = 'horizontal', pivot: Tuple[float, float] = (0, 0), theme: Optional[ThemeType] = None, element_id: Optional[str] = None) -> None
def can_focus(self: Any) -> bool
def on_activate(self: Any) -> None
def on_directional_input(self: Any, direction: str) -> bool
def _get_init_args(self: Any) -> Dict[str, Any]
def set_on_value_changed(self: Any, callback: Callable[[float], None]) -> None
def set_theme(self: Any, theme_type: ThemeType) -> None
def _get_colors(self: Any) -> 'UITheme'
def set_value(self: Any, value: float) -> None
def update(self: Any, dt: float, inputState: InputState) -> None
def render(self: Any, renderer: Renderer) -> None
Dropdown selection widget. When expanded, its height changes to include the
expanded options area. Supports an optional label, search functionality,
and scrollable options. Handles parent scrolling and auto-arrangement correctly.
_properties: Dict[str, Dict[str, Any]] = {**UIElement._properties, 'options': {'name': 'options', 'key': 'options', 'type': List[str], 'editable': True, 'description': 'Selectable options.'}, 'selected_index': {'name': 'selected index', 'key': 'selected_index', 'type': int, 'editable': True, 'description': 'Currently selected option index.'}, 'expanded': {'name': 'expanded', 'key': 'expanded', 'type': bool, 'editable': False, 'description': 'Whether the dropdown is expanded.'}, 'searchable': {'name': 'searchable', 'key': 'searchable', 'type': bool, 'editable': True, 'description': 'Show search box when expanded.'}, 'max_visible_options': {'name': 'max visible options', 'key': 'max_visible_options', 'type': int, 'editable': True, 'description': 'Maximum options shown before scrolling.'}}
def __init__(self: Any, x: int, y: int, width: int, height: int, options: Optional[List[str]] = None, font_size: int = 20, font_name: Optional[str] = None, pivot: Tuple[float, float] = (0, 0), theme: Optional[ThemeType] = None, max_visible_options: int = 10, element_id: Optional[str] = None, searchable: bool = False, label: Optional[str] = None, label_size: Optional[int] = None, label_position: Literal['left', 'top'] = 'left') -> None
def can_focus(self: Any) -> bool
def on_activate(self: Any) -> None
def on_directional_input(self: Any, direction: str) -> bool
def _ensure_highlight_visible(self: Any, pos: int) -> None
def _get_init_args(self: Any) -> Dict[str, Any]
def set_on_expanded(self: Any, callback: Callable[[bool], None]) -> None
def _trigger_expanded_callback(self: Any, expanded: bool) -> None
def _update_layout(self: Any) -> None
def _get_expanded_height(self: Any) -> int
def _update_expanded_height(self: Any) -> None
def _notify_parent_rearrange(self: Any) -> None
def get_selected(self: Any) -> Tuple[int, str]
def _create_search_box(self: Any) -> None
def _on_search_text_changed(self: Any, text: str) -> None
def _update_filtered_options(self: Any) -> None
def font(self: Any) -> pygame.font.Font
def set_options(self: Any, options: List[str], selected_index: int = 0) -> None
def set_theme(self: Any, theme_type: ThemeType) -> None
def _get_colors(self: Any) -> Any
def _get_visible_options(self: Any) -> List[int]
def _find_auto_arrange_parent(self: Any) -> Optional[UIElement]
def on_scroll(self: Any, event: pygame.event.Event) -> None
def _get_button_screen_rect(self: Any) -> pygame.Rect
def _get_expanded_screen_rect(self: Any) -> pygame.Rect
def _get_scrollbar_track_rect(self: Any, btn_rect: pygame.Rect) -> pygame.Rect
def _get_scrollbar_thumb_rect(self: Any, btn_rect: pygame.Rect) -> pygame.Rect
def update(self: Any, dt: float, inputState: InputState) -> None
def render(self: Any, renderer: Renderer) -> None
def _draw_arrow_polygon(self: Any, renderer: Any, points: Any, color: Any) -> None
def _render_expanded_options(self: Any, renderer: OpenGLRenderer, theme: Any) -> None
def add_option(self: Any, option: str) -> None
def remove_option(self: Any, option: str) -> None
def set_selected_index(self: Any, index: int) -> None
def set_on_selection_changed(self: Any, callback: Callable[[int, str], None]) -> None
A numeric spinner with optional label. Supports min/max, step, and value change callbacks.
Requires activation (A) to enter manipulation mode.
_properties: Dict[str, Dict[str, Any]] = {**UIElement._properties, 'value': {'name': 'value', 'key': 'value', 'type': int, 'editable': True, 'description': 'Current numeric value.'}, 'min_value': {'name': 'min value', 'key': 'min_value', 'type': int, 'editable': True, 'description': 'Minimum allowed value.'}, 'max_value': {'name': 'max value', 'key': 'max_value', 'type': int, 'editable': True, 'description': 'Maximum allowed value.'}, 'step': {'name': 'step', 'key': 'step', 'type': int, 'editable': True, 'description': 'Increment/decrement step.'}, 'min_length': {'name': 'min length', 'key': 'min_length', 'type': int, 'editable': True, 'description': 'Minimum number of digits (zero padding).'}}
def __init__(self: Any, x: int, y: int, width: int, height: int, min_value: int, max_value: int, value: int, min_length: int = 1, max_length: int = 10, step: int = 1, label: Optional[str] = None, label_size: Optional[int] = None, label_position: Literal['left', 'top'] = 'left', pivot: Tuple[float, float] = (0, 0), theme: Optional[ThemeType] = None, element_id: Optional[str] = None) -> None
def can_focus(self: Any) -> bool
def on_activate(self: Any) -> None
def on_directional_input(self: Any, direction: str) -> bool
def _get_init_args(self: Any) -> Dict[str, Any]
def value(self: Any) -> int
def value(self: Any, new_value: int) -> None
def get_value(self: Any) -> int
def set_on_value_changed(self: Any, callback: Callable[[int], None]) -> None
def increment(self: Any, multiplier: float = 1.0) -> None
def decrement(self: Any, multiplier: float = 1.0) -> None
def _calculate_rects(self: Any) -> Any
def update(self: Any, dt: float, inputState: InputState) -> None
def _get_multiplier(self: Any, inputState: InputState) -> float
def render(self: Any, renderer: Renderer) -> None
def _format_value(self: Any) -> str
A clickable checkbox with optional label.
_properties: Dict[str, Dict[str, Any]] = {**UIElement._properties, 'checked': {'name': 'checked', 'key': 'checked', 'type': bool, 'editable': True, 'description': 'Checkbox state.'}, 'label': {'name': 'label', 'key': 'label', 'type': str, 'editable': True, 'description': 'Text displayed next to checkbox.'}, 'label_position': {'name': 'label position', 'key': 'label_position', 'type': str, 'editable': True, 'description': '"left" or "right".', 'options': ['left', 'right']}}
def __init__(self: Any, x: int, y: int, width: int, height: int, checked: bool, label: Optional[str] = None, label_position: str = 'right', pivot: Tuple[float, float] = (0, 0), theme: Optional[ThemeType] = None, element_id: Optional[str] = None) -> None
def can_focus(self: Any) -> bool
def on_activate(self: Any) -> None
def on_directional_input(self: Any, direction: str) -> bool
def _get_init_args(self: Any) -> Dict[str, Any]
def set_on_toggle(self: Any, callback: Callable[[bool], None]) -> None
def get_state(self: Any) -> bool
def value(self: Any) -> bool
def _get_colors(self: Any) -> Tuple[Tuple[int, int, int], Tuple[int, int, int], Tuple[int, int, int], Tuple[int, int, int]]
def toggle(self: Any) -> None
def update(self: Any, dt: float, inputState: InputState) -> None
def render(self: Any, renderer: Renderer) -> None