Skip to content

Class endstone::ActionForm::Button

ClassList > endstone > ActionForm > Button

Represents a button with text and an optional icon.

  • #include <endstone/form/action_form.h>

Public Types

Type Name
typedef std::function< void(Player *)> OnClickCallback

Public Functions

Type Name
Button () = default
Button (Message text, std::optional< std::string > icon=std::nullopt, OnClickCallback on_click={})
std::optional< std::string > getIcon () const
Get the icon of the button.
OnClickCallback getOnClick () const
Gets the on click callback of the button.
Message getText () const
Gets the text of the button.
Button & setIcon (std::string icon)
Sets the icon for the button.
Button & setOnClick (OnClickCallback on_click)
Sets the on click callback of the button.
Button & setText (Message text)
Sets the text of the button.

Public Types Documentation

typedef OnClickCallback

using endstone::ActionForm::Button::OnClickCallback =  std::function<void(Player *)>;

Public Functions Documentation

function Button [½]

endstone::ActionForm::Button::Button () = default

function Button [2/2]

inline explicit endstone::ActionForm::Button::Button (
    Message text,
    std::optional< std::string > icon=std::nullopt,
    OnClickCallback on_click={}
) 

function getIcon

Get the icon of the button.

inline std::optional< std::string > endstone::ActionForm::Button::getIcon () const

Returns:

The path or URL to the icon file


function getOnClick

Gets the on click callback of the button.

inline OnClickCallback endstone::ActionForm::Button::getOnClick () const

Returns:

The on click callback of the button.


function getText

Gets the text of the button.

inline Message endstone::ActionForm::Button::getText () const

Returns:

The text.


function setIcon

Sets the icon for the button.

inline Button & endstone::ActionForm::Button::setIcon (
    std::string icon
) 

Parameters:

  • icon The path or URL to the icon file.

Returns:

A reference to the current button.


function setOnClick

Sets the on click callback of the button.

inline Button & endstone::ActionForm::Button::setOnClick (
    OnClickCallback on_click
) 

Parameters:

  • on_click The callback to be set.

Returns:

A reference to the current button.


function setText

Sets the text of the button.

inline Button & endstone::ActionForm::Button::setText (
    Message text
) 

Parameters:

  • text The new text for the button.

Returns:

A reference to the current button.



The documentation for this class was generated from the following file include/endstone/form/action_form.h