feat(ui): Campaign OP slice OP2 — tab control, template ListBox, UIOption widget mappings

Ships the two new widget primitives the retail Options panel needs plus the
four remaining UIOption_* factory mappings, so every tab page (OP3-OP6) has
somewhere to mount.

- ElementReader/ElementInfo gain three new dat-property readers, following
  the existing effective-state-resolution pattern (never a per-state
  first-wins scan, per the round-5 N1 lesson): the Type-8 tab table
  (property 0x2E -> TabTable), a ListBox's row-template list (property
  0x64 -> TemplateList), and scrollbar linkage (property 0x72 ->
  ScrollbarElementId). LayoutImporter gains one hook
  (IUiChildrenAttachedListener) so a widget can resolve cross-references
  its own dat properties name by id once its subtree actually exists.

- UiTabControl (Type 8): switches exactly one page-slot child visible,
  syncs each tab button's Open/Closed state via the existing
  RetailTabBinding helper, and honors the authored default tab on mount.

- UiTemplateListBox (Type 5 with an authored template list): wraps a
  UiScrollablePanel viewport (sealed, so composition not inheritance) and
  ports AddItemFromTemplateList(index) — the resolver seam a page
  controller wires with real DAT access via the SAME
  LayoutImporter.ImportInfos(dats, layoutId, elementId) overload
  RetailDialogFactory already uses for its catalog LayoutDesc.

- DatWidgetFactory maps the four remaining UIOption_* widgets, each
  verified against the regenerated options_2100002B.json fixture before
  writing any code: 0x10000037 (Slider) is structurally an ordinary
  horizontal UIElement_Scrollbar, so it reuses BuildScrollbar directly;
  0x10000038 (Menu) is structurally identical to the vendor category
  dropdown UiMenu already models, so it reuses `new UiMenu()` like the
  Type-6 case; 0x10000036 (CheckboxSlider) composes an existing
  UIOption_Checkbox child + UIOption_Slider child via the new
  UiOptionToggleSlider wrapper; 0x10000044 (CheckboxBitfield64) authors
  zero children in the dat (every row is added at runtime via retail's own
  AddChild(lowMask, highMask, label, tooltip) call shape), so it's a new
  UiCheckboxBitfield64 composing UiButton per row. No new drawing code
  anywhere in this set.

- Five new committed fixtures (options_2100002B/2100002A/21000028/
  2100005C/21000029) plus 25 new conformance tests pinning the tab table
  (4 entries, Gameplay default), all three template arrays, scrollbar
  linkage, every new widget-type mapping, and a UiTabControl behavioral
  test (switch -> exactly one page visible, click-through the tab
  button). The Character ListBox's authored 6-header/49-toggle shape
  (lane B section counts) is proven reachable end-to-end through
  AddItemFromTemplateList against the committed fixture.

- Regenerating fixtures also touched 27 PRE-EXISTING, unrelated fixtures
  (an Outline/OutlineColor field pair added by an earlier commit,
  bcc34ee3, that predates when those fixtures were last regenerated).
  Per the slice contract, that drift was NOT committed — reverted back to
  HEAD, only the five new Options-panel fixtures are new files here.

- Filed TS-72: UiCheckboxBitfield64's click-toggle bit math (AND/OR
  set/clear semantics) is a documented approximation — the decompiled
  excerpt this campaign pulled covers UIOption_CheckboxBitfield64::Apply's
  WRITE side, not its own click-handler's bit math. Flagged for OP5 (the
  Chat tab controller, the first consumer that reaches the wire) to
  verify against the real decomp before any live transaction depends on
  it; nothing user-reachable can observe this yet.

Full Release suite: 12,770 passed / 4 skipped / 0 failed (was 12,745/4/0
post-OP1 — 25 net new tests, zero regressions).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Erik 2026-08-11 00:06:43 +02:00
parent 0df0a60424
commit df9c7a35eb
17 changed files with 51896 additions and 1 deletions

View file

