13#include "platforms/ui_defs.h"
15#ifndef FASTLED_HAS_UI_DROPDOWN
16#define FASTLED_HAS_UI_DROPDOWN 0
21#if !FASTLED_HAS_UI_DROPDOWN
31 for (fl::size i = 0; i < options.
size(); ++i) {
39 template<
typename Iterator>
43 for (Iterator it =
begin; it !=
end; ++it) {
54 for (fl::size i = 0; i < options.
size(); ++i) {
65 for (
const auto& option : options) {
85 if (index >= 0 && index <
static_cast<int>(
mOptions.size())) {
105 for (fl::size i = 0; i < count; ++i) {
131 mImpl.setSelectedIndex(index);
151 int currentIndex =
as_int();
152 int nextIndex = (currentIndex + 1) %
static_cast<int>(
getOptionCount());
158 mImpl.setGroup(groupName);
static void removeListener(Listener *listener) FL_NOEXCEPT
static void addListener(Listener *listener, int priority=0) FL_NOEXCEPT
UIDropdown(const char *name, fl::initializer_list< fl::string > options) FL_NOEXCEPT
fl::string as_string() const FL_NOEXCEPT
fl::string getOption(fl::size index) const FL_NOEXCEPT
FL_NO_COPY(UIDropdown) UIDropdown(const char *name
function_list< void(UIDropdown &)> mCallbacks
fl::shared_ptr< IButtonInput > mNextButton
bool mLastFrameValueValid
fl::string value() const FL_NOEXCEPT
void setSelectedIndex(int index) FL_NOEXCEPT
void setGroup(const fl::string &groupName) FL_NOEXCEPT override
void addNextButton(int pin) FL_NOEXCEPT
fl::size getOptionCount() const FL_NOEXCEPT
int as_int() const FL_NOEXCEPT
fl::span< fl::string > options FL_NOEXCEPT
void clearCallbacks() FL_NOEXCEPT
UIDropdown & operator=(int index) FL_NOEXCEPT
void nextOption() FL_NOEXCEPT
int onChanged(function< void(UIDropdown &)> callback) FL_NOEXCEPT
UIDropdownImpl(const fl::string &name, const fl::string *options, fl::size count)
UIDropdownImpl(const fl::string &name, fl::initializer_list< fl::string > options)
void setSelectedIndex(int index)
UIDropdownImpl(const fl::string &name, const fl::vector< fl::string > &options)
UIDropdownImpl(const fl::string &name, fl::span< fl::string > options)
~UIDropdownImpl() FL_NOEXCEPT
void setGroup(const fl::string &groupName)
fl::size getOptionCount() const
UIDropdownImpl(const fl::string &name, Iterator begin, Iterator end)
fl::vector< fl::string > mOptions
UIDropdownImpl(const fl::string &name, const fl::string(&options)[N])
fl::string getOption(fl::size index) const
virtual void setGroup(const fl::string &groupName) FL_NOEXCEPT
constexpr fl::size size() const FL_NOEXCEPT
fl::size size() const FL_NOEXCEPT
#define FASTLED_UI_DEFINE_OPERATORS(UI_CLASS)
constexpr T * begin(T(&array)[N]) FL_NOEXCEPT
constexpr T * end(T(&array)[N]) FL_NOEXCEPT
Base definition for an LED controller.
#define FASTLED_UNUSED(x)
Listener(UIDropdown *owner) FL_NOEXCEPT
void addToEngineEventsOnce() FL_NOEXCEPT
void onBeginFrame() FL_NOEXCEPT override