endstone::ModalForm
Represents a modal form with controls.
Bases: endstone::Form< ModalForm >
Types:
Name | Description |
---|---|
Control | |
OnSubmitCallback |
Functions:
Name | Description |
---|---|
addControl | Adds a control to the form. |
getControls | Gets the controls of the modal form. |
getIcon | Get the icon of the form. |
getOnSubmit | Gets the on submit callback of the form. |
getSubmitButton | Gets the submit button text of the form. |
setControls | Sets the controls of the modal form. |
setIcon | Sets the icon of the form. |
setOnSubmit | Sets the on submit callback of the form. |
setSubmitButton | Sets the submit button text of the form. |
Control
using endstone::ModalForm::Control =
std::variant<Dropdown, Label, Slider, StepSlider, TextInput, Toggle,
Divider, Header>;
OnSubmitCallback
using endstone::ModalForm::OnSubmitCallback =
std::function<void(Player *, std::string)>;
addControl
ModalForm &addControl(const Control &control)
Adds a control to the form.
Parameters:
control
The control to add to the form.
Returns:
A reference to the current form.
getControls
std::vector<Control> getControls() const
Gets the controls of the modal form.
Returns:
A list of controls in the modal form.
getIcon
std::optional<std::string> getIcon() const
Get the icon of the form.
Returns:
The path or URL to the icon file
getOnSubmit
OnSubmitCallback getOnSubmit() const
Gets the on submit callback of the form.
Returns:
The on submit callback of the form.
getSubmitButton
std::optional<Message> getSubmitButton() const
Gets the submit button text of the form.
Returns:
The submit button text of the form.
setControls
ModalForm &setControls(std::vector<Control> controls)
Sets the controls of the modal form.
Parameters:
controls
The list of controls to set.
Returns:
A reference to the current form.
setIcon
ModalForm &setIcon(std::optional<std::string> icon)
Sets the icon of the form.
Parameters:
icon
The path or URL to the icon file.
Returns:
A reference to the current form.
setOnSubmit
ModalForm &setOnSubmit(OnSubmitCallback on_submit)
Sets the on submit callback of the form.
Parameters:
on_submit
The callback to be set.
Returns:
A reference to the current form.
setSubmitButton
ModalForm &setSubmitButton(std::optional<Message> text)
Sets the submit button text of the form.
Parameters:
text
The submit button text to set.
Returns:
A reference to the current form.