MCRO
C++23 utilities for Unreal Engine.
Loading...
Searching...
No Matches
Mcro::Slate Namespace Reference

Extra functionalities for general Slate programming chores, including enhancements of the Slate declarative syntax. More...

Namespaces

namespace  Detail
 

Data Structures

struct  TArgumentsOf_Struct
 
struct  TArgumentsOf_Struct< T >
 
class  TArrayReactiveWidget
 A widget template which can automatically handle changes in an input array state, with given delegates which tell this widget how children are supposed to be created, updated and removed. More...
 
struct  TAttributeBlockFunctor
 An attribute block functor which takes in reference of FArguments or FSlotArguments and returns the same reference but presumably setting some Slate attributes before that. This is useful for modularizing the Slate declarative syntax. More...
 
class  TMapReactiveWidget
 A widget template which can automatically handle changes in an input map state, with given delegates which tell this widget how children are supposed to be created, updated and removed. More...
 
struct  TSlots
 Add multiple slots at the same time with the declarative syntax derived from an input data array. More...
 

Concepts

concept  CWidget
 Constraining given type to a Slate widget.
 
concept  CSlot
 Constraining given type to a slot of a widget.
 
concept  CWidgetOrSlot
 Constraining given type to either a slot or a widget.
 
concept  CWidgetOrSlotArguments
 Constraining given type to the arguments of either a widget or a slot.
 
concept  CWidgetArguments
 Constraining given type to the arguments of a widget

 
concept  CSlotArguments
 Constraining given type to the arguments of a slot

 
concept  CWidgetWithSlots
 Constraining given type to a widget which can receive slots.
 
concept  CBoxPanelWidget
 

Typedefs

template<typename T >
using TArgumentsOf = typename TArgumentsOf_Struct<T>::Type
 Get the type of arguments from either a widget or a slot type (FArguments or FSlotArguments)
 
template<CWidgetOrSlot T>
using TAttributeBlock = TAttributeBlockFunctor<TArgumentsOf<T>>
 An attribute block functor which takes in reference of FArguments or FSlotArguments and returns the same reference but presumably setting some Slate attributes before that. This is useful for modularizing the Slate declarative syntax.
 

Functions

template<CFunctionLike Transform, Mcro::Range::CRangeOfTuplesCompatibleWithFunction< Transform > Range, CFunctionLike OnEmpty = TUniqueFunction<TFunction_Return<Transform>()>, CSlotArguments = TFunction_Return<Transform>>
requires (TFunction_ArgCount<Transform> >= 1)
auto SlotsFromTuples (Range &&range, Transform &&transform, TOptional< OnEmpty > &&onEmpty={})
 Create widget slots from ranges of tuples via a transformation with structured binding arguments.
 
MCRO_API EVisibility IsVisible (bool visible, EVisibility hiddenState=EVisibility::Collapsed)
 Convenience function for typing less when widget visibility depends on a boolean.
 

Variables

template<CWidgetOrSlot T>
TAttributeBlock< T > InertAttributeBlock = [](TArgumentsOf<T>& args) -> auto& { return args; }
 An attribute block which does nothing.
 

Detailed Description

Extra functionalities for general Slate programming chores, including enhancements of the Slate declarative syntax.

Typedef Documentation

◆ TArgumentsOf

template<typename T >
using Mcro::Slate::TArgumentsOf = typename TArgumentsOf_Struct<T>::Type

Get the type of arguments from either a widget or a slot type (FArguments or FSlotArguments)

Definition at line 90 of file Slate.h.

◆ TAttributeBlock

template<CWidgetOrSlot T>
using Mcro::Slate::TAttributeBlock = TAttributeBlockFunctor<TArgumentsOf<T>>

An attribute block functor which takes in reference of FArguments or FSlotArguments and returns the same reference but presumably setting some Slate attributes before that. This is useful for modularizing the Slate declarative syntax.

Definition at line 159 of file Slate.h.

Function Documentation

◆ IsVisible()

MCRO_API EVisibility Mcro::Slate::IsVisible ( bool visible,
EVisibility hiddenState = EVisibility::Collapsed )

Convenience function for typing less when widget visibility depends on a boolean.

◆ SlotsFromTuples()

template<CFunctionLike Transform, Mcro::Range::CRangeOfTuplesCompatibleWithFunction< Transform > Range, CFunctionLike OnEmpty = TUniqueFunction<TFunction_Return<Transform>()>, CSlotArguments = TFunction_Return<Transform>>
requires (TFunction_ArgCount<Transform> >= 1)
auto Mcro::Slate::SlotsFromTuples ( Range && range,
Transform && transform,
TOptional< OnEmpty > && onEmpty = {} )

Create widget slots from ranges of tuples via a transformation with structured binding arguments.

See also
Mcro::Range::TransformTuple

For example:

void SMyWidget::Construct(const FArguments& args)
{
using namespace Mcro::Slate;
ChildSlot
[
SNew(SVerticalBox)
+ SlotsFromTuples(args._DataMap, [](const FString& key, int32 value)
{
return MoveTemp(SVerticalBox::Slot()
. HAlign(HAlign_Fill)
. AutoHeight()
[
SNew(SHorizontalBox)
+ SHorizontalBox::Slot() [ SNew(STextBlock).Text(AsText(key)) ]
+ SHorizontalBox::Slot() [ SNew(STextBlock).Text(AsText(value)) ]
];
);
})
+ SVerticalBox::Slot()
. HAlign(HAlign_Fill)
. AutoHeight()
[
SNew(STextBlock)
. Text(INVTEXT_"Footer after the list of data")
]
];
}
#define INVTEXT_
A convenience alternative to Unreal's own INVTEXT macro but this one doesn't require parenthesis arou...
Definition TextMacros.h:156
Extra functionalities for general Slate programming chores, including enhancements of the Slate decla...
Definition Slate.h:28
auto SlotsFromTuples(Range &&range, Transform &&transform, TOptional< OnEmpty > &&onEmpty={})
Create widget slots from ranges of tuples via a transformation with structured binding arguments.
Definition Slate.h:306

Definition at line 306 of file Slate.h.

Variable Documentation

◆ InertAttributeBlock

template<CWidgetOrSlot T>
TAttributeBlock<T> Mcro::Slate::InertAttributeBlock = [](TArgumentsOf<T>& args) -> auto& { return args; }

An attribute block which does nothing.

Definition at line 163 of file Slate.h.