BlankMat 0.1.0
Free open-source 3D texture creation application
Loading...
Searching...
No Matches
UIInt Class Reference

An integer that can be directly displayed and edited in the UI. More...

Inheritance diagram for UIInt:
Collaboration diagram for UIInt:

Public Member Functions

void Display () override
 Displays the variable as an editable field in the UI.
 
int operator+ (int other) const
 Adds the given value to this value.
 
int operator+ (const UIInt &other) const
 Adds the given value to this value.
 
 UIInt (const std::string &name="", int value=0, ActionStack *actionStack=nullptr, std::function< void()> callback=std::function< void()>(nullptr))
 Creates a new variable that can be displayed and updated directly in the UI.
 
- Public Member Functions inherited from IUIVariable< int >
bool Equals (const int &value) const
 Returns whether the value is equal to the given value.
 
int Get () const
 Returns the current value of this variable.
 
int * 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 int ()
 Explicitly converts this variable to its internal value.
 
int & operator* ()
 Returns a reference to the value stored in this variable.
 
int * operator-> ()
 Returns a reference to the value stored in this variable.
 
std::string Name () const
 Returns the name of the variable.
 
void Set (const int &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 int &newValue)
 Sets the value of the variable to the new value without creating a command.
 

Additional Inherited Members

- Protected Attributes inherited from IUIVariable< int >
std::string mName
 Name of the variable.
 
int mValue
 Value of the variable.
 
ActionStackmActionStack
 Reference to the global action stack.
 
std::function< void()> mSetCallback
 Callback function that runs whenever set is modified.
 

Detailed Description

An integer that can be directly displayed and edited in the UI.

Constructor & Destructor Documentation

◆ UIInt()

UIInt::UIInt ( const std::string &  name = "",
int  value = 0,
ActionStack actionStack = nullptr,
std::function< void()>  callback = std::function<void()>(nullptr) 
)
inlineexplicit

Creates a new variable that can be displayed and updated directly in the UI.

Parameters
nameName of the variable
valueValue to initialize the variable to
actionStackGlobal action stack
callbackCallback function to run when set

Member Function Documentation

◆ Display()

void UIInt::Display ( )
inlineoverridevirtual

Displays the variable as an editable field in the UI.

Implements IUIVariable< int >.

◆ operator+() [1/2]

int UIInt::operator+ ( const UIInt other) const
inline

Adds the given value to this value.

Parameters
otherValue to add
Returns
This + Other

◆ operator+() [2/2]

int UIInt::operator+ ( int  other) const
inline

Adds the given value to this value.

Parameters
otherValue to add
Returns
This + Other