@ -93,8 +93,21 @@ public static class DatWidgetFactory
or IndicatorBarController.VitaeClassId => BuildButton(
info, resolve, elementFont, fontResolve, stringResolve),
// gmUIElement_*Indicator custom button classes
// UIElement_ListBox (Type 5) with an authored row-template list (dat
// property 0x64) — the Options panel's Character/Chat/Config ListBoxes
// (docs/research/2026-08-10-options-panel-structure.md §1.5). Gated on
// info.TemplateList.Count > 0 so an ORDINARY Type-5 ListBox that authors
// no template array (none currently reach this factory — vendor's category
// dropdown is drawn procedurally by UiMenu.Scrollable, not imported as a
// live Type-5 widget) keeps falling to the generic UiDatElement fallback
// unchanged (OP2 acceptance: no behavior change to any existing widget).
5 when info.TemplateList.Count > 0 => new UiTemplateListBox(
info.TemplateList, info.ScrollbarElementId),
6 => new UiMenu(), // UIElement_Menu (reg :120163)
7 => BuildMeter(info, resolve, elementFont), // UIElement_Meter
// UIElement_TabControl (Type 8) — the Options panel's tab strip (dat
// property 0x2E; same research doc §1.3/§10.1).
8 => new UiTabControl(info.TabTable),
9 => BuildResizeGrip(info, resolve), // UIElement_Resizebar (reg 0x0046B920)
0xD => new UiViewport(), // UIElement_Viewport — 3-D mini-scene blit leaf
11 => BuildScrollbar(info, resolve), // UIElement_Scrollbar (reg :124137)
@ -103,6 +116,37 @@ public static class DatWidgetFactory
0x10000031u => new UiItemList(resolve), // UIElement_ItemList — toolbar/inventory/paperdoll slots
0x10000035u => BuildCheckbox(
info, resolve, elementFont, fontResolve, stringResolve), // UIOption_Checkbox
// UIOption_CheckboxSlider (Type 0x10000036): a composite row whose class id
// lands on the row root itself, but whose content is two NESTED option
// widgets (a UIOption_Checkbox child + a UIOption_Slider child — verified
// against options_2100002B.json's templates 0x10000220/0x10000221). It does
// not consume its dat children, so those build normally through the two
// mappings immediately below; UiOptionToggleSlider just grabs references to
// them once attached (see docs/research/2026-08-10-options-panel-structure.md
// §1.1/§1.5).
0x10000036u => new UiOptionToggleSlider(),
// UIOption_Slider (Type 0x10000037): structurally an ordinary HORIZONTAL
// UIElement_Scrollbar — its own DirectState carries the track sprite and its
// child id 1 is the drag thumb, the exact convention BuildScrollbar's
// horizontal branch already implements (verified against
// options_2100002B.json's slider control 0x1000021C: W=120 > H=12, one
// Type-1 child at id 1). No new drawing code — same "compose existing
// primitives" directive as UiOptionToggleSlider above.
0x10000037u => BuildScrollbar(info, resolve),
// UIOption_Menu (Type 0x10000038): a label + arrow-cap dropdown button,
// structurally identical to the vendor category dropdown UiMenu already
// models (verified against options_2100002B.json's menu control 0x10000224:
// a Text label child + a 17x19 image child, matching UiMenu's own
// ArrowCapClosedSprite doc comment). Built blank, exactly like the Type-6
// case above — a page controller wires its sprites/items the same way
// ChatWindowController wires the channel menu.
0x10000038u => new UiMenu(),
// UIOption_CheckboxBitfield64 (Type 0x10000044): the Chat tab's per-window
// text-filter block. Its authored template (0x10000520) carries no children
// or media at all — every row is added at runtime via AddChild(lowMask,
// highMask, label, tooltip), matching retail's own
// gmChatOptionsUI::AddCheckboxBitfield64Option call pattern (research doc §5.2).
0x10000044u => BuildCheckboxBitfield64(resolve, elementFont),
_ => new UiDatElement(info, resolve), // generic fallback (incl. Type 3 chrome/containers)
};
@ -756,6 +800,21 @@ public static class DatWidgetFactory
return button;
}
/// <summary>
/// Builds a blank <see cref="UiCheckboxBitfield64"/> seeded with the sprite
/// resolver and dat font a page controller's later
/// <see cref="UiCheckboxBitfield64.AddChild(ulong, ulong, string, string?)"/>
/// calls need — the template authors no rows, so there is nothing else to read
/// from <c>ElementInfo</c> at import time.
/// </summary>
private static UiCheckboxBitfield64 BuildCheckboxBitfield64(
Func<uint, (uint, int, int)> resolve, UiDatFont? elementFont)
=> new()
{
SpriteResolve = resolve,
LabelFont = elementFont,
};
private static ElementInfo? FindStatefulFaceChild(ElementInfo info)
=> FindStatefulFaceChildren(info).FirstOrDefault();