Internal layout data for a child UI element under auto-arrange.
_OriginalPos: Union[Tuple[int, int], Tuple[float, float]] = None
_CurrentPos: Union[Tuple[int, int], Tuple[float, float]] = None
_OriginalSize: Union[Tuple[int, int], Tuple[float, float]] = None
_CurrentSize: Union[Tuple[int, int], Tuple[float, float]] = None
def CurrentPos(self: Any) -> pygame.Vector2
def CurrentSize(self: Any) -> pygame.Vector2
def get_below_elements(self: Any, children: List[UIElement]) -> List[UIElement]
A container frame that can have an optional draggable header with title and icon.
Supports automatic vertical arrangement of children when their sizes change.
_properties: Any = {**UIElement._properties, 'header_enabled': {'name': 'header enabled', 'key': 'header_enabled', 'type': bool, 'editable': True, 'description': 'Show header bar with title/icon'}, 'header_title': {'name': 'header title', 'key': 'header_title', 'type': str, 'editable': True, 'description': 'Text displayed in header'}, 'header_height': {'name': 'header height', 'key': 'header_height', 'type': int, 'editable': True, 'description': 'Height of header bar in pixels'}, 'draggable': {'name': 'draggable', 'key': 'draggable', 'type': bool, 'editable': True, 'description': 'Allow frame to be dragged by its header'}, 'padding': {'name': 'padding', 'key': 'padding', 'type': int, 'editable': True, 'description': 'Padding inside frame'}, 'background_color': {'name': 'background color', 'key': 'background_color', 'type': tuple, 'editable': True, 'description': 'RGB background color (None = transparent)'}, 'border_color': {'name': 'border color', 'key': 'border_color', 'type': tuple, 'editable': True, 'description': 'RGB border color (None = no border)'}, 'corner_radius': {'name': 'corner radius', 'key': 'corner_radius', 'type': (int, tuple), 'editable': True, 'description': 'Radius for rounded corners'}, 'auto_arrange_y': {'name': 'auto arrange y', 'key': 'auto_arrange_y', 'type': bool, 'editable': True, 'description': 'Automatically reposition child elements vertically when their heights change'}, 'arrange_spacing': {'name': 'arrange spacing', 'key': 'arrange_spacing', 'type': int, 'editable': True, 'description': 'Spacing between arranged children (pixels)'}, 'arrange_align': {'name': 'arrange align', 'key': 'arrange_align', 'type': str, 'editable': True, 'description': 'Alignment for arranged children: left, center, right'}}
category: str = 'container'
def __init__(self: Any, x: int, y: int, width: int, height: int, pivot: Tuple[float, float] = (0, 0), theme: Optional[ThemeType] = None, element_id: Optional[str] = None, header_enabled: bool = False, header_title: str = '', header_icon: Optional[Union[str, pygame.Surface]] = None, header_height: int = 30, draggable: bool = False, **kwargs: dict) -> None
def header_font(self: Any) -> Optional[pygame.font.Font]
def _get_init_args(self: Any) -> Dict[str, Any]
def usable_space(self: Any) -> Tuple[int, int]
def get_header_rect(self: Any) -> pygame.Rect
def set_background_color(self: Any, color: Optional[Tuple[int, int, int]]) -> None
def set_border_color(self: Any, color: Optional[Tuple[int, int, int]]) -> None
def set_border(self: Any, color: Optional[Tuple[int, int, int]], width: int = 1) -> None
def set_padding(self: Any, padding: int) -> None
def set_corner_radius(self: Any, radius: Union[int, Tuple[int, int, int, int]]) -> None
def get_content_rect(self: Any) -> Tuple[int, int, int, int]
def add_child(self: Any, child: UIElement) -> None
def remove_child(self: Any, child: UIElement) -> None
def clear_children(self: Any) -> None
def update_theme(self: Any, theme_type: ThemeType) -> None
def update(self: Any, dt: float, input_state: InputState) -> None
def _rearrange_children_if_needed(self: Any) -> None
def get_arranged_position(self: Any, child: UIElement) -> Union[Tuple[int, int], Tuple[float, float]]
def _arrange_children(self: Any) -> int | float
def render(self: Any, renderer: OpenGLRenderer) -> None
No documentation
_properties: Any = {**UiFrame._properties, 'content_width': {'name': 'content width', 'key': 'content_width', 'type': int, 'editable': True, 'description': 'Total width of scrollable content'}, 'content_height': {'name': 'content height', 'key': 'content_height', 'type': int, 'editable': True, 'description': 'Total height of scrollable content'}, 'scroll_x': {'name': 'scroll x', 'key': 'scroll_x', 'type': int, 'editable': False, 'description': 'Horizontal scroll offset'}, 'scroll_y': {'name': 'scroll y', 'key': 'scroll_y', 'type': int, 'editable': False, 'description': 'Vertical scroll offset'}, 'scrollbar_size': {'name': 'scrollbar size', 'key': 'scrollbar_size', 'type': int, 'editable': True, 'description': 'Width/height of scrollbars'}}
def __init__(self: Any, x: int, y: int, width: int, height: int, content_width: int, content_height: int, pivot: Tuple[float, float] = (0, 0), theme: Optional[ThemeType] = None, element_id: Optional[str] = None, header_enabled: bool = False, header_title: str = '', header_icon: Optional[Union[str, pygame.Surface]] = None, header_height: int = 30, draggable: bool = False, **kwargs: dict) -> None
def _get_init_args(self: Any) -> Dict[str, Any]
def scroll_by(self: Any, dx: float, dy: float) -> None
def set_scroll(self: Any, x: int, y: int) -> None
def clear_content(self: Any, reset_scroll: bool = True) -> None
def set_background_color(self: Any, color: Tuple[int, int, int]) -> None
def _arrange_children(self: Any) -> int | float
def update(self: Any, dt: float, input_state: InputState) -> None
def on_scroll(self: Any, event: pygame.event.Event) -> None
def render(self: Any, renderer: OpenGLRenderer) -> None
def _get_vertical_scrollbar_rect(self: Any, fx: int, fy: int) -> pygame.Rect
def _get_horizontal_scrollbar_rect(self: Any, fx: int, fy: int) -> pygame.Rect
def _draw_horizontal_scrollbar(self: Any, renderer: OpenGLRenderer, fx: int, fy: int, theme: Any) -> None
def _draw_vertical_scrollbar(self: Any, renderer: OpenGLRenderer, fx: int, fy: int, theme: Any) -> None
Tabbed container. Does not use auto_arrange_y because tabs are managed separately.
_properties: Any = {**UiFrame._properties, 'orientation': {'name': 'orientation', 'key': 'orientation', 'type': Literal, 'editable': True, 'description': 'Tab layout: horizontal, vertical1, vertical2', 'options': ['horizontal', 'vertical1', 'vertical2']}, 'tab_height': {'name': 'tab height', 'key': 'tab_height', 'type': int, 'editable': True, 'description': 'Height of each tab (vertical) or tab bar (horizontal)'}, 'tab_width': {'name': 'tab width', 'key': 'tab_width', 'type': int, 'editable': True, 'description': 'Width of each tab (horizontal) or tab bar (vertical)'}, 'current_tab': {'name': 'current tab', 'key': 'current_tab', 'type': int, 'editable': False, 'description': 'Index of active tab'}}
def __init__(self: Any, x: int, y: int, width: int, height: int, font_size: int = 20, font_name: Optional[str] = None, orientation: Literal['horizontal', 'vertical1', 'vertical2'] = 'horizontal', pivot: Tuple[float, float] = (0, 0), theme: Optional[ThemeType] = None, element_id: Optional[str] = None, **kwargs: dict) -> None
def _get_init_args(self: Any) -> Dict[str, Any]
def _calculate_tab_colors(self: Any) -> None
def font(self: Any) -> pygame.font.Font
def update_theme(self: Any, theme_type: ThemeType) -> None
def next_tab(self: Any) -> bool
def previous_tab(self: Any) -> bool
def add_tab(self: Any, tab_name: str, icon: Optional[Union[str, pygame.Surface]] = None) -> bool
def add_to_tab(self: Any, tab_name: str, ui_element: UIElement) -> bool
def switch_tab(self: Any, tab_index: int) -> bool
def get_tab_index(self: Any, tab_name: str) -> int
def remove_tab(self: Any, tab_name: str) -> bool
def _update_tab_scroll(self: Any) -> None
def _get_tab_width(self: Any) -> int
def _get_tab_height_for_name(self: Any, tab_name: str) -> int
def _get_tab_rect(self: Any, idx: int, fx: int, fy: int) -> pygame.Rect
def _draw_arrow(self: Any, renderer: OpenGLRenderer, x: int, y: int, direction: str, hover: bool) -> None
def update(self: Any, dt: float, input_state: InputState) -> None
def _get_visible_size(self: Any) -> int
def _get_tab_area_rect(self: Any, fx: int, fy: int) -> pygame.Rect
def render(self: Any, renderer: OpenGLRenderer) -> None
Page navigation container (does not use auto_arrange_y).
def __init__(self: Any, x: int, y: int, width: int, height: int, total_pages: int = 1, current_page: int = 1, max_visible_pages: int = 7, show_prev_next: bool = True, show_first_last: bool = True, button_style: Literal['numbers', 'dots', 'compact'] = 'numbers', pivot: Tuple[float, float] = (0, 0), theme: Optional[ThemeType] = None, element_id: Optional[str] = None) -> None
def _get_init_args(self: Any) -> Dict[str, Any]
def set_page(self: Any, page: int) -> None
def set_total_pages(self: Any, total_pages: int) -> None
def set_current_page(self: Any, page: int) -> None
def next_page(self: Any) -> None
def previous_page(self: Any) -> None
def first_page(self: Any) -> None
def last_page(self: Any) -> None
def set_on_page_change(self: Any, callback: Callable[[int, int], None]) -> None
def _trigger_page_change(self: Any, old_page: int) -> None
def _calculate_visible_pages(self: Any) -> List[int]
def _create_buttons(self: Any) -> None
def _update_button_states(self: Any) -> None
def update(self: Any, dt: float, input_state: InputState) -> None
def render(self: Any, renderer: Renderer) -> None
Expandable panel that toggles visibility of its content frame.
The content frame can have its own auto_arrange_y.
_properties: Any = {**UiFrame._properties, 'title': {'name': 'title', 'key': 'title', 'type': str, 'editable': True, 'description': 'Header text'}, 'expanded': {'name': 'expanded', 'key': '_expanded', 'type': bool, 'editable': True, 'description': 'Whether the panel is expanded'}, 'header_height': {'name': 'header height', 'key': 'header_height', 'type': int, 'editable': False, 'description': 'Height of header button'}, 'allow_multiple': {'name': 'allow multiple', 'key': 'allow_multiple', 'type': bool, 'editable': True, 'description': 'Allow multiple expanded items in same parent'}, 'accordion_group': {'name': 'accordion group', 'key': 'accordion_group', 'type': str, 'editable': True, 'description': 'Group name for accordion behavior'}}
def __init__(self: Any, x: int, y: int, width: int, height: int, title: str = 'Expand', expanded: bool = False, allow_multiple: bool = False, accordion_group: Optional[str] = None, pivot: Tuple[float, float] = (0, 0), theme: Optional[ThemeType] = None, element_id: Optional[str] = None, auto_arrange_content: bool = False, arrange_spacing: int = 5, arrange_align: str = 'left') -> None
def setupIcons(self: Any) -> None
def _get_init_args(self: Any) -> Dict[str, Any]
def _toggle(self: Any) -> None
def expand(self: Any) -> None
def collapse(self: Any) -> None
def is_expanded(self: Any) -> bool
def add_to_content(self: Any, element: UIElement) -> None
def update(self: Any, dt: float, input_state: InputState) -> None
def render(self: Any, renderer: OpenGLRenderer) -> None
A color picker widget that expands/collapses to show sliders and hex input.
Inherits from UiFrame so that when its height changes (on expand/collapse),
any parent with auto_arrange_y=True will automatically reposition its children.
Attributes:
color (Color): Currently selected color.
expanded (bool): Whether the picker is expanded.
color_system (str): 'rgb', 'hsl', or 'hsv'.
show_alpha (bool): If True, an alpha slider is shown.
on_color_changed (Callable[[Color], None]): Callback when color changes.
_properties: Any = {**UiFrame._properties, 'color': {'name': 'color', 'key': 'color', 'type': Color, 'editable': True, 'description': 'Current selected color'}, 'color_system': {'name': 'color system', 'key': 'color_system', 'type': str, 'editable': False, 'description': 'RGB, HSL or HSV'}, 'expanded': {'name': 'expanded', 'key': 'expanded', 'type': bool, 'editable': True, 'description': 'Show expanded panel'}, 'show_alpha': {'name': 'show alpha', 'key': 'show_alpha', 'type': bool, 'editable': True, 'description': 'Show alpha slider'}}
def __init__(self: Any, x: int, y: int, width: int = 280, closed_height: int = 32, expanded_height: int = 196, color_system: Literal['rgb', 'hsl', 'hsv'] = 'rgb', initial_color: Optional[Union[Color, Tuple[int, int, int]]] = None, show_alpha: bool = False, pivot: Tuple[float, float] = (0, 0), theme: Optional[ThemeType] = None, element_id: Optional[str] = None, **kwargs: dict) -> None
def update_theme(self: Any, theme_type: ThemeType) -> None
def _get_init_args(self: Any) -> Dict[str, Any]
def _preview_width(self: Any) -> int
def _build_content(self: Any) -> None
def _create_hue_gradient(self: Any) -> None
def _create_rainbow_surface(self: Any, w: int, h: int) -> pygame.Surface
def _hue_to_rgb(hue: float) -> Tuple[int, int, int]
def _apply_theme_to_children(self: Any) -> None
def update(self: Any, dt: float, inputState: InputState) -> None
def _notify_parent_rearrange(self: Any) -> None
def _toggle_expanded(self: Any) -> None
def expand(self: Any) -> None
def collapse(self: Any) -> None
def expanded(self: Any) -> bool
def color(self: Any) -> Color
def color(self: Any, new_color: Color) -> None
def set_on_color_changed(self: Any, callback: Callable[[Color], None]) -> None
def _update_closed_display(self: Any) -> None
def _sync_sliders_from_color(self: Any) -> None
def _on_slider_changed(self: Any, component: str, value: float) -> None
def _on_hex_changed(self: Any, hex_str: str) -> None
def _color_to_hex(self: Any) -> str
def _rgb_to_hsl(r: int, g: int, b: int) -> Tuple[float, float, float]
def _hsl_to_rgb(h: float, s: float, l: float) -> Tuple[int, int, int]
def _rgb_to_hsv(r: int, g: int, b: int) -> Tuple[float, float, float]
def _hsv_to_rgb(h: float, s: float, v: float) -> Tuple[int, int, int]
def render(self: Any, renderer: OpenGLRenderer) -> None