from omni import ui
from omni.kit.widget.spinner import FloatSpinner, IntSpinner
from omni.kit.widget.examples import ExamplePage

from typing import List, Optional


class SpinnerPage(ExamplePage):
    def __init__(self):
        super().__init__("Spinner")

    def destroy(self):
        self._h_float_spinner.destroy()
        self._float_spinner.destroy()
        self._int_spinner.destroy()

    def build_page(self):
        with ui.VStack(spacing=5):
            with ui.HStack(height=20, spacing=10):
                ui.Label("Float spinner:", width=100)
                self._float_spinner = FloatSpinner(width=60)

            with ui.HStack(height=20, spacing=10):
                ui.Label("Int spinner:", width=100)
                self._int_spinner = IntSpinner(width=60)

            with ui.HStack(height=20, spacing=10):
                ui.Label("Horizontal:", width=100)
                self._h_float_spinner = FloatSpinner(vertical=False, width=60)

            with ui.HStack(height=20, spacing=10):
                ui.Label("Disabled:", width=100)
                self._disbled_spinner = FloatSpinner(width=60)
                self._disbled_spinner.enabled = False
