Skip to Content
⚠ Under Construction
ReferenceC++ APIButton

endstone::Button

Represents a button with text and an optional icon.

Types:

NameDescription
OnClickCallback

Functions:

NameDescription
Button
Button
getIconGet the icon of the button.
getOnClickGets the on click callback of the button.
getTextGets the text of the button.
setIconSets the icon for the button.
setOnClickSets the on click callback of the button.
setTextSets 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