UDreamUIControl
A control whose hierarchy is code, not an asset.
Inherits from UDreamUserWidget.
Declared in Public/Controls/DreamUIControl.h.
A control whose hierarchy is code, not an asset.
WHAT EVERY ONE OF THEM SHARES is not the tree but the four steps that produce one. This class owns NativeOnInitialized and runs them in order:
1. a tree -- RealizeTemplate(), or RealizeBuiltIn() when nothing replaces it
2. the parts -- BindParts(), by NAME, from the one list CollectParts declares
3. the behaviours -- WireParts(), on whichever nodes step 2 found
4. the look -- ApplyStyle(), and again whenever a knob changesSplitting 1 from 2 is what makes Template possible. A control used to reach its parts through the builder's .Out(), which writes a pointer at construction and therefore only ever works for a tree this code wrote; binding by name afterwards works for any tree with the right names in it, so the two roads differ in step 1 alone. That is also why CollectParts is ONE list rather than a name lookup beside a pointer list: two lists of the same names is how a template silently stops driving a part the code tree still names.
Splitting 3 out is what keeps "a control always carries its own behaviour" true for a templated one -- the argument DreamButton was written for. A template's author draws a face; WireParts is what puts the UUIButton on it.
THE STYLE CONTRACT is the other half: where the look comes from (the project sheet by default, this instance on request), which named variant, and the obligation to re-push every knob when one changes, because nothing re-derives from a property the way instancing a changed template would. That last part is UMG's SynchronizeProperties, and it is the tax the whole family pays.
The concrete style struct stays on the derived class, typed; a control resolves it as
const FDreamToggleStyle& S = ResolveStyle(Style, &UDreamUIStyleSheet::ToggleStyle);which reads the sheet when StyleSource says to and this instance's Style otherwise.
Properties
| Name | Type | Category | In the details panel | From Blueprint | Description |
|---|---|---|---|---|---|
StyleSource | EDreamUIStyleSource | Style | yes | GetStyleSource / SetStyleSource | See EDreamUIStyleSource: the sheet is the default because one-place-changes-all is the point. |
StyleVariant | FName | Style | yes | GetStyleVariant / SetStyleVariant | Named entry in the sheet ("Danger", "Compact"); none means the family default. |
Template | TSubclassOf<UDreamUserWidget> | Style | yes | read only | A hierarchy to use INSTEAD of the one this control builds for itself -- WPF's ControlTemplate. |
Functions
| Function | Kind | Description |
|---|---|---|
void ApplyStyle() | callable | Re-push the resolved style, and every other knob, into the parts. Called for you after the tree is built and whenever a property changes in the editor; call it yourself after editing a style in place at runtime. |
UDreamWidget* FindPart(FName InName) | pure | The widget of that display name among this control's OWN contents, or null. |
EDreamUIStyleSource GetStyleSource() | pure | Get Style Source |
FName GetStyleVariant() | pure | Get Style Variant |
TArray<FName> GetUnboundRequiredParts() | callable | Every REQUIRED part this control did not find. Empty is the healthy answer. |
void OnControlReady() | event | The control is fully built: its tree exists, its parts are bound, its behaviours are wired and its style has been pushed once. |
void SetStyleSource(EDreamUIStyleSource InStyleSource) | callable | Where the look comes from, at runtime. Re-pushes, because a style that changed source without re-resolving would be a property whose whole effect is invisible until something else happens to push -- which is the failure this family's setters exist to prevent. |
void SetStyleVariant(FName InStyleVariant) | callable | Which named entry of the sheet. Re-pushes, for the reason above. |