UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FWidgetStateBitfield Struct Reference

#include <WidgetStateBitfield.h>

Public Member Functions

UMG_API FWidgetStateBitfield ()
 
UMG_API FWidgetStateBitfield (const FName InStateName)
 
UMG_API FWidgetStateBitfield (const FName InStateName, const uint8 InValue)
 
UMG_API FWidgetStateBitfield operator~ () const
 
UMG_API FWidgetStateBitfield Intersect (const FWidgetStateBitfield &Rhs) const
 
UMG_API FWidgetStateBitfield Union (const FWidgetStateBitfield &Rhs) const
 
UMG_API operator bool () const
 
UMG_API bool HasBinaryStates () const
 
UMG_API bool HasEnumStates () const
 
UMG_API bool HasEmptyUsedEnumStates () const
 
UMG_API bool HasAnyFlags (const FWidgetStateBitfield &InBitfield) const
 
UMG_API bool HasAllFlags (const FWidgetStateBitfield &InBitfield) const
 
UMG_API bool HasAnyBinaryFlags (const FWidgetStateBitfield &InBitfield) const
 
UMG_API bool HasAllBinaryFlags (const FWidgetStateBitfield &InBitfield) const
 
UMG_API bool HasAnyEnumFlags (const FWidgetStateBitfield &InBitfield) const
 
UMG_API bool HasAllEnumFlags (const FWidgetStateBitfield &InBitfield) const
 
UMG_API void SetState (const FWidgetStateBitfield &InBitfield)
 
UMG_API void NegateStates ()
 
UMG_API void SetBinaryState (uint8 BinaryStateIndex, bool BinaryStateValue)
 
UMG_API void SetBinaryState (const FWidgetStateBitfield &BinaryStateBitfield, bool BinaryStateValue)
 
UMG_API void SetBinaryStateSlow (FName BinaryStateName, bool BinaryStateValue)
 
UMG_API void NegateBinaryStates ()
 
UMG_API void SetEnumState (uint8 EnumStateIndex, uint8 EnumStateValue)
 
UMG_API void SetEnumState (const FWidgetStateBitfield &EnumStateBitfield)
 
UMG_API void SetEnumStateSlow (FName EnumStateName, uint8 EnumStateValue)
 
UMG_API void ClearEnumState (const FWidgetStateBitfield &EnumStateBitfield)
 
UMG_API void ClearEnumState (uint8 EnumStateIndex)
 
UMG_API void ClearEnumState (FName EnumStateName)
 
UMG_API void NegateEnumStates ()
 

Detailed Description

Expensive to create wrapper for binary and enumerated widget states that supports FName-based interaction and dynamic states populated in an IWidgetStateNameMapper May be used to represent either a target widget state combination, or an actual widgets state

All this does is cache the integer results of dynamic FName state lookup from an IWidgetStateNameMapper So it's prefertable to create these once and reuse. In particular, if broadcasting current state determine the correct bitfield to modify the existing state ahead of time. Save that bitfield and use it when performing state-modifications. Likewise when performing state tests, try to construct the relevant bitfield ahead of time & store that to later be compared against

Examples
/work/Engine/Source/Runtime/UMG/Public/Components/Widget.h.

Constructor & Destructor Documentation

◆ FWidgetStateBitfield() [1/3]

FWidgetStateBitfield::FWidgetStateBitfield ( )

Default, will convert to false as a bool

◆ FWidgetStateBitfield() [2/3]

FWidgetStateBitfield::FWidgetStateBitfield ( const FName  InStateName)

Interprets name as binary state on

◆ FWidgetStateBitfield() [3/3]

FWidgetStateBitfield::FWidgetStateBitfield ( const FName  InStateName,
const uint8  InValue 
)

Interprets name value pair as enum state

Member Function Documentation

◆ ClearEnumState() [1/3]

void FWidgetStateBitfield::ClearEnumState ( const FWidgetStateBitfield EnumStateBitfield)

Clear all existing values for given states & mark the states unused

Parameters
EnumStateBitfieldstate bitfield, all used states will be cleared

◆ ClearEnumState() [2/3]

void FWidgetStateBitfield::ClearEnumState ( FName  EnumStateName)

Clear all existing values for given state & mark the state unused, slow version w/ map lookup

◆ ClearEnumState() [3/3]

void FWidgetStateBitfield::ClearEnumState ( uint8  EnumStateIndex)

Clear all existing values for given state & mark the state unused

Parameters
EnumStateIndexIndex for enum state to mark as unused

◆ HasAllBinaryFlags()

bool FWidgetStateBitfield::HasAllBinaryFlags ( const FWidgetStateBitfield InBitfield) const

True if all binary state flags are met

◆ HasAllEnumFlags()

bool FWidgetStateBitfield::HasAllEnumFlags ( const FWidgetStateBitfield InBitfield) const

True if all enum state flags are met

