|
|
| Dropdown (const std::string &textureKey, const std::vector< std::string > &optionLabels) |
| |
|
| Dropdown (const std::string &textureKey) |
| |
|
| Dropdown (const Dropdown &)=delete |
| |
|
Dropdown & | operator= (const Dropdown &)=delete |
| |
| void | AddOption (UIComponent *comp, const std::string &value, UIDirection dir=UIDirection::Down) |
| | Adds an option to the dropdown.
|
| |
| void | SetPosition (float x, float y) |
| | Sets the position of the dropdown.
|
| |
| void | SetScale (float x, float y) |
| | Sets the scale of the dropdown.
|
| |
| void | SetLayer (int layer) override |
| | Sets the layer of the dropdown for rendering.
|
| |
| void | SetOnSelectCommand (int index, UICommand *cmd) |
| | Sets the command to be executed when an option is selected.
|
| |
| Button * | GetMainButton () const |
| | Gets the main button of the dropdown.
|
| |
| UIComponent * | GetComponent (int index) const |
| | Gets the component at the specified index in the Dropdown.
|
| |
| const std::string & | GetSelectedValue () const |
| | Gets the currently selected value.
|
| |
|
virtual | ~UIComponent ()=default |
| | Virtual destructor.
|
| |
| int | GetLayer () const |
| | Gets the rendering layer of the component.
|
| |
| UIComponentType | GetType () const |
| | Gets the type of the UI component.
|
| |
| bool | IsEnabled () const |
| | Returns whether the component is enabled or not.
|
| |
| void | SetEnabled (bool enabled) |
| | Sets the enabled state of the component.
|
| |
| void | SetOwningCanvas (Canvas *canvas) |
| | Gets the owning canvas of the component.
|
| |
|
| void | Render () override |
| | Renders the dropdown and its options.
|
| |
| void | OnPress () override |
| | Handles the press event on the dropdown.
|
| |
| bool | IsMouseOver (float x, float y) override |
| | Checks if the mouse is over the dropdown or its options.
|
| |
|
void | ToggleDropdown () |
| | Toggles the expanded/collapsed state of the dropdown.
|
| |
| void | SelectOption (int index) |
| | Selects the option at the given index.
|
| |
|
void | UpdateOptionTransforms () |
| | Updates the transforms (position/scale) of the dropdown options.
|
| |
| UIComponent * | GetHoveredItem (float x, float y) |
| | Gets the option item currently hovered by the mouse.
|
| |
|
|
Button * | mainButton |
| | The main button that toggles the dropdown.
|
| |
|
UIDropdownCommand * | selectCommand |
| | Command for handling selection/toggle.
|
| |
|
std::vector< UIComponent * > | optionItems |
| | List of option UI components.
|
| |
|
std::vector< std::string > | optionValues |
| | Values associated with each option.
|
| |
|
std::vector< UIDirection > | optionDirs |
| | Directions for positioning each option.
|
| |
|
std::vector< UICommand * > | ownedCommands |
| | Commands owned and managed by the dropdown.
|
| |
|
bool | isExpanded |
| | Whether the dropdown is currently expanded.
|
| |
|
float | posX |
| | X position of the dropdown.
|
| |
|
float | posY |
| | Y position of the dropdown.
|
| |
|
float | scaleX |
| | X scale factor.
|
| |
|
float | scaleY |
| | Y scale factor.
|
| |
|
float | heldX |
| | Last held/clicked X coordinate.
|
| |
|
float | heldY |
| | Last held/clicked Y coordinate.
|
| |
|
std::string | selectedValue |
| | The currently selected value.
|
| |
|
|
bool | Enabled = true |
| | Indicates if the component is enabled or not.
|
| |
|
int | Layer = 0 |
| | Rendering layer in.
|
| |
|
UIComponentType | Type = UIComponentType::None |
| | Type of the UI component.
|
| |
|
Canvas * | pOwningCanvas = nullptr |
| | Pointer to the owning canvas, if any.
|
| |
◆ AddOption()
| void Dropdown::AddOption |
( |
UIComponent * | comp, |
|
|
const std::string & | value, |
|
|
UIDirection | dir = UIDirection::Down ) |
Adds an option to the dropdown.
- Parameters
-
| comp | The UIComponent to add (Button or Dropdown). |
| value | The value associated with this option. |
| dir | The direction in which this option will be positioned relative to the main button. |
◆ GetComponent()
| UIComponent * Dropdown::GetComponent |
( |
int | index | ) |
const |
Gets the component at the specified index in the Dropdown.
- Returns
- Pointer to the UI component.
◆ GetHoveredItem()
| UIComponent * Dropdown::GetHoveredItem |
( |
float | x, |
|
|
float | y ) |
|
private |
Gets the option item currently hovered by the mouse.
- Parameters
-
| x | The x-coordinate of the mouse. |
| y | The y-coordinate of the mouse. |
- Returns
- Pointer to the hovered UIComponent, or nullptr if none.
◆ GetMainButton()
| Button * Dropdown::GetMainButton |
( |
| ) |
const |
Gets the main button of the dropdown.
- Returns
- Pointer to the main button.
◆ GetSelectedValue()
| const std::string & Dropdown::GetSelectedValue |
( |
| ) |
const |
Gets the currently selected value.
- Returns
- The string value.
◆ IsMouseOver()
| bool Dropdown::IsMouseOver |
( |
float | x, |
|
|
float | y ) |
|
overrideprivatevirtual |
Checks if the mouse is over the dropdown or its options.
- Parameters
-
| x | The x-coordinate of the mouse. |
| y | The y-coordinate of the mouse. |
- Returns
- True if the mouse is over the dropdown or its options, false otherwise.
Implements UIComponent.
◆ OnPress()
| void Dropdown::OnPress |
( |
| ) |
|
|
overrideprivatevirtual |
Handles the press event on the dropdown.
Implements UIComponent.
◆ Render()
| void Dropdown::Render |
( |
| ) |
|
|
overrideprivatevirtual |
Renders the dropdown and its options.
Implements UIComponent.
◆ SelectOption()
| void Dropdown::SelectOption |
( |
int | index | ) |
|
|
private |
Selects the option at the given index.
- Parameters
-
| index | The index of the option to select. |
◆ SetLayer()
| void Dropdown::SetLayer |
( |
int | layer | ) |
|
|
overridevirtual |
Sets the layer of the dropdown for rendering.
- Parameters
-
| layer | The layer to set the dropdown to. |
Reimplemented from UIComponent.
◆ SetOnSelectCommand()
| void Dropdown::SetOnSelectCommand |
( |
int | index, |
|
|
UICommand * | cmd ) |
Sets the command to be executed when an option is selected.
- Parameters
-
| index | The index of the option. |
| cmd | The command to execute on selection. |
◆ SetPosition()
| void Dropdown::SetPosition |
( |
float | x, |
|
|
float | y ) |
Sets the position of the dropdown.
- Parameters
-
| x | The x-coordinate of the dropdown's position. |
| y | The y-coordinate of the dropdown's position. |
◆ SetScale()
| void Dropdown::SetScale |
( |
float | x, |
|
|
float | y ) |
Sets the scale of the dropdown.
- Parameters
-
| x | The x-scale factor. |
| y | The y-scale factor. |
The documentation for this class was generated from the following files: