![]() |
BlankMat 0.1.0
Free open-source 3D texture creation application
|
Class to store a variable that can be edited in the UI. This class sends a Command to the ActionStack whenever the value of the variable is changed. More...
Public Member Functions | |
virtual void | Display ()=0 |
Displays the variable as an editable field in the UI. Each variable type needs to handle this differently, so this method must be overridden by implementations. | |
bool | Equals (const T &value) const |
Returns whether the value is equal to the given value. | |
T | Get () const |
Returns the current value of this variable. | |
T * | GetRef () const |
Returns a reference to the value stored in this variable. This is unsafe, but is necessary for Commands outside of the class to update the value. | |
operator T () | |
Explicitly converts this variable to its internal value. | |
T & | operator* () |
Returns a reference to the value stored in this variable. | |
T * | operator-> () |
Returns a reference to the value stored in this variable. | |
std::string | Name () const |
Returns the name of the variable. | |
void | Set (const T &newValue) |
Sets the value of the variable to the new value only if it is different. Sends a Command to the action stack indicating the changed value. | |
void | SetNoUpdate (const T &newValue) |
Sets the value of the variable to the new value without creating a command. | |
Protected Attributes | |
std::string | mName = "" |
Name of the variable. | |
T | mValue |
Value of the variable. | |
ActionStack * | mActionStack = nullptr |
Reference to the global action stack. | |
std::function< void()> | mSetCallback |
Callback function that runs whenever set is modified. | |
Class to store a variable that can be edited in the UI. This class sends a Command to the ActionStack whenever the value of the variable is changed.
T | Type of variable to store |
|
pure virtual |
|
inline |
Returns whether the value is equal to the given value.
value | Value to check |
|
inline |
Returns the current value of this variable.
|
inline |
Returns a reference to the value stored in this variable. This is unsafe, but is necessary for Commands outside of the class to update the value.
|
inline |
Returns the name of the variable.
|
inline |
Explicitly converts this variable to its internal value.
|
inline |
Returns a reference to the value stored in this variable.
|
inline |
Returns a reference to the value stored in this variable.
|
inline |
Sets the value of the variable to the new value only if it is different. Sends a Command to the action stack indicating the changed value.
newValue | New value to set it to |
|
inline |
Sets the value of the variable to the new value without creating a command.
newValue | New value to set it to |
|
protected |
Reference to the global action stack.
|
protected |
Name of the variable.
|
protected |
Callback function that runs whenever set is modified.
|
protected |
Value of the variable.