M module-apps/apps-common/widgets/BellBaseLayout.cpp => module-apps/apps-common/widgets/BellBaseLayout.cpp +2 -0
@@ 123,5 123,7 @@ namespace gui
{
setArrowVisible(BellBaseLayout::Arrow::Left, !minCondition);
setArrowVisible(BellBaseLayout::Arrow::Right, !maxCondition);
+ centerThreeBox->firstBox->resizeItems();
+ centerThreeBox->lastBox->resizeItems();
}
} // namespace gui
M products/BellHybrid/apps/common/include/common/widgets/ListItems.hpp => products/BellHybrid/apps/common/include/common/widgets/ListItems.hpp +4 -0
@@ 41,6 41,8 @@ namespace gui
private:
UIntegerSpinner *spinner{};
+
+ void setArrowsVisibility(UIntegerSpinner::Range range);
};
class NumWithStringListItem : public BellSideListItemWithCallbacks
@@ 61,6 63,8 @@ namespace gui
TextFixedSize *bottomText{};
const UTF8 offStr;
const UTF8 minStr;
+
+ void setArrowsVisibility(const NumWithStringSpinner::Range &range);
};
class UTF8ListItem : public BellSideListItemWithCallbacks
M products/BellHybrid/apps/common/src/widgets/ListItems.cpp => products/BellHybrid/apps/common/src/widgets/ListItems.cpp +26 -1
@@ 54,6 54,15 @@ namespace gui
getValue = [&model, this]() { model.setValue(spinner->getCurrentValue()); };
setValue = [&model, this]() { spinner->setCurrentValue(model.getValue()); };
+
+ setValue();
+ setArrowsVisibility(range);
+
+ inputCallback = [&, range](Item &item, const InputEvent &event) {
+ auto ret = body->onInput(event);
+ setArrowsVisibility(range);
+ return ret;
+ };
}
void NumListItem::setOnValueChanged(std::function<void(const UIntegerSpinner::Type &)> &&cb)
{
@@ 64,6 73,12 @@ namespace gui
return spinner->getCurrentValue();
}
+ void NumListItem::setArrowsVisibility(UIntegerSpinner::Range range)
+ {
+ const auto selectedVal = spinner->getCurrentValue();
+ body->setMinMaxArrowsVisibility(selectedVal == range.min, selectedVal == range.max);
+ }
+
NumWithStringListItem::NumWithStringListItem(AbstractSettingsModel<std::uint8_t> &model,
NumWithStringSpinner::Range range,
const std::string &topDescription,
@@ 87,9 102,10 @@ namespace gui
bottomText->setText(bottomDescription);
bottomText->drawUnderline(false);
- inputCallback = [&](Item &item, const InputEvent &event) {
+ inputCallback = [&, range](Item &item, const InputEvent &event) {
const auto result = body->onInput(event);
bottomText->setVisible(spinner->getCurrentValue().getValue().has_value());
+ setArrowsVisibility(range);
return result;
};
@@ 112,6 128,9 @@ namespace gui
spinner->setCurrentValue(Value{minStr});
}
};
+
+ setValue();
+ setArrowsVisibility(range);
}
bool NumWithStringListItem::isOff() const
@@ 119,6 138,12 @@ namespace gui
return not spinner->getCurrentValue().getValue().has_value();
}
+ void NumWithStringListItem::setArrowsVisibility(const NumWithStringSpinner::Range &range)
+ {
+ const auto selectedVal = spinner->getCurrentValue();
+ body->setMinMaxArrowsVisibility(selectedVal == range.front(), selectedVal == range.back());
+ }
+
UTF8ListItem::UTF8ListItem(AbstractSettingsModel<UTF8> &model,
UTF8Spinner::Range range,
const std::string &topDescription)