Navigation
Unreal Engine C++ API Reference > Runtime > SlateCore > Widgets
Inheritance Hierarchy
- FSlateControlledConstruction
- TSharedFromThis
- SWidget
- SCompoundWidget
- SUserWidget
- SLiveLinkCurveDebugUI
References
Module | SlateCore |
Header | /Engine/Source/Runtime/SlateCore/Public/Widgets/SUserWidget.h |
Include | #include "Widgets/SUserWidget.h" |
Syntax
class SUserWidget : public SCompoundWidget
Remarks
Use SUserWidget as a base class to build aggregate widgets that are not meant to serve as low-level building blocks. Examples include: a main menu, a user card, an info dialog for a selected object, a splash screen.
See SUserWidgetExample
SMyWidget.h
class SMyWidget : public SUserWidget { public: SLATE_USER_ARGS( SMyWidget ) {} SLATE_END_ARGS()
// MUST Provide this function for SNew to call! virtual void Construct( const FArguments& InArgs ) = 0;
virtual void DoSomething() = 0; };
SMyWidget.cpp
namespace Implementation { class SMyWidget : public ::SMyWidget { public: virtual void Construct( const FArguments& InArgs ) override { SUserWidget::Construct( SUserWidget::FArguments() [ SNew(STextBlock) .Text( NSLOCTEXT("x", "x", "My Widget's Content") ) ] }
private: // Private implementation details can occur here // without ever leaking out into the .h file! } }
TSharedRef
Functions
Type | Name | Description | |
---|---|---|---|
![]() |
void | Construct
(
const FArguments& InArgs |
Operators
Type | Name | Description | |
---|---|---|---|
![]() |
void | operator delete
(
void* InMem |
This exists to silence V1062 and provide implementation balance with the new above. |
![]() |
void * | operator new
(
const size_t InSize |
User widgets can be allocated explicitly in the C++ |
Classes
Type | Name | Description | |
---|---|---|---|
![]() |
FArguments |