M module-apps/apps-common/widgets/BellBaseLayout.cpp => module-apps/apps-common/widgets/BellBaseLayout.cpp +40 -16
@@ 6,7 6,13 @@
namespace gui
{
- BellBaseLayout::BellBaseLayout(Item *parent, Position x, Position y, Length w, Length h, bool withSideArrows)
+ BellBaseLayout::BellBaseLayout(Item *parent,
+ Position x,
+ Position y,
+ Length w,
+ Length h,
+ bool withSideArrows,
+ style::bell_base_layout::ParentType type)
: VThreeBox(parent, x, y, w, h)
{
setMinimumSize(style::bell_base_layout::w, style::bell_base_layout::h);
@@ 14,7 20,7 @@ namespace gui
setEdges(RectangleEdge::None);
firstBox = new VBox(this);
- firstBox->setMinimumSize(style::bell_base_layout::w, style::bell_base_layout::first_layout_min_h);
+ firstBox->setMinimumSize(style::bell_base_layout::outer_layouts_w, style::bell_base_layout::first_layout_min_h);
firstBox->setMaximumHeight(style::bell_base_layout::outer_layouts_h);
firstBox->setAlignment(Alignment(gui::Alignment::Horizontal::Center));
firstBox->setEdges(RectangleEdge::None);
@@ 23,19 29,23 @@ namespace gui
centerBox = new VBox(this);
centerBox->setEdges(RectangleEdge::None);
centerBox->setAlignment(Alignment(gui::Alignment::Horizontal::Center, gui::Alignment::Vertical::Center));
- centerBox->setMinimumSize(style::bell_base_layout::w, style::bell_base_layout::centerbox::h);
-
- if (withSideArrows) {
- addSideArrows();
- }
+ centerBox->setMinimumSize(style::bell_base_layout::w, style::bell_base_layout::center_layout_h);
lastBox = new VBox(this);
- lastBox->setMinimumSize(style::bell_base_layout::w, style::bell_base_layout::outer_layouts_h);
+ lastBox->setMinimumSize(style::bell_base_layout::outer_layouts_w, style::bell_base_layout::outer_layouts_h);
lastBox->setAlignment(Alignment(gui::Alignment::Horizontal::Center));
lastBox->setEdges(RectangleEdge::None);
lastBox->activeItem = false;
+ if (type == style::bell_base_layout::ParentType::SideListView) {
+ lastBox->setMargins(Margins(0, 0, 0, style::bell_base_layout::outer_layout_margin));
+ }
+
resizeItems();
+
+ if (withSideArrows) {
+ addSideArrows();
+ }
}
Item *BellBaseLayout::getCenterBox() const noexcept
@@ 46,10 56,26 @@ namespace gui
return centerBox;
}
+ void BellBaseLayout::resizeCenter()
+ {
+ centerBox->resizeItems();
+ if (centerThreeBox != nullptr) {
+ centerThreeBox->resizeItems();
+ }
+ }
+
+ void BellBaseLayout::resize()
+ {
+ resizeItems();
+ firstBox->resizeItems();
+ resizeCenter();
+ lastBox->resizeItems();
+ }
+
void BellBaseLayout::addSideArrows()
{
centerThreeBox = new HThreeBox<HBox, HBox, HBox>(centerBox);
- centerThreeBox->setMinimumSize(style::bell_base_layout::w, style::bell_base_layout::centerbox::h);
+ centerThreeBox->setMinimumSize(style::bell_base_layout::w, style::bell_base_layout::center_layout_h);
centerThreeBox->setAlignment(Alignment(Alignment::Horizontal::Center, Alignment::Vertical::Center));
centerThreeBox->setEdges(RectangleEdge::None);
@@ 57,33 83,31 @@ namespace gui
centerThreeBox->firstBox->setAlignment(Alignment(Alignment::Vertical::Center));
centerThreeBox->firstBox->setEdges(RectangleEdge::None);
centerThreeBox->firstBox->activeItem = false;
- centerThreeBox->firstBox->setMinimumSize(style::bell_base_layout::arrow::w,
- style::bell_base_layout::centerbox::h);
leftArrow = new ImageBox(centerThreeBox->firstBox, 0, 0, 0, 0, new Image("bell_arrow_left"));
leftArrow->setAlignment(Alignment(Alignment::Horizontal::Right, Alignment::Vertical::Center));
- leftArrow->setMinimumSize(style::bell_base_layout::arrow::w, style::bell_base_layout::arrow::h);
+ leftArrow->setMinimumSizeToFitImage();
leftArrow->setVisible(true);
leftArrow->setEdges(RectangleEdge::None);
+ centerThreeBox->firstBox->setMinimumSize(leftArrow->widgetMinimumArea.w, leftArrow->widgetMinimumArea.h);
centerThreeBox->centerBox = new HBox(centerThreeBox);
centerThreeBox->centerBox->setEdges(RectangleEdge::None);
centerThreeBox->centerBox->setAlignment(Alignment(gui::Alignment::Horizontal::Center));
- centerThreeBox->centerBox->setMaximumSize(style::bell_base_layout::w, style::bell_base_layout::centerbox::h);
+ centerThreeBox->centerBox->setMaximumSize(style::bell_base_layout::w, style::bell_base_layout::center_layout_h);
centerThreeBox->lastBox = new HBox(centerThreeBox);
centerThreeBox->lastBox->setAlignment(Alignment(Alignment::Vertical::Center));
centerThreeBox->lastBox->setEdges(RectangleEdge::None);
centerThreeBox->lastBox->activeItem = false;
- centerThreeBox->lastBox->setMinimumSize(style::bell_base_layout::arrow::w,
- style::bell_base_layout::centerbox::h);
rightArrow = new ImageBox(centerThreeBox->lastBox, 0, 0, 0, 0, new Image("bell_arrow_right"));
rightArrow->setAlignment(Alignment(Alignment::Horizontal::Left, Alignment::Vertical::Center));
rightArrow->setMargins(Margins(0, 0, 0, 0));
- rightArrow->setMinimumSize(style::bell_base_layout::arrow::w, style::bell_base_layout::arrow::h);
+ rightArrow->setMinimumSizeToFitImage();
rightArrow->setVisible(true);
rightArrow->setEdges(RectangleEdge::None);
+ centerThreeBox->lastBox->setMinimumSize(rightArrow->widgetMinimumArea.w, rightArrow->widgetMinimumArea.h);
}
void BellBaseLayout::setArrowVisible(Arrow arrow, bool isVisible)
M module-apps/apps-common/widgets/BellBaseLayout.hpp => module-apps/apps-common/widgets/BellBaseLayout.hpp +21 -15
@@ 8,21 8,20 @@
namespace style::bell_base_layout
{
- constexpr inline auto w = style::window_width;
- constexpr inline auto h = style::window_height;
- constexpr inline auto first_layout_min_h = 50U;
- constexpr inline auto outer_layouts_h = 120U;
-
- namespace arrow
+ constexpr inline auto w = style::window_width;
+ constexpr inline auto h = style::window_height;
+ constexpr inline auto first_layout_min_h = 30U;
+ constexpr inline auto outer_layouts_w = 390U;
+ constexpr inline auto outer_layouts_h = 102U;
+ constexpr inline auto outer_layout_margin = 39U;
+ constexpr inline auto center_layout_h = h - 2 * outer_layout_margin - 2 * outer_layouts_h;
+
+ enum class ParentType
{
- inline constexpr auto w = 64U;
- inline constexpr auto h = 64U;
- } // namespace arrow
+ SideListView,
+ Window
+ };
- namespace centerbox
- {
- constexpr inline auto h = (style::window_height - 2 * outer_layouts_h);
- } // namespace centerbox
} // namespace style::bell_base_layout
namespace gui
@@ 36,10 35,17 @@ namespace gui
Right
};
- explicit BellBaseLayout(
- Item *parent, Position x = 0, Position y = 0, Length w = 0, Length h = 0, bool withSideArrows = true);
+ explicit BellBaseLayout(Item *parent,
+ Position x = 0,
+ Position y = 0,
+ Length w = 0,
+ Length h = 0,
+ bool withSideArrows = true,
+ style::bell_base_layout::ParentType type = style::bell_base_layout::ParentType::Window);
[[nodiscard]] Item *getCenterBox() const noexcept;
+ void resizeCenter();
+ void resize();
void setArrowVisible(Arrow arrow, bool isVisible);
M module-apps/apps-common/widgets/BellSideListItem.cpp => module-apps/apps-common/widgets/BellSideListItem.cpp +0 -2
@@ 12,8 12,6 @@ namespace gui
{
setMinimumSize(style::sidelistview::list_item::w, style::sidelistview::list_item::h);
setEdges(RectangleEdge::None);
- setFocusItem(body);
-
body = new BellBaseLayout(this);
auto topMessage = new TextFixedSize(body->firstBox);
M module-apps/apps-common/widgets/TimeSetFmtSpinner.cpp => module-apps/apps-common/widgets/TimeSetFmtSpinner.cpp +48 -19
@@ 22,15 22,13 @@ namespace gui
setEdges(RectangleEdge::None);
timeSetSpinner = new TimeSetSpinner(this, 0, 0, 0, 0);
- timeSetSpinner->setFont(fontName);
+ timeSetSpinner->setFont(focusFontName, noFocusFontName);
timeSetSpinner->setAlignment(Alignment(Alignment::Horizontal::Center, Alignment::Vertical::Center));
timeSetSpinner->setMargins(Margins(0, 0, 0, 0));
- auto minSize = getMinimumFmtSize();
auto textRange = UTF8Spinner::Range{time::Locale::getAM(), time::Locale::getPM()};
fmt = new UTF8Spinner(textRange, Boundaries::Continuous);
- fmt->setMinimumSize(minSize.first, minSize.second);
- fmt->setFont(fontName);
+ updateFmtFont(noFocusFontName);
fmt->setAlignment(Alignment(Alignment::Horizontal::Center, Alignment::Vertical::Center));
fmt->setEdges(RectangleEdge::None);
fmt->setVisible(false);
@@ 49,6 47,16 @@ namespace gui
return true;
};
+ fmt->focusChangedCallback = [&](Item &) {
+ if (fmt->focus) {
+ updateFmtFont(focusFontName);
+ }
+ else {
+ updateFmtFont(noFocusFontName);
+ }
+ return true;
+ };
+
setTimeFormat(timeFormat);
}
@@ 112,45 120,55 @@ namespace gui
setFocusItem(nullptr);
}
}
+
auto TimeSetFmtSpinner::getHour() const noexcept -> int
{
return timeSetSpinner->getHour();
}
+
auto TimeSetFmtSpinner::getMinute() const noexcept -> int
{
return timeSetSpinner->getMinute();
}
- auto TimeSetFmtSpinner::getFontHeight() const noexcept -> uint16_t
- {
- const auto font = FontManager::getInstance().getFont(fontName);
- return font->info.line_height;
- }
- auto TimeSetFmtSpinner::getMinimumFmtSize() const noexcept -> std::pair<Length, Length>
+ auto TimeSetFmtSpinner::getMinimumFmtWidth(const std::string &fontName) const noexcept -> Length
{
constexpr auto spacer = 5U; // space between two chars
const auto font = FontManager::getInstance().getFont(fontName);
- return {font->getPixelWidth(utils::time::Locale::getAM()) + spacer, font->info.line_height};
+ return font->getPixelWidth(utils::time::Locale::getAM()) + spacer;
}
+
auto TimeSetFmtSpinner::setHour(int value) noexcept -> void
{
timeSetSpinner->setHour(value);
}
+
auto TimeSetFmtSpinner::setFont(std::string newFontName) noexcept -> void
{
- fontName = std::move(newFontName);
- auto fontHeight = getFontHeight();
- auto minFmtSize = getMinimumFmtSize();
+ setFont(newFontName, newFontName);
+ }
- timeSetSpinner->setFont(fontName);
- fmt->setFont(fontName);
- fmt->setMinimumSize(minFmtSize.first, minFmtSize.second);
- fmt->setText(fmt->getText());
+ auto TimeSetFmtSpinner::setFont(std::string newFocusFontName, std::string newNoFocusFontName) noexcept -> void
+ {
+ focusFontName = std::move(newFocusFontName);
+ noFocusFontName = std::move(newNoFocusFontName);
+
+ timeSetSpinner->setFont(focusFontName, noFocusFontName);
+ updateFmtFont(noFocusFontName);
- setMinimumSize(timeSetSpinner->getMinimumSize().first + minFmtSize.first, fontHeight);
+ setMinimumSize(timeSetSpinner->widgetMinimumArea.w + fmt->widgetMinimumArea.w,
+ timeSetSpinner->widgetMinimumArea.h);
resizeItems();
}
+ auto TimeSetFmtSpinner::updateFmtFont(const std::string &fontName) noexcept -> void
+ {
+ fmt->setFont(fontName);
+ fmt->setMinimumWidth(getMinimumFmtWidth(fontName));
+ fmt->setMinimumHeightToFitText();
+ fmt->setText(fmt->getText());
+ }
+
auto TimeSetFmtSpinner::onInput(const InputEvent &inputEvent) -> bool
{
// Ignore input event when not in edit mode
@@ 175,6 193,7 @@ namespace gui
}
return false;
}
+
auto TimeSetFmtSpinner::handleEnterKey() -> bool
{
using namespace utils::time;
@@ 184,6 203,7 @@ namespace gui
}
return false;
}
+
auto TimeSetFmtSpinner::handleRightFunctionKey() -> bool
{
if (focusItem == fmt) {
@@ 193,10 213,12 @@ namespace gui
return false;
}
+
auto TimeSetFmtSpinner::isPM() const noexcept -> bool
{
return fmt->getCurrentValue() == utils::time::Locale::getPM().c_str();
}
+
auto TimeSetFmtSpinner::setTime(std::time_t time) noexcept -> void
{
using namespace utils::time;
@@ 215,6 237,13 @@ namespace gui
fmt->setCurrentValue(isPM ? utils::time::Locale::getPM() : utils::time::Locale::getAM());
}
}
+
+ auto TimeSetFmtSpinner::setTimeFormatSpinnerVisibility(bool visibility) noexcept -> void
+ {
+ fmt->setVisible(visibility);
+ resizeItems();
+ }
+
auto TimeSetFmtSpinner::getTime() const noexcept -> std::time_t
{
using namespace utils::time;
M module-apps/apps-common/widgets/TimeSetFmtSpinner.hpp => module-apps/apps-common/widgets/TimeSetFmtSpinner.hpp +11 -6
@@ 35,11 35,15 @@ namespace gui
/// Switches currently displayed time format
auto setTimeFormat(utils::time::Locale::TimeFormat fmt) noexcept -> void;
+ auto setTimeFormatSpinnerVisibility(bool visibility) noexcept -> void;
auto setHour(int value) noexcept -> void;
auto setMinute(int value) noexcept -> void;
auto setTime(std::time_t time) noexcept -> void;
auto setEditMode(EditMode newEditMode) noexcept -> void;
auto setFont(std::string newFontName) noexcept -> void;
+ auto setFont(std::string newFocusFontName, std::string newNoFocusFontName) noexcept -> void;
+ auto updateFmtFont(const std::string &fontName) noexcept -> void;
+
[[nodiscard]] auto getTime() const noexcept -> std::time_t;
[[nodiscard]] auto getHour() const noexcept -> int;
[[nodiscard]] auto getMinute() const noexcept -> int;
@@ 52,17 56,18 @@ namespace gui
Right
};
- [[nodiscard]] auto getFontHeight() const noexcept -> uint16_t;
- [[nodiscard]] auto getMinimumFmtSize() const noexcept -> std::pair<Length, Length>;
+ [[nodiscard]] auto getMinimumFmtWidth(const std::string &fontName) const noexcept -> Length;
auto onInput(const InputEvent &inputEvent) -> bool override;
auto handleEnterKey() -> bool;
auto handleRightFunctionKey() -> bool;
- TimeSetSpinner *timeSetSpinner = nullptr;
- UTF8Spinner *fmt = nullptr;
- EditMode editMode = EditMode::Edit;
- std::string fontName = style::window::font::supersizemelight;
+ TimeSetSpinner *timeSetSpinner = nullptr;
+ UTF8Spinner *fmt = nullptr;
+ EditMode editMode = EditMode::Edit;
+ std::string focusFontName = style::window::font::supersizeme;
+ std::string noFocusFontName = style::window::font::supersizemelight;
+
utils::time::Locale::TimeFormat timeFormat = utils::time::Locale::TimeFormat::FormatTime12H;
};
M module-apps/apps-common/widgets/TimeSetSpinner.cpp => module-apps/apps-common/widgets/TimeSetSpinner.cpp +58 -38
@@ 22,13 22,8 @@ namespace gui
setAlignment(Alignment(Alignment::Horizontal::Center, Alignment::Vertical::Center));
setEdges(RectangleEdge::None);
- auto fontHeight = getFontHeight();
- auto doubleCharWidth =
- (getWidestDigitWidth() * noOfDigits) + (1 * noOfDigits); // two digits + minimal space beetween
-
hour = new Spinner(hourMin, hourMax, hourStep, Boundaries::Continuous);
- hour->setMinimumSize(doubleCharWidth, fontHeight);
- hour->setFont(fontName);
+ updateFont(hour, noFocusFontName);
hour->setAlignment(Alignment(Alignment::Horizontal::Center, Alignment::Vertical::Center));
hour->setFixedFieldWidth(noOfDigits);
@@ 39,16 34,14 @@ namespace gui
addWidget(hour);
colon = new Label(this);
- colon->setFont(fontName);
- colon->setMinimumSize(getColonWidth(), fontHeight);
+ updateColon(noFocusFontName);
colon->setAlignment(Alignment(Alignment::Horizontal::Center, Alignment::Vertical::Center));
colon->setEdges(RectangleEdge::None);
colon->activeItem = false;
colon->setText(":");
minute = new Spinner(minuteMin, minuteMax, minuteStep, Boundaries::Continuous);
- minute->setMinimumSize(doubleCharWidth, fontHeight);
- minute->setFont(fontName);
+ updateFont(minute, noFocusFontName);
minute->setPenFocusWidth(style::time_set_spinner::focus::size);
minute->setAlignment(Alignment(Alignment::Horizontal::Center, Alignment::Vertical::Center));
@@ 63,7 56,8 @@ namespace gui
if (editMode != EditMode::Edit) {
return false;
}
- setFocusItem(focus ? lastFocus : nullptr);
+
+ updateFocus(lastFocus != nullptr ? lastFocus : hour);
return true;
};
if (editMode == EditMode::Edit) {
@@ 94,13 88,13 @@ namespace gui
return false;
}
- uint16_t TimeSetSpinner::getFontHeight() const noexcept
+ uint16_t TimeSetSpinner::getFontHeight(const std::string &fontName) const noexcept
{
const RawFont *font = FontManager::getInstance().getFont(fontName);
return font->info.line_height;
}
- uint32_t TimeSetSpinner::getWidestDigitWidth() const noexcept
+ uint32_t TimeSetSpinner::getWidestDigitWidth(const std::string &fontName) const noexcept
{
const RawFont *font = FontManager::getInstance().getFont(fontName);
uint32_t maxWidth = 0;
@@ 113,7 107,7 @@ namespace gui
return maxWidth;
}
- uint32_t TimeSetSpinner::getColonWidth() const noexcept
+ uint32_t TimeSetSpinner::getColonWidth(const std::string &fontName) const noexcept
{
const RawFont *font = FontManager::getInstance().getFont(fontName);
return font->getCharPixelWidth(':');
@@ 147,27 141,41 @@ namespace gui
minute->setCurrentValue(value);
}
- auto TimeSetSpinner::setFont(std::string newFontName) noexcept -> void
+ auto TimeSetSpinner::setFont(const std::string &newFontName) noexcept -> void
{
- fontName = std::move(newFontName);
- auto fontHeight = getFontHeight();
+ setFont(newFontName, newFontName);
+ }
+
+ auto TimeSetSpinner::setFont(std::string newFocusFontName, std::string newNoFocusFontName) noexcept -> void
+ {
+ focusFontName = std::move(newFocusFontName);
+ noFocusFontName = std::move(newNoFocusFontName);
+
+ updateFont(hour, noFocusFontName);
+ updateColon(noFocusFontName);
+ updateFont(minute, noFocusFontName);
+
+ setMinimumSize(hour->widgetMinimumArea.w + getColonWidth(noFocusFontName) + minute->widgetMinimumArea.w,
+ getFontHeight(noFocusFontName));
+ resizeItems();
+ }
+
+ auto TimeSetSpinner::updateFont(TextFixedSize *elem, const std::string &fontName) noexcept -> void
+ {
+ auto fontHeight = getFontHeight(fontName);
auto doubleCharWidth =
- (getWidestDigitWidth() * noOfDigits) + (1 * noOfDigits); // two digits + minimal space beetween
+ (getWidestDigitWidth(fontName) * noOfDigits) + (1 * noOfDigits); // two digits + minimal space beetween
- hour->setFont(fontName);
- hour->setMinimumSize(doubleCharWidth, fontHeight);
- hour->setText(hour->getText());
+ elem->setFont(fontName);
+ elem->setMinimumSize(doubleCharWidth, fontHeight);
+ elem->setText(elem->getText());
+ }
+ auto TimeSetSpinner::updateColon(const std::string &fontName) noexcept -> void
+ {
colon->setFont(fontName);
- colon->setMinimumSize(getColonWidth(), fontHeight);
+ colon->setMinimumSize(getColonWidth(fontName), getFontHeight(fontName));
colon->setText(":");
-
- minute->setFont(fontName);
- minute->setMinimumSize(doubleCharWidth, fontHeight);
- minute->setText(minute->getText());
-
- setMinimumSize(noOfDigits * doubleCharWidth + getColonWidth(), fontHeight);
- resizeItems();
}
auto TimeSetSpinner::setEditMode(EditMode editMode) noexcept -> void
@@ 190,24 198,36 @@ namespace gui
{
return minute->getCurrentValue();
}
+
auto TimeSetSpinner::setHourMax(std::uint32_t newMax) noexcept -> void
{
hour->setMaxValue(newMax);
}
+
auto TimeSetSpinner::setHourMin(std::uint32_t newMin) noexcept -> void
{
hour->setMinValue(newMin);
}
+
void TimeSetSpinner::updateFocus(Item *newFocus)
{
- setFocusItem(newFocus);
- lastFocus = newFocus;
- }
- auto TimeSetSpinner::getMinimumSize() const noexcept -> std::pair<std::uint32_t, std::uint32_t>
- {
- constexpr auto spacer = 1U;
- auto fontHeight = getFontHeight();
- auto doubleCharWidth = (getWidestDigitWidth() * noOfDigits) + (spacer * noOfDigits);
- return {noOfDigits * doubleCharWidth + getColonWidth(), fontHeight};
+ if (focus) {
+ setFocusItem(newFocus);
+ lastFocus = newFocus;
+
+ if (minute->focus) {
+ updateFont(minute, focusFontName);
+ updateFont(hour, noFocusFontName);
+ }
+ else if (hour->focus) {
+ updateFont(hour, focusFontName);
+ updateFont(minute, noFocusFontName);
+ }
+ }
+ else {
+ updateFont(hour, noFocusFontName);
+ updateFont(minute, noFocusFontName);
+ setFocusItem(nullptr);
+ }
}
} /* namespace gui */
M module-apps/apps-common/widgets/TimeSetSpinner.hpp => module-apps/apps-common/widgets/TimeSetSpinner.hpp +10 -8
@@ 14,7 14,7 @@ namespace style::time_set_spinner
{
namespace focus
{
- inline constexpr auto size = 3U;
+ inline constexpr auto size = 6U;
} // namespace focus
} // namespace style::time_set_spinner
@@ 27,29 27,31 @@ namespace gui
auto setHour(int value) noexcept -> void;
auto setMinute(int value) noexcept -> void;
- auto setFont(std::string newFontName) noexcept -> void;
+ auto setFont(const std::string &newFontName) noexcept -> void;
+ auto setFont(std::string newFocusFontName, std::string newNoFocusFontName) noexcept -> void;
+ auto updateFont(TextFixedSize *elem, const std::string &fontName) noexcept -> void;
+ auto updateColon(const std::string &fontName) noexcept -> void;
auto setEditMode(EditMode editMode) noexcept -> void;
auto setHourMax(std::uint32_t newMax) noexcept -> void;
auto setHourMin(std::uint32_t newMin) noexcept -> void;
[[nodiscard]] auto getHour() const noexcept -> int;
[[nodiscard]] auto getMinute() const noexcept -> int;
- auto getMinimumSize() const noexcept -> std::pair<std::uint32_t, std::uint32_t>;
-
private:
Spinner *hour = nullptr;
Label *colon = nullptr;
Spinner *minute = nullptr;
EditMode editMode = EditMode::Edit;
Item *lastFocus = nullptr;
- std::string fontName = style::window::font::supersizemelight;
+ std::string focusFontName = style::window::font::supersizeme;
+ std::string noFocusFontName = style::window::font::supersizemelight;
void updateFocus(Item *newFocus);
auto handleEnterKey() -> bool;
auto handleRightFunctionKey() -> bool;
auto onInput(const InputEvent &inputEvent) -> bool override;
- [[nodiscard]] auto getFontHeight() const noexcept -> uint16_t;
- [[nodiscard]] auto getWidestDigitWidth() const noexcept -> uint32_t;
- [[nodiscard]] auto getColonWidth() const noexcept -> uint32_t;
+ [[nodiscard]] auto getFontHeight(const std::string &fontName) const noexcept -> uint16_t;
+ [[nodiscard]] auto getWidestDigitWidth(const std::string &fontName) const noexcept -> uint32_t;
+ [[nodiscard]] auto getColonWidth(const std::string &fontName) const noexcept -> uint32_t;
};
} /* namespace gui */
M module-gui/gui/widgets/Style.hpp => module-gui/gui/widgets/Style.hpp +4 -4
@@ 69,11 69,11 @@ namespace style
inline constexpr auto default_rect_yaps = 10U;
namespace font
{
- inline constexpr auto thehugest = "gt_pressura_regular_190";
- inline constexpr auto huge = "gt_pressura_regular_90";
+ inline constexpr auto huge = "gt_pressura_regular_190";
+ inline constexpr auto supersizeme = "gt_pressura_regular_90";
inline constexpr auto supersizemelight = "gt_pressura_light_90";
inline constexpr auto largelight = "gt_pressura_light_46";
- inline constexpr auto verybigbold = "gt_pressura_bold_32";
+ inline constexpr auto verybiglight = "gt_pressura_light_38";
inline constexpr auto bigbold = "gt_pressura_bold_30";
inline constexpr auto big = "gt_pressura_regular_30";
inline constexpr auto biglight = "gt_pressura_light_30";
@@ 261,7 261,7 @@ namespace style
inline constexpr auto h = 50U;
} // namespace progress_bar
- } // namespace sidelistview
+ } // namespace sidelistview
namespace margins
{
M products/BellHybrid/apps/application-bell-alarm/data/BellAlarmStyle.hpp => products/BellHybrid/apps/application-bell-alarm/data/BellAlarmStyle.hpp +5 -2
@@ 3,18 3,21 @@
#pragma once
+#include <Style.hpp>
+
namespace gui
{
namespace bell_alarm_style
{
namespace time_set_fmt_spinner
{
- inline constexpr auto font = "gt_pressura_light_90";
+ inline constexpr auto focusFont = style::window::font::supersizeme;
+ inline constexpr auto noFocusFont = style::window::font::supersizemelight;
} // namespace time_set_fmt_spinner
namespace top_text
{
- inline constexpr auto font = "gt_pressura_light_46";
+ inline constexpr auto font = style::window::font::largelight;
}
} // namespace bell_alarm_style
} // namespace gui
M products/BellHybrid/apps/application-bell-alarm/windows/BellAlarmWindow.cpp => products/BellHybrid/apps/application-bell-alarm/windows/BellAlarmWindow.cpp +5 -8
@@ 34,8 34,7 @@ namespace gui
header->setTitleVisibility(true);
bottomBar->setVisible(false);
- body = new BellBaseLayout(this, 0, 0, style::window_width, style::window_height);
- auto centerBox = dynamic_cast<HBox *>(body->getCenterBox());
+ body = new BellBaseLayout(this, 0, 0, style::window_width, style::window_height);
topText = new Label(body->firstBox);
topText->setMinimumSize(style::bell_base_layout::w, style::bell_base_layout::outer_layouts_h);
@@ 45,15 44,13 @@ namespace gui
topText->activeItem = false;
topText->setAlignment(Alignment(Alignment::Horizontal::Center, Alignment::Vertical::Center));
- timeSetFmtSpinner = new TimeSetFmtSpinner(centerBox);
- timeSetFmtSpinner->setFont(bell_alarm_style::time_set_fmt_spinner::font);
+ timeSetFmtSpinner = new TimeSetFmtSpinner(body->getCenterBox());
+ timeSetFmtSpinner->setFont(bell_alarm_style::time_set_fmt_spinner::focusFont,
+ bell_alarm_style::time_set_fmt_spinner::noFocusFont);
timeSetFmtSpinner->setMaximumSize(style::bell_base_layout::w, style::bell_base_layout::h);
timeSetFmtSpinner->setAlignment(Alignment(Alignment::Horizontal::Center, Alignment::Vertical::Center));
- body->resizeItems();
- body->firstBox->resizeItems();
- centerBox->resizeItems();
- body->lastBox->resizeItems();
+ body->resize();
setFocusItem(body);
}
M products/BellHybrid/apps/application-bell-main/data/BellMainStyle.hpp => products/BellHybrid/apps/application-bell-main/data/BellMainStyle.hpp +5 -9
@@ 11,23 11,19 @@ namespace bellMainStyle
{
namespace time
{
- inline constexpr auto font = style::window::font::huge;
- inline constexpr auto width = 504U;
- inline constexpr auto height = 198U;
+ inline constexpr auto font = style::window::font::huge;
} // namespace time
namespace alarmSetSpinner
{
- inline constexpr auto font = style::window::font::largelight;
- inline constexpr auto width = 380U;
- inline constexpr auto height = 102U;
+ inline constexpr auto font = style::window::font::largelight;
} // namespace alarmSetSpinner
namespace bottomDescription
{
- inline constexpr auto font = style::window::font::largelight;
- inline constexpr auto width = 380U;
- inline constexpr auto height = 102U;
+ inline constexpr auto font_normal = style::window::font::largelight;
+ inline constexpr auto font_small = style::window::font::verybiglight;
+
} // namespace bottomDescription
} // namespace mainWindow
M products/BellHybrid/apps/application-bell-main/windows/BellHomeScreenWindow.cpp => products/BellHybrid/apps/application-bell-main/windows/BellHomeScreenWindow.cpp +10 -8
@@ 92,7 92,7 @@ namespace gui
body = new BellBaseLayout(this, 0, 0, style::window_width, style::window_height, false);
alarm = new AlarmSetSpinner(body->firstBox);
- alarm->setMinimumSize(mainWindow::alarmSetSpinner::width, mainWindow::alarmSetSpinner::height);
+ alarm->setMinimumSize(style::bell_base_layout::outer_layouts_w, style::bell_base_layout::outer_layouts_h);
alarm->setFont(mainWindow::alarmSetSpinner::font);
alarm->setEditMode(EditMode::Browse);
alarm->setAlarmStatus(AlarmSetSpinner::Status::DEACTIVATED);
@@ 107,18 107,15 @@ namespace gui
time->activeItem = false;
bottomText = new TextFixedSize(body->lastBox, 0, 0, 0, 0);
- bottomText->setMinimumSize(mainWindow::bottomDescription::width, mainWindow::bottomDescription::height);
- bottomText->setFont(mainWindow::bottomDescription::font);
+ bottomText->setMinimumSize(style::bell_base_layout::outer_layouts_w, style::bell_base_layout::outer_layouts_h);
+ bottomText->setFont(mainWindow::bottomDescription::font_small);
+ bottomText->setAlignment(Alignment(Alignment::Horizontal::Center, Alignment::Vertical::Top));
bottomText->setEdges(RectangleEdge::None);
bottomText->activeItem = false;
- bottomText->setAlignment(Alignment(Alignment::Horizontal::Center, Alignment::Vertical::Center));
bottomText->drawUnderline(false);
bottomText->setLines(2);
- body->resizeItems();
- body->firstBox->resizeItems();
- body->centerBox->resizeItems();
- body->lastBox->resizeItems();
+ body->resize();
}
void BellHomeScreenWindow::setAlarmTriggered()
@@ 153,17 150,22 @@ namespace gui
void BellHomeScreenWindow::setTemperature(utils::temperature::Temperature newTemp)
{
+ bottomText->setFont(bellMainStyle::mainWindow::bottomDescription::font_normal);
+ bottomText->setAlignment(Alignment(Alignment::Horizontal::Center, Alignment::Vertical::Center));
bottomText->setText(utils::temperature::tempToStrDec(newTemp));
}
void BellHomeScreenWindow::setBottomDescription(const UTF8 &desc)
{
+ bottomText->setFont(bellMainStyle::mainWindow::bottomDescription::font_small);
+ bottomText->setAlignment(Alignment(Alignment::Horizontal::Center, Alignment::Vertical::Top));
bottomText->setText(desc);
}
void BellHomeScreenWindow::setTime(std::time_t newTime)
{
time->setTime(newTime);
+ time->setTimeFormatSpinnerVisibility(false);
}
void BellHomeScreenWindow::setTimeFormat(utils::time::Locale::TimeFormat fmt)
M products/BellHybrid/apps/application-bell-powernap/windows/PowerNapProgressWindow.cpp => products/BellHybrid/apps/application-bell-powernap/windows/PowerNapProgressWindow.cpp +1 -1
@@ 72,7 72,7 @@ namespace gui
{
auto body = new gui::BellBaseLayout(this, 0, 0, style::bell_base_layout::w, style::bell_base_layout::h, false);
auto vBox =
- new VBox(body->getCenterBox(), 0, 0, style::bell_base_layout::w, style::bell_base_layout::centerbox::h);
+ new VBox(body->getCenterBox(), 0, 0, style::bell_base_layout::w, style::bell_base_layout::center_layout_h);
decorateProgressItem(vBox, gui::Alignment::Vertical::Top);
createTitle(vBox);
progressBar = createProgress(vBox);
M products/BellHybrid/apps/application-bell-settings/widgets/TimeFormatSetListItem.cpp => products/BellHybrid/apps/application-bell-settings/widgets/TimeFormatSetListItem.cpp +1 -1
@@ 29,7 29,7 @@ namespace gui
setFocusItem(body);
timeFormat = new Spinner(fmtSpinnerMin, fmtSpinnerMax, fmtSpinnerStep, Boundaries::Continuous);
- timeFormat->setMaximumSize(style::bell_base_layout::w, style::bell_base_layout::centerbox::h);
+ timeFormat->setMaximumSize(style::bell_base_layout::w, style::bell_base_layout::center_layout_h);
timeFormat->setFont(bell_settings_style::time_fmt_set_list_item::font);
timeFormat->setAlignment(Alignment(Alignment::Horizontal::Center, Alignment::Vertical::Center));
timeFormat->setFixedFieldWidth(2);
M products/BellHybrid/apps/application-bell-settings/windows/BellSettingsFrontlight.cpp => products/BellHybrid/apps/application-bell-settings/windows/BellSettingsFrontlight.cpp +3 -6
@@ 48,12 48,9 @@ namespace gui
topText->activeItem = false;
topText->setAlignment(Alignment(Alignment::Horizontal::Center, Alignment::Vertical::Center));
- auto centerBox = dynamic_cast<HBox *>(body->getCenterBox());
- centerBox->addWidget(presenter->getPagesProvider()->getSpinner());
- body->resizeItems();
- body->firstBox->resizeItems();
- centerBox->resizeItems();
- body->lastBox->resizeItems();
+ body->getCenterBox()->addWidget(presenter->getPagesProvider()->getSpinner());
+
+ body->resize();
presenter->loadData();