Abstract base class for UI-related command objects. More...
#include <UICommand.h>
Public Member Functions | |
void | Execute () override=0 |
Pure virtual method to execute the command. Must be implemented by derived classes. | |
virtual | ~UICommand () override=default |
Virtual destructor. | |
void | SetUIComponent (UIComponent *p, UIComponentType t) |
Associates this command with a UIComponent and its type. | |
UIComponent * | GetUIComponent () const |
Gets the associated UIComponent. | |
UIComponentType | GetType () const |
Gets the type of the associated UIComponent. | |
![]() | |
virtual | ~CommandBase ()=default |
Destructor for CommandBase. | |
Private Attributes | |
UIComponentType | Type = UIComponentType::None |
Type of the associated UIComponent. | |
UIComponent * | pUIComponent = nullptr |
Pointer to the associated UIComponent. | |
Friends | |
class | UIAttorney::GameLoop |
Abstract base class for UI-related command objects.
The UICommand class defines the interface for commands that can be executed by UI components (such as Button, Slider, Dropdown, etc.). It inherits from CommandBase and provides a mechanism to associate the command with a specific UIComponent and its type. Derived classes must implement the Execute() method to define the command's behavior.
Example usage:
|
overridepure virtual |
Pure virtual method to execute the command. Must be implemented by derived classes.
Implements CommandBase.
Implemented in UIDropdownCommand.
UIComponentType UICommand::GetType | ( | ) | const |
Gets the type of the associated UIComponent.
UIComponent * UICommand::GetUIComponent | ( | ) | const |
Gets the associated UIComponent.
void UICommand::SetUIComponent | ( | UIComponent * | p, |
UIComponentType | t ) |
Associates this command with a UIComponent and its type.
p | Pointer to the UIComponent. |
t | The UIComponentType. |