◆ HasAllFlags()

bool FWidgetStateBitfield::HasAllFlags ( const FWidgetStateBitfield InBitfield) const

True if all state flags are met

◆ HasAnyBinaryFlags()

bool FWidgetStateBitfield::HasAnyBinaryFlags ( const FWidgetStateBitfield InBitfield) const

True if any binary state flag is met

◆ HasAnyEnumFlags()

bool FWidgetStateBitfield::HasAnyEnumFlags ( const FWidgetStateBitfield InBitfield) const

True if any enum state flag is met

◆ HasAnyFlags()

bool FWidgetStateBitfield::HasAnyFlags ( const FWidgetStateBitfield InBitfield) const

Note: No need for HasNoFlags. Simply call !HasAnyFlags. True if any state flag is met

◆ HasBinaryStates()

bool FWidgetStateBitfield::HasBinaryStates ( ) const

True if any binary state is set

◆ HasEmptyUsedEnumStates()

bool FWidgetStateBitfield::HasEmptyUsedEnumStates ( ) const

True if any enum used enum states are empty, usually indicating a failed '&' test

◆ HasEnumStates()

bool FWidgetStateBitfield::HasEnumStates ( ) const

True if any enum state is used, does not indicate if state is actually set. Use 'HasEmptyUsedEnumStates' for that.

◆ Intersect()

FWidgetStateBitfield FWidgetStateBitfield::Intersect ( const FWidgetStateBitfield Rhs) const

Intersection of binary and enum states, with union on enum state usage so enum state mismatches can fail Intersections will remove not allowed enum states, allowing for failure on bool conversion due to empty used states. Approximation of bitwise '&'. Non-commutative, will use LHS enum state set if RHS does not use enum. Additionally, if the RHS has binary states & the LHS does not meet those, all enum states will be marked unused to ensure failure

◆ NegateBinaryStates()

void FWidgetStateBitfield::NegateBinaryStates ( )

Negate only binary states

◆ NegateEnumStates()

void FWidgetStateBitfield::NegateEnumStates ( )

Negate only enum states, does not change usage, but marks existing values as not allowed

◆ NegateStates()

void FWidgetStateBitfield::NegateStates ( )

Negate both binary and enum states

◆ operator bool()

FWidgetStateBitfield::operator bool ( ) const

True if any binary or enum state is set, and no empty used enum states exist

◆ operator~()

FWidgetStateBitfield FWidgetStateBitfield::operator~ ( ) const

Negation of binary and enum states, maintains enum state usage, but marks states as not allowed.

◆ SetBinaryState() [1/2]

void FWidgetStateBitfield::SetBinaryState ( const FWidgetStateBitfield BinaryStateBitfield,
bool  BinaryStateValue 
)

Set Binary state to given value, using a bitfield to indicate states that should be changed

Parameters
BinaryStateBitfieldstate bitfield, all marked states will be set with given value
BinaryStateValueValue to assign for given Binary state

◆ SetBinaryState() [2/2]

void FWidgetStateBitfield::SetBinaryState ( uint8  BinaryStateIndex,
bool  BinaryStateValue 
)

Set binary state to given value

Parameters
BinaryStateIndexIndex for Binary state to assign value to
BinaryStateValueValue to assign for given Binary state

◆ SetBinaryStateSlow()

void FWidgetStateBitfield::SetBinaryStateSlow ( FName  BinaryStateName,
bool  BinaryStateValue 
)

Set Binary state to given value, slow version w/ FName map lookup

◆ SetEnumState() [1/2]

void FWidgetStateBitfield::SetEnumState ( const FWidgetStateBitfield EnumStateBitfield)

Set enum state to given value, clearing all existing values for states in use

Parameters
EnumStateBitfieldstate bitfield, all used states will copy-overwrite current enum state

◆ SetEnumState() [2/2]

void FWidgetStateBitfield::SetEnumState ( uint8  EnumStateIndex,
uint8  EnumStateValue 
)

Set enum state to given value, clearing all existing values for that state

Parameters
EnumStateIndexIndex for enum state to assign value to
EnumStateValueValue to assign for given enum state

◆ SetEnumStateSlow()

void FWidgetStateBitfield::SetEnumStateSlow ( FName  EnumStateName,
uint8  EnumStateValue 
)

Set enum state to given value, clearing all existing values for that state, slow version w/ FName map lookup

◆ SetState()

void FWidgetStateBitfield::SetState ( const FWidgetStateBitfield InBitfield)

Set state to given value, just calls assignment operator for you

◆ Union()

FWidgetStateBitfield FWidgetStateBitfield::Union ( const FWidgetStateBitfield Rhs) const

Union of binary and enum states, allows for a single enum state to have multiple values in a bitfield. Unions will grow enum state set if allowance is same, otherwise the allowed set is maintained. Approximation of bitwise '|'. Commutative.


The documentation for this struct was generated from the following files: