Class endstone::ModalForm¶
ClassList > endstone > ModalForm
Represents a modal form with controls.
#include <endstone/form/modal_form.h>
Inherits the following classes: endstone::Form
Public Types¶
| Type | Name |
|---|---|
| typedef std::variant< Dropdown, Label, Slider, StepSlider, TextInput, Toggle > | Control |
| typedef std::function< void(Player *, std::string)> | OnSubmitCallback |
Public Types inherited from endstone::Form¶
See endstone::Form
| Type | Name |
|---|---|
| typedef std::function< void(Player *)> | OnCloseCallback |
Public Functions¶
| Type | Name |
|---|---|
| ModalForm & | addControl (const Control & control) Adds a control to the form. |
| std::vector< Control > | getControls () const Gets the controls of the modal form. |
| std::optional< std::string > | getIcon () const Get the icon of the form. |
| OnSubmitCallback | getOnSubmit () const Gets the on submit callback of the form. |
| std::optional< Message > | getSubmitButton () const Gets the submit button text of the form. |
| ModalForm & | setControls (std::vector< Control > controls) Sets the controls of the modal form. |
| ModalForm & | setIcon (std::optional< std::string > icon) Sets the icon of the form. |
| ModalForm & | setOnSubmit (OnSubmitCallback on_submit) Sets the on submit callback of the form. |
| ModalForm & | setSubmitButton (std::optional< Message > text) Sets the submit button text 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¶
using endstone::ModalForm::Control = std::variant<Dropdown, Label, Slider, StepSlider, TextInput, Toggle>;
typedef OnSubmitCallback¶
Public Functions Documentation¶
function addControl¶
Adds a control to the form.
Parameters:
controlThe control to add to the form.
Returns:
A reference to the current form.
function getControls¶
Gets the controls of the modal form.
Returns:
A list of controls in the modal form.
function getIcon¶
Get the icon of the form.
Returns:
The path or URL to the icon file
function getOnSubmit¶
Gets the on submit callback of the form.
Returns:
The on submit callback of the form.
function getSubmitButton¶
Gets the submit button text of the form.
Returns:
The submit button text of the form.
function setControls¶
Sets the controls of the modal form.
Parameters:
controlsThe list of controls to set.
Returns:
A reference to the current form.
function setIcon¶
Sets the icon of the form.
Parameters:
iconThe path or URL to the icon file.
Returns:
A reference to the current form.
function setOnSubmit¶
Sets the on submit callback of the form.
Parameters:
on_submitThe callback to be set.
Returns:
A reference to the current form.
function setSubmitButton¶
Sets the submit button text of the form.
Parameters:
textThe submit button text to set.
Returns:
A reference to the current form.
The documentation for this class was generated from the following file include/endstone/form/modal_form.h