
__all__ = ["WidgetPropertyFrame"]

import omni.ui as ui
from ..base_frame import WidgetCollectionFrame
from ..create_widget import PropertyType


class WidgetPropertyFrame(WidgetCollectionFrame):
    def __init__(self, frame_label: str, widget: ui.Widget) -> None:
        super().__init__(frame_label, widget)

    def _build_ui(self):

        self._add_property(self._widget, "width", PropertyType.FLOAT, 0, 2000)
        self._add_property(self._widget, "height", PropertyType.FLOAT, 0, 2000)

        self._add_property(self._widget, "tooltip_offset_x", PropertyType.FLOAT, 0, 2000)
        self._add_property(self._widget, "tooltip_offset_y", PropertyType.FLOAT, 0, 2000)

        ui.Line(height=2, style={"color": 0xFF666666})

        self._add_property(self._widget, "name", PropertyType.STRING)

        ui.Line(height=2, style={"color": 0xFF666666})

        self._add_property(self._widget, "checked", PropertyType.BOOL)
        self._add_property(self._widget, "enabled", PropertyType.BOOL)
        self._add_property(self._widget, "selected", PropertyType.BOOL)
        self._add_property(self._widget, "opaque_for_mouse_events", PropertyType.BOOL)

        self._add_property(self._widget, "visible", PropertyType.BOOL)
        self._add_property(self._widget, "skip_draw_when_clipped", PropertyType.BOOL)

        ui.Spacer(height=10)

        ui.Line(height=5, style={"color": 0xFF666666, "border_width": 5})

        ui.Label("Read Only", alignment=ui.Alignment.CENTER)

        self._add_property(self._widget, "computed_width", PropertyType.FLOAT, 0, 2000)
        self._add_property(self._widget, "computed_height", PropertyType.FLOAT, 0, 2000)

        ui.Line(height=2, style={"color": 0xFF666666})

        self._add_property(self._widget, "computed_content_width", PropertyType.FLOAT, 0, 2000)
        self._add_property(self._widget, "computed_content_height", PropertyType.FLOAT, 0, 2000)

        ui.Line(height=2, style={"color": 0xFF666666})

        self._add_property(self._widget, "screen_position_x", PropertyType.FLOAT, 0, 2000)
        self._add_property(self._widget, "screen_position_y", PropertyType.FLOAT, 0, 2000)
