Skip to Content
⚠ Under Construction
ReferenceC++ APIDropdown

endstone::Dropdown

Represents a dropdown with a set of predefined options.

Functions:

NameDescription
Dropdown
Dropdown
addOptionAdds a new option to the dropdown.
getDefaultIndexGets the default index of the dropdown.
getLabelGets the label of the dropdown.
getOptionsGets the options of the dropdown.
setDefaultIndexSets the default index of the dropdown.
setLabelSets the label of the dropdown.
setOptionsSets the options of the dropdown.
Dropdown() = default
Dropdown(Message label, std::vector<std::string> options, std::optional<int> default_index = std::nullopt)

addOption

Dropdown &addOption(const std::string &option)

Adds a new option to the dropdown.

Parameters:

  • option The new option for the dropdown.

Returns:

A reference to the dropdown itself.

getDefaultIndex

std::optional<int> getDefaultIndex() const

Gets the default index of the dropdown.

Returns:

The default index of the dropdown.

getLabel

Message getLabel() const

Gets the label of the dropdown.

Returns:

The label of the dropdown.

getOptions

std::vector<std::string> getOptions() const

Gets the options of the dropdown.

Returns:

The options of the dropdown.

setDefaultIndex

Dropdown &setDefaultIndex(std::optional<int> default_index)

Sets the default index of the dropdown.

Parameters:

  • default_index The new default index for the dropdown.

Returns:

A reference to the dropdown itself.

setLabel

Dropdown &setLabel(Message label)

Sets the label of the dropdown.

Parameters:

  • label The new label for the dropdown.

Returns:

A reference to the dropdown itself.

setOptions

Dropdown &setOptions(std::vector<std::string> options)

Sets the options of the dropdown.

Parameters:

  • options The new options for the dropdown.

Returns:

A reference to the dropdown itself.

Last updated on