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
Classes¶
Type | Name |
---|---|
class | Button Represents a button with text and an optional icon. |
Public Types¶
Type | Name |
---|---|
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. |
const std::vector< Button > & | getButtons () const Get the buttons of the action form. |
Message | getContent () const Get the content of the form. |
OnSubmitCallback | getOnSubmit () const Gets the on submit callback of the form. |
ActionForm & | setButtons (const std::vector< Button > & buttons) Set the buttons of the action form. |
ActionForm & | setContent (Message text) Set the content of the 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 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 getButtons¶
Get the buttons of the action form.
Returns:
A list of buttons in the action form.
function getContent¶
Get the content of the form.
Returns:
The content of the form.
function getOnSubmit¶
Gets the on submit callback of the form.
Returns:
The on submit callback of the form.
function setButtons¶
Set the buttons of the action form.
Parameters:
buttons
The list of buttons to set.
Returns:
A reference to the current 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 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