mirror of
https://github.com/mudita/MuditaOS.git
synced 2026-04-23 08:33:48 -04:00
Display and keypad setting cleanup. Moved settings window Names to separate file. Added selective build options. Fixed SpinBox arrows position. Fixed focus on window start in InputLanguageWindow and KeypadLightWindow. Moved AutoLock to Security. Disabled not working options in UI.
38 lines
1.6 KiB
C++
38 lines
1.6 KiB
C++
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
|
|
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
|
|
|
|
#include "SpinBoxOptionSettings.hpp"
|
|
|
|
#include <widgets/SpinBox.hpp>
|
|
|
|
namespace gui
|
|
{
|
|
SpinBoxOptionSettings::SpinBoxOptionSettings(UTF8 text,
|
|
std::uint8_t value,
|
|
std::uint8_t maxValue,
|
|
std::function<bool(uint8_t)> updateCallback,
|
|
std::function<bool(Item &)> focusChangedCallback)
|
|
: option::OptionSettings(text, nullptr, focusChangedCallback, nullptr),
|
|
updateCallback(std::move(updateCallback)), maxValue(maxValue), value(value)
|
|
{}
|
|
|
|
auto SpinBoxOptionSettings::build() const -> ListItem *
|
|
{
|
|
auto spinBox = new SpinBox(nullptr, text, updateCallback, maxValue, value);
|
|
|
|
auto optionItem = new gui::ListItem();
|
|
optionItem->setMinimumSize(style::window::default_body_width, style::window::label::big_h);
|
|
optionItem->inputCallback = spinBox->inputCallback;
|
|
optionItem->focusChangedCallback = [spinBox](Item &item) { return spinBox->focusChangedCallback(item); };
|
|
optionItem->dimensionChangedCallback = [spinBox](gui::Item &, const BoundingBox &newDim) -> bool {
|
|
spinBox->setPosition(0, 0);
|
|
spinBox->setSize(newDim.w, newDim.h);
|
|
return true;
|
|
};
|
|
|
|
optionItem->addWidget(spinBox);
|
|
|
|
return optionItem;
|
|
}
|
|
} // namespace gui
|