Navigation
API > API/Runtime > API/Runtime/UMG > API/Runtime/UMG/Binding > API/Runtime/UMG/Binding/States
References
| Module | UMG |
| Header | /Engine/Source/Runtime/UMG/Public/Binding/States/WidgetStateBitfield.h |
| Include | #include "Binding/States/WidgetStateBitfield.h" |
Syntax
struct FWidgetStateBitfield
Remarks
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
Constructors
| Type | Name | Description | |
|---|---|---|---|
| Default, will convert to false as a bool | |||
FWidgetStateBitfield
(
const FName InStateName |
Interprets name as binary state on | ||
FWidgetStateBitfield
(
const FName InStateName, |
Interprets name value pair as enum state |
Functions
| Type | Name | Description | |
|---|---|---|---|
| void | ClearEnumState
(
const FWidgetStateBitfield& EnumStateBitfield |
Clear all existing values for given states & mark the states unused | |
| void | ClearEnumState
(
FName EnumStateName |
Clear all existing values for given state & mark the state unused, slow version w/ map lookup | |
| void | ClearEnumState
(
uint8 EnumStateIndex |
Clear all existing values for given state & mark the state unused | |
| bool | HasAllBinaryFlags
(
const FWidgetStateBitfield& InBitfield |
True if all binary state flags are met | |
| bool | HasAllEnumFlags
(
const FWidgetStateBitfield& InBitfield |
True if all enum state flags are met | |
| bool | HasAllFlags
(
const FWidgetStateBitfield& InBitfield |
True if all state flags are met | |
| bool | HasAnyBinaryFlags
(
const FWidgetStateBitfield& InBitfield |
True if any binary state flag is met | |
| bool | HasAnyEnumFlags
(
const FWidgetStateBitfield& InBitfield |
True if any enum state flag is met | |
| bool | HasAnyFlags
(
const FWidgetStateBitfield& InBitfield |
Note: No need for HasNoFlags. Simply call !HasAnyFlags.True if any state flag is met | |
| bool | True if any binary state is set | ||
| bool | True if any enum used enum states are empty, usually indicating a failed '&' test | ||
| bool | True if any enum state is used, does not indicate if state is actually set. | ||
| FWidgetStateBitfield | Intersect
(
const FWidgetStateBitfield& Rhs |
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. | |
| void | Negate only binary states | ||
| void | Negate only enum states, does not change usage, but marks existing values as not allowed | ||
| void | NegateStates () |
Negate both binary and enum states | |
| void | SetBinaryState
(
uint8 BinaryStateIndex, |
Set binary state to given value | |
| void | SetBinaryState
(
const FWidgetStateBitfield& BinaryStateBitfield, |
Set Binary state to given value, using a bitfield to indicate states that should be changed | |
| void | SetBinaryStateSlow
(
FName BinaryStateName, |
Set Binary state to given value, slow version w/ FName map lookup | |
| void | SetEnumState
(
const FWidgetStateBitfield& EnumStateBitfield |
Set enum state to given value, clearing all existing values for states in use | |
| void | SetEnumState
(
uint8 EnumStateIndex, |
Set enum state to given value, clearing all existing values for that state | |
| void | SetEnumStateSlow
(
FName EnumStateName, |
Set enum state to given value, clearing all existing values for that state, slow version w/ FName map lookup | |
| void | SetState
(
const FWidgetStateBitfield& InBitfield |
Set state to given value, just calls assignment operator for you | |
| FWidgetStateBitfield | Union
(
const FWidgetStateBitfield& Rhs |
Union of binary and enum states, allows for a single enum state to have multiple values in a bitfield. |
Operators
| Type | Name | Description | |
|---|---|---|---|
| True if any binary or enum state is set, and no empty used enum states exist | |||
| FWidgetStateBitfield | operator~ () |
Negation of binary and enum states, maintains enum state usage, but marks states as not allowed. |