Skip to content

Class endstone::Dropdown

ClassList > endstone > Dropdown

Represents a dropdown with a set of predefined options.

  • #include <endstone/form/controls/dropdown.h>

Inherited by the following classes: endstone::StepSlider

Public Functions

Type Name
Dropdown () = default
Dropdown (Message label, std::vector< std::string > options, std::optional< int > default_index=std::nullopt)
Dropdown & addOption (const std::string & option)
Adds a new option to the dropdown.
std::optional< int > getDefaultIndex () const
Gets the default index of the dropdown.
Message getLabel () const
Gets the label of the dropdown.
std::vector< std::string > getOptions () const
Gets the options of the dropdown.
Dropdown & setDefaultIndex (std::optional< int > default_index)
Sets the default index of the dropdown.
Dropdown & setLabel (Message label)
Sets the label of the dropdown.
Dropdown & setOptions (std::vector< std::string > options)
Sets the options of the dropdown.

Public Functions Documentation

function Dropdown [½]

endstone::Dropdown::Dropdown () = default

function Dropdown [2/2]

inline explicit endstone::Dropdown::Dropdown (
    Message label,
    std::vector< std::string > options,
    std::optional< int > default_index=std::nullopt
) 

function addOption

Adds a new option to the dropdown.

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

Parameters:

  • option The new option for the dropdown.

Returns:

A reference to the dropdown itself.


function getDefaultIndex

Gets the default index of the dropdown.

inline std::optional< int > endstone::Dropdown::getDefaultIndex () const

Returns:

The default index of the dropdown.


function getLabel

Gets the label of the dropdown.

inline Message endstone::Dropdown::getLabel () const

Returns:

The label of the dropdown.


function getOptions

Gets the options of the dropdown.

inline std::vector< std::string > endstone::Dropdown::getOptions () const

Returns:

The options of the dropdown.


function setDefaultIndex

Sets the default index of the dropdown.

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

Parameters:

  • default_index The new default index for the dropdown.

Returns:

A reference to the dropdown itself.


function setLabel

Sets the label of the dropdown.

inline Dropdown & endstone::Dropdown::setLabel (
    Message label
) 

Parameters:

  • label The new label for the dropdown.

Returns:

A reference to the dropdown itself.


function setOptions

Sets the options of the dropdown.

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

Parameters:

  • options The new options for the dropdown.

Returns:

A reference to the dropdown itself.



The documentation for this class was generated from the following file include/endstone/form/controls/dropdown.h