From 2eef939b5af8ab359c294339cde3d727bb65f2a6 Mon Sep 17 00:00:00 2001 From: Brues <5278969+brues-code@users.noreply.github.com> Date: Sun, 1 Nov 2026 16:03:33 -0600 Subject: [PATCH] feat(xml): registerForClicks and wordwrap attributes 1.12's loaders read neither attribute: the Button loader (0x007788C0) has no registerForClicks, and the font string loader (0x00770F40) reads nonspacewrap but not wordwrap. Both were silently ignored, so ported templates got the default click mask and wrapping text. Both are read in the loader hooks Xml::ParentKey already owns, after the engine's loader and before OnLoad, and only when present and non-empty, so a node's value beats its template's and an OnLoad call still overrides it. No new hooks. registerForClicks follows 3.3.5's CSimpleButton::LoadXML. Storm's tokenizer (0x0064AE50, the one 3.3.5 calls) splits the value on spaces and commas. Each name ORs in its bits through Frame::MouseRegistration::MaskForName, the RegisterForMouse name table (3.3.5's MouseButtonStringToBitmask, AnyUp / AnyDown included). The result replaces the mask through the engine's own setter 0x00779730 (__thiscall(button, mask), ret 4, writes only +0x330). wordwrap goes through FontString::WordWrap::Set, the body of fontstring:SetWordWrap: it clears the font's override of the no-wrap style bit and lays the string out again when the value changes. Tested in game: WowStyle1DropdownTemplate's Text (wordwrap="false") now reports CanWordWrap() = nil. --- docs/API.md | 17 +++++++++++++++++ src/Offsets.h | 7 ++++--- src/fontstring/WordWrap.cpp | 26 +++++++++++++++++--------- src/fontstring/WordWrap.h | 23 +++++++++++++++++++++++ src/frame/ClickMask.cpp | 30 ++++++++++++++++++++++++++++++ src/frame/ClickMask.h | 23 +++++++++++++++++++++++ src/frame/MouseRegistration.cpp | 16 ++++++++++------ src/frame/MouseRegistration.h | 7 +++++++ src/xml/ParentKey.cpp | 11 ++++++++++- 9 files changed, 141 insertions(+), 19 deletions(-) create mode 100644 src/fontstring/WordWrap.h create mode 100644 src/frame/ClickMask.h diff --git a/docs/API.md b/docs/API.md index f75de25e..1176f304 100644 --- a/docs/API.md +++ b/docs/API.md @@ -8262,6 +8262,13 @@ f:SetWordWrap(false) f:SetText("one two three four five six") -- draws "one two three four fi..." ``` +You can also set the value in XML with the `wordwrap` attribute on a +`FontString`. The default is `true`. + +```xml + +``` + ### `fontstring:GetFieldSize()` Returns the number of bytes of text that the string can hold. A string @@ -10006,6 +10013,16 @@ unknown names makes the button respond to no click at all. `Button:Click()` ignores the click types, so a button in that state still responds to `Click()`. +You can also set the click types in XML with the `registerForClicks` +attribute on a `Button` or `CheckButton`. Put spaces or commas between the +names. The attribute replaces the click types of an inherited template, and +a `RegisterForClicks` call in `OnLoad` replaces the attribute. + +```xml +