Class endstone::ActionForm¶
ClassList > endstone > ActionForm
Represents a form with buttons that let the player take action.
#include <endstone/form/action_form.h>
Inherits the following classes: endstone::Form
Public Types¶
Type | Name |
---|---|
typedef std::variant< Button, Divider, Header, Label > | Control |
typedef std::function< void(Player *, int)> | OnSubmitCallback |
Public Types inherited from endstone::Form¶
See endstone::Form
Type | Name |
---|---|
typedef std::function< void(Player *)> | OnCloseCallback |
Public Functions¶
Type | Name |
---|---|
ActionForm () = default |
|
ActionForm & | addButton (const Message & text, const std::optional< std::string > & icon=std::nullopt, Button::OnClickCallback on_click={}) Adds a button to the form. |
ActionForm & | addDivider () Adds a divider to the form. |
ActionForm & | addHeader (const Message & text) Adds a header to the form. |
ActionForm & | addLabel (const Message & text) Adds a label to the form. |
Message | getContent () const Get the content of the form. |
const std::vector< Control > & | getControls () const Get the controls of the action form. |
OnSubmitCallback | getOnSubmit () const Gets the on submit callback of the form. |
ActionForm & | setContent (Message text) Set the content of the form. |
ActionForm & | setControls (const std::vector< Control > & controls) Set the controls of the action form. |
ActionForm & | setOnSubmit (OnSubmitCallback on_submit) Sets the on submit callback of the form. |
Public Functions inherited from endstone::Form¶
See endstone::Form
Type | Name |
---|---|
Form () = default |
|
OnCloseCallback | getOnClose () const Gets the on close callback of the form. |
Message | getTitle () const Gets the title of the form. |
T & | setOnClose (OnCloseCallback on_close) Sets the on close callback of the form. |
T & | setTitle (Message title) Sets the title of the form. |
Protected Attributes inherited from endstone::Form¶
See endstone::Form
Type | Name |
---|---|
OnCloseCallback | on_close_ |
Message | title_ |
Public Types Documentation¶
typedef Control¶
typedef OnSubmitCallback¶
Public Functions Documentation¶
function ActionForm¶
function addButton¶
Adds a button to the form.
inline ActionForm & endstone::ActionForm::addButton (
const Message & text,
const std::optional< std::string > & icon=std::nullopt,
Button::OnClickCallback on_click={}
)
Parameters:
text
The text of the buttonicon
The path or URL to the icon imageon_click
The on click callback of the button
Returns:
A reference to the current form.
function addDivider¶
Adds a divider to the form.
Returns:
A reference to the current form.
function addHeader¶
Adds a header to the form.
Parameters:
text
The text of the header
Returns:
A reference to the current form.
function addLabel¶
Adds a label to the form.
Parameters:
text
The text of the label
Returns:
A reference to the current form.
function getContent¶
Get the content of the form.
Returns:
The content of the form.
function getControls¶
Get the controls of the action form.
Returns:
A list of controls in the action form.
function getOnSubmit¶
Gets the on submit callback of the form.
Returns:
The on submit callback of the form.
function setContent¶
Set the content of the form.
Parameters:
text
The text to set as the content.
Returns:
A reference to the current form.
function setControls¶
Set the controls of the action form.
Parameters:
controls
The list of controls to set.
Returns:
A reference to the current form.
function setOnSubmit¶
Sets the on submit callback of the form.
Parameters:
on_submit
The callback to be set.
Returns:
A reference to the current form.
The documentation for this class was generated from the following file include/endstone/form/action_form.h