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() = defaultButton(Message text, std::optional<std::string> icon = std::nullopt,
OnClickCallback on_click = {}) getIcon
std::optional<std::string> getIcon() constGet the icon of the button.
Returns:
The path or URL to the icon file
getOnClick
OnClickCallback getOnClick() constGets the on click callback of the button.
Returns:
The on click callback of the button.
getText
Message getText() constGets the text of the button.
Returns:
The text.
setIcon
Button &setIcon(std::string icon)Sets the icon for the button.
Parameters:
iconThe 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_clickThe callback to be set.
Returns:
A reference to the current button.
setText
Button &setText(Message text)Sets the text of the button.
Parameters:
textThe new text for the button.
Returns:
A reference to the current button.
Last updated on