ULimenStandardButton
Overview
ULimenStandardButton is a custom UMG (Unreal Motion Graphics) widget that extends UWidget. It allows users to create interactive buttons with customizable text, styles, and event handlers. The class provides public functions to set and get button properties, as well as protected overrides for handling Slate events such as clicks and hovers.
Properties
Type | Name | Access | Description |
|---|---|---|---|
| OnButtonClickedEvent | Public | A delegate that is called when the button is clicked. |
| OnButtonHoveredEvent | Public | A delegate that is called when the mouse hovers over the button. |
| OnButtonUnhoveredEvent | Public | A delegate that is called when the mouse leaves the button. |
| ButtonStyle | Protected | The style of the button, including normal, hover, and pressed states. |
| Text | Protected | The text displayed on the button. |
| TextHorizontalAlignment | Protected | The horizontal alignment of the button text. |
| TextVerticalAlignment | Protected | The vertical alignment of the button text. |
| Font | Protected | The font used for the button text. |
| TextColor | Protected | The color of the button text. |
| TextMargin | Protected | The margin around the button text. |
| TextJustification | Protected | The justification of the button text. |
| ButtonId | Private | A unique identifier for the button. |
Functions
Return Type | Signature | Description |
|---|---|---|
| SetButtonText(const FText& NewText) | Sets the text displayed on the button. |
| SetButtonStyle(const FButtonStyle& NewStyle) | Sets the style of the button. |
| SetButtonNormalBrush(const FSlateBrush& NewBrush) | Sets the normal state brush for the button. |
| SetButtonFont(const FSlateFontInfo& NewFont) | Sets the font used for the button text. |
| GetButtonId() const | Returns the unique identifier of the button. |
| GetButtonText() const | Returns the current text displayed on the button. |
| RebuildWidget() override | Rebuilds the Slate widget for this UMG component. |
| OnClicked() override | Handles the click event and broadcasts the |
| OnHovered() override | Handles the hover event and broadcasts the |
| OnUnhovered() override | Handles the unhover event and broadcasts the |
Usage & Implementation Notes
The button widget is designed to be used in Unreal Engine 5 projects that utilize UMG for UI development.
The
RebuildWidgetfunction constructs the Slate widget hierarchy, combining aSButtonwith aSTextBlockto display text and handle user interactions.Event handlers (
OnClicked,OnHovered,OnUnhovered) are bound to delegate functions that broadcast events to Blueprints or C++ code.The button's style can be customized through the
SetButtonStylefunction, allowing for a wide range of visual options.