Skip to Content
⚠ Under Construction
ReferenceC++ APIModalForm

endstone::ModalForm

Represents a modal form with controls.

Bases: endstone::Form< ModalForm >

Types:

Functions:

NameDescription
addControlAdds a control to the form.
getControlsGets the controls of the modal form.
getIconGet the icon of the form.
getOnSubmitGets the on submit callback of the form.
getSubmitButtonGets the submit button text of the form.
setControlsSets the controls of the modal form.
setIconSets the icon of the form.
setOnSubmitSets the on submit callback of the form.
setSubmitButtonSets 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.

Last updated on