endstone::Button
Represents a button with text and an optional icon.
Types:
Name | Description |
---|---|
OnClickCallback |
Functions:
Name | Description |
---|---|
Button | |
Button | |
getIcon | Get the icon of the button. |
getOnClick | Gets the on click callback of the button. |
getText | Gets the text of the button. |
setIcon | Sets the icon for the button. |
setOnClick | Sets the on click callback of the button. |
setText | Sets the text of the button. |
OnClickCallback
using endstone::Button::OnClickCallback = std::function<void(Player *)>;
Button
Button() = default
Button(Message text, std::optional<std::string> icon = std::nullopt,
OnClickCallback on_click = {})
getIcon
std::optional<std::string> getIcon() const
Get the icon of the button.
Returns:
The path or URL to the icon file
getOnClick
OnClickCallback getOnClick() const
Gets the on click callback of the button.
Returns:
The on click callback of the button.
getText
Message getText() const
Gets the text of the button.
Returns:
The text.
setIcon
Button &setIcon(std::string icon)
Sets the icon for the button.
Parameters:
icon
The path or URL to the icon file.
Returns:
A reference to the current button.
setOnClick
Button &setOnClick(OnClickCallback on_click)
Sets the on click callback of the button.
Parameters:
on_click
The callback to be set.
Returns:
A reference to the current button.
setText
Button &setText(Message text)
Sets the text of the button.
Parameters:
text
The new text for the button.
Returns:
A reference to the current button.
Last updated on