// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #pragma once #include #include #include #include #include #include namespace gui { class TimerProperty; class IntervalBox : public HBox { TimerProperty *timerSetter = nullptr; TextSpinnerBoxWithLabel *chimeSpinner = nullptr; void build(); void updateIntervals(); [[nodiscard]] std::string intervalToString(std::chrono::minutes time); [[nodiscard]] std::chrono::minutes stringToInterval(const std::string &description); void rescaleIntervals(); public: using OnChangeCallback = std::function; IntervalBox(Item *parent, uint32_t x, uint32_t y, uint32_t w, uint32_t h, TimerProperty *timerSetter); [[nodiscard]] std::chrono::seconds getIntervalValue() noexcept; bool setIntervalValue(std::chrono::minutes newValue); void setOnChangeCallback(OnChangeCallback &callback); }; } // namespace gui