UDreamExpandableArea
A header that toggles, and the content it hides.
Inherits from UDreamUIControl.
Declared in Public/Controls/DreamExpandableArea.h.
A header that toggles, and the content it hides.
Three nodes and one behaviour: a column, a clickable header face with an indicator and a label on it, and a content column below. The header is a UUIButton on its own face, exactly as DreamButton builds one -- an expander IS a button whose click means "show the rest" -- so hover, press and navigation come from the library's one selectable rather than from a second interaction story.
HOW A CONSUMER PUTS CONTENT IN IT, and which idiom that is, because there are two in this codebase and only one is reachable from here:
Native.ExpandableArea Details {
Label = "Advanced"
Text Body { Text = "..." }
}Nesting, plainly. The text builder attaches a node's children to the widget it just built (BuildNode's TrySetParent), so those widgets arrive as children of THIS control, sitting beside the tree the control realized for itself -- and the content column is this control's DEFAULT NAMED SLOT, so they are moved into it for free.
That used to be a hand-written adoption pass here, with a comment explaining that UDreamNamedSlot could not be used: a host's NamedSlotContent was hung by InitializeWidgetStatic, which returns immediately for a class with no widget-tree archetype, and a native control never has one -- so a slot declared here would have been a hole nothing could fill. That gate is gone (slots are now filled from UDreamUserWidget::Initialize, after NativeOnInitialized, which is the first moment BOTH kinds of contents exist), and with it the reason to hand-roll this. Code that assembles a hierarchy by hand can still call SetContent; the designer's drag into this control lands as a child, which is the same road as the .dui above.
THE PART NAMES, which a Template's author has to spell exactly, because parts are bound by DISPLAY NAME and nothing checks the spelling but the missing-part log line:
ExpandableArea the outer column
HeaderFace the clickable header face; the node whose height IS HeaderHeight
HeaderRow the indicator-and-label row inside the face
Arrow the glyph indicator (optional)
ArrowMark the image indicator (optional)
Label the stock header text
Header the header HOLE -- a UDreamNamedSlot (optional)
Content the body, and this control's default UDreamNamedSlotThe face is "HeaderFace" and NOT "Header" on purpose. A named slot's name is its host node's display name (UDreamNamedSlot::GetSlotName), so the hole must be called Header -- that string is HeaderSlotName, a public binding key, and one of the two names GetNativeSlotNames promises. A part walk meets ancestors before descendants, so a face also called Header answers for BOTH, and the swap that puts the stock label away when the hole is filled then reads an empty hole and sleeps the entire header. A template that names its own header face Header re-creates exactly that: the header disappears, and the only trace is one missing-part line for HeaderFace.
UMG parity is UExpandableArea's core: bIsExpanded, SetIsExpanded, OnExpansionChanged -- plus the
library's OnValueChangedBP, because the expanded flag is a value and <-> binds against it.
Collapsed, the control measures as the HEADER and nothing more: an Auto slot asks the control for its size, and an expander that kept its expanded height would leave a hole in every list it is in.
Properties
| Name | Type | Category | In the details panel | From Blueprint | Description |
|---|---|---|---|---|---|
Style | FDreamExpandableAreaStyle | Expandable Area | yes | GetStyle / SetStyle | This instance's own look. The project sheet wins while StyleSource says so AND a sheet actually exists; with no sheet in the project this IS the look in effect -- which is why it stays editable instead of being gated on the enum: the old edit condition greyed the exact values that were driving the control. |
Label | FText | Expandable Area | yes | GetLabel / SetLabel | The words on the header. |
bIsExpanded | bool | Expandable Area | yes | GetIsExpanded / SetIsExpanded | Whether the content shows. A property so .dui, the designer and bindings can see it and so an author can ship a section already open; every road that CHANGES it goes through SetIsExpanded, which is the only thing that broadcasts. |
MaxHeight | float | Expandable Area | yes | GetMaxHeight / SetMaxHeight | A ceiling on the CONTENT's share of the control's height, in local units -- UMG's MaxHeight. |
ExpansionDuration | float | Expandable Area | yes | GetExpansionDuration / SetExpansionDuration | How long the open and close take, in seconds. Zero (the default) is instant. |
RootNode | TObjectPtr<UDreamWidget> | Expandable Area | - | read only | |
HeaderNode | TObjectPtr<UDreamWidget> | Expandable Area | - | read only | The clickable face, and the node whose height IS the style's HeaderHeight. Bound from the part named "HeaderFace" -- the FIELD keeps its name, the part does not; see the class comment for why the two differ. |
HeaderRowNode | TObjectPtr<UDreamWidget> | Expandable Area | - | read only | The indicator-and-label row inside the header. See the tree comment for why it is its own node. |
ArrowNode | TObjectPtr<UDreamWidget> | Expandable Area | - | read only | The built-in glyph indicator. Asleep whenever the state's brush carries an image instead. |
ArrowMarkNode | TObjectPtr<UDreamWidget> | Expandable Area | - | read only | The image indicator, the glyph's stand-in. Exactly one of the two is awake. |
LabelNode | TObjectPtr<UDreamWidget> | Expandable Area | - | read only | |
ContentNode | TObjectPtr<UDreamWidget> | Expandable Area | - | read only | Where a consumer's content lives, and the node that is switched off when collapsed. |
HeaderBehaviour | TObjectPtr<UUIButton> | Expandable Area | - | read only | |
HeaderSlotNode | TObjectPtr<UDreamWidget> | Expandable Area | - | read only | The header's hole, in the stock label's place. Empty is the normal state. |
Functions
| Function | Kind | Description |
|---|---|---|
UDreamWidget* GetContent() | pure | The first widget in the content column, or null while it is empty. |
float GetExpansionDuration() | pure | Get Expansion Duration |
bool GetIsExpanded() | pure | Get Is Expanded |
FText GetLabel() | pure | Get Label |
float GetMaxHeight() | pure | Get Max Height |
FDreamExpandableAreaStyle GetStyle() | pure | Get Style |
void SetContent(UDreamWidget* InContent) | callable | Put InContent in the content column, taking it from wherever it currently hangs. |
void SetExpansionDuration(float InExpansionDuration) | callable | How long the NEXT open or close takes. Nothing is re-run: a duration describes a move that has not happened yet, and replaying the current one to honour a new speed would animate a section the player already finished opening. |
void SetIsExpanded(bool bInIsExpanded) | callable | Silent when the flag does not move; otherwise pushes the visuals and broadcasts both events. |
void SetLabel(FText InLabel) | callable | The words on the header, written through to the label the control owns. |
void SetMaxHeight(float InMaxHeight) | callable | Re-measures at once: the ceiling is part of the height this control claims. |
void SetStyle(FDreamExpandableAreaStyle InStyle) | callable | This instance's whole look, replaced and pushed. See UDreamButton::SetStyle for the caveat. |
void ToggleExpansion() | callable | What the header click does, callable without a pointer. |
Events
| Event | Signature | Description |
|---|---|---|
OnExpansionChanged | void DreamExpandableAreaExpansionChangedEvent__DelegateSignature(bool bIsExpanded) | Fired whenever the expanded flag moves, from a click or from code. |
OnValueChangedBP | void DreamExpandableAreaExpansionChangedEvent__DelegateSignature(bool bIsExpanded) | The <-> convention: two-way bindings synthesize their reverse route against this exact name, so a value control carries it alongside its spoken events. Fires with them. |
Compared with UMG
Every Blueprint-facing member of the UMG class, and where it went. adopt: same name, same meaning. map: here under another name or on another type. reject: deliberately absent, with the reason.
| UMG | Member | Status | Here | Note |
|---|---|---|---|---|
UExpandableArea | Style | adopt | Style | FDreamExpandableAreaStyle: the header's height, its five state colours, the label, and the content area's background and padding. |
UExpandableArea | BorderBrush | map | FDreamExpandableAreaStyle::ContentBackground | A colour rather than an FSlateBrush: the content area is a procedural rect, and what an expander's frame is in this family is that rect's fill. A picture behind the content is a Native.Border around it. |
UExpandableArea | BorderColor | map | FDreamExpandableAreaStyle::ContentBackground | One colour where UMG has a brush and a tint over it, for the reason above: there is no brush here for a second colour to multiply. |
UExpandableArea | bIsExpanded | adopt | bIsExpanded | Authored open or closed; every road that CHANGES it goes through SetIsExpanded, which is what broadcasts. |
UExpandableArea | MaxHeight | adopt | MaxHeight | Zero is no ceiling, which is what this control has always done. |
UExpandableArea | HeaderPadding | map | FDreamExpandableAreaStyle::HeaderPadding | In the style, because how a project's section headers are inset is a theme decision. |
UExpandableArea | AreaPadding | map | FDreamExpandableAreaStyle::ContentPadding | Named for what it pads rather than for the widget it sits on. |
UExpandableArea | OnExpansionChanged | adopt | OnExpansionChanged | Fires from a click and from code alike. |
UExpandableArea | GetIsExpanded | adopt | GetIsExpanded | |
UExpandableArea | SetIsExpanded | adopt | SetIsExpanded | |
UExpandableArea | SetIsExpanded_Animated | map | ExpansionDuration | A duration rather than a second function: whether an expander animates is a property of the expander, not of the caller, so every road (a click, a binding, code) gets the same open. Zero is instant, which is what every expander already authored does. |
UExpandableArea | SetStyle | adopt | SetStyle | UExpandableArea has no style setter at all (its Style is EditAnywhere only); this is the family's spelling of replacing a look at runtime. |