Files
MuditaOS/module-apps/apps-common/widgets/BellSideListItem.cpp
Lefucjusz 773f2c7eb1 [BH-2069] Update license URL in headers
Update outdated license file URL in
license headers across all project.
2024-09-18 11:53:01 +02:00

49 lines
1.8 KiB
C++

// Copyright (c) 2017-2024, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/blob/master/LICENSE.md
#include "TextFixedSize.hpp"
#include "BellSideListItem.hpp"
#include "Style.hpp"
namespace gui
{
BellSideListItem::BellSideListItem(BellBaseLayout::LayoutType type)
{
setMinimumSize(style::sidelistview::list_item::w, style::sidelistview::list_item::h);
setEdges(RectangleEdge::None);
body = new BellBaseLayout(this, 0, 0, 0, 0, type);
}
void BellSideListItem::setBottomDescriptionText(const std::string &description)
{
if (bottomText != nullptr) {
bottomText->setText(description);
}
}
void BellSideListItem::setupTopTextBox(const std::string &description)
{
auto topText = new TextFixedSize(body->firstBox);
setupTextBox(topText, style::bell_sidelist_item::title_font, description);
}
void BellSideListItem::setupBottomTextBox(const std::string &description)
{
bottomText = new TextFixedSize(body->lastBox);
setupTextBox(bottomText, style::bell_sidelist_item::description_font, description);
}
void BellSideListItem::setupTextBox(TextFixedSize *textBox,
const std::string &fontName,
const std::string &description)
{
textBox->setMaximumSize(style::bell_base_layout::w, style::bell_base_layout::outer_layouts_h);
textBox->setFont(fontName);
textBox->setEdges(gui::RectangleEdge::None);
textBox->activeItem = false;
textBox->setAlignment(Alignment(gui::Alignment::Horizontal::Center, gui::Alignment::Vertical::Center));
textBox->setRichText(description);
textBox->drawUnderline(false);
}
} /* namespace gui */