namespace AcDream.App.UI;
///
/// Retail UIOption_CheckboxSlider (Type 0x10000036) — a combined
/// toggle + slider option row (e.g. the Config tab's "Sound / Volume" pair: an
/// on/off LED plus a volume slider in one row). The dat class id lands on the
/// composite ROW'S OWN element (research doc §1.1: "row child element looked up —
/// the row root itself"), and the row authors NO media of its own; its content is
/// two NESTED option widgets — a UIOption_Checkbox child (dat id
/// 0x10000219 in every observed template) and a UIOption_Slider child
/// (0x1000021C) — verified against the regenerated options_2100002B.json
/// fixture's template elements 0x10000220/0x10000221.
///
///
/// This widget does not consume its dat children: they build the ordinary
/// recursive way through DatWidgetFactory's EXISTING checkbox (0x10000035
/// → via BuildCheckbox) and slider (0x10000037 →
/// via BuildScrollbar) mappings — no new drawing code,
/// per the campaign contract's "compose existing primitives" directive. Once the
/// subtree is attached (), this widget just
/// grabs references to the two composed children for a page controller to bind
/// against directly instead of re-deriving them from child order/type.
///
///
public sealed class UiOptionToggleSlider : UiElement, IUiChildrenAttachedListener
{
/// The composed checkbox (retail's LED half of the row).
public UiButton? Toggle { get; private set; }
/// The composed slider (retail's scalar half of the row).
public UiScrollbar? Slider { get; private set; }
public void OnChildrenAttached()
{
foreach (UiElement child in Children)
{
if (Toggle is null && child is UiButton button)
Toggle = button;
else if (Slider is null && child is UiScrollbar scrollbar)
Slider = scrollbar;
}
}
}