#include <Widget/Layout/CompoundWidget/DataChannelPicker/DataChannelPicker.hpp>
#include <Widget/Layout/Row/Row.hpp>
#include <Widget/IconToggle/IconToggle.hpp>

DataChannelPicker::DataChannelPicker(std::optional<DataLink::Channel> &selection, std::function<void()> onChanged) : CompoundWidget(
    new Row(
        (new IconToggle(selection, {}, Material::none))->withChangedCallback(onChanged),
        (new IconToggle(selection, std::optional(DataLink::Channel::Red), Material::redChannel))->withChangedCallback(onChanged),
        (new IconToggle(selection, std::optional(DataLink::Channel::Green), Material::greenChannel))->withChangedCallback(onChanged),
        (new IconToggle(selection, std::optional(DataLink::Channel::Blue), Material::blueChannel))->withChangedCallback(onChanged),
        (new IconToggle(selection, std::optional(DataLink::Channel::Magenta), Material::magentaChannel))->withChangedCallback(onChanged)
    )
)
{}