Selector.hpp
Specs for the Selector widget.
A Selector widget provides the user with a pull-down menu. It can be examined at any time (via GetSelectID()) or else alerts call a designated function when a particular option is chosen.
UI::Selector sel(“sel”);
sel.SetOption(“Option 1”); sel.SetOption(“Option B”, TriggerB) ; sel.SetOption(“Option the Third”, [](){ Alert(“3 chosen!”} ); sel.SetOption(“Option IV”);
In this example, the second option will call TriggerB when it is chosen, while the third option will call the provided lambda function.
-
class Selector : public internal::WidgetFacet<Selector>
- #include <Selector.hpp>
Public Types
-
using INFO_TYPE = SelectorInfo
Public Functions
-
inline virtual ~Selector()
-
inline size_t GetSelectID() const
Get the ID of the currently active selection.
-
inline size_t GetNumOptions() const
Get the total number of options setup in the selector.
-
inline const std::string &GetOption(size_t id) const
Get the label associated with a specific option ID.
-
inline bool HasAutofocus() const
Determine if the selector has autofocus.
-
inline bool IsDisabled() const
Is the selector currently disabled?
-
inline Selector &SetOption(const std::string &in_option, const std::function<void()> &in_cb)
Add a new option to the selector and the function to be called if it is chosen.
-
inline Selector &SetOption(const std::string &in_option, const std::function<void()> &in_cb, size_t opt_id)
Add an option to the selector associated with a specific ID (and the function to be called if it is chosen)
-
inline Selector &SetOption(const std::string &in_option)
Set a selector option name, but no function to be called.
Protected Functions
-
inline SelectorInfo *Info()
-
inline const SelectorInfo *Info() const
-
inline Selector(SelectorInfo *in_info)
Friends
- friend class SelectorInfo
-
using INFO_TYPE = SelectorInfo