~aleteoryx/muditaos

ref: 3d13f10839e218b65dc247f03a15fb5dfa87bc8b muditaos/module-apps/apps-common/widgets/BellSideListItem.cpp -rw-r--r-- 1.9 KiB
3d13f108 — Bartosz [MOS-668] Modify USB notifications logging 3 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "TextFixedSize.hpp"
#include "ListItemWithDescription.hpp"
#include "BellSideListItem.hpp"
#include "Style.hpp"

namespace gui
{
    BellSideListItem::BellSideListItem(const std::string &description) : ListItemWithDescription(description)
    {
        setMinimumSize(style::sidelistview::list_item::w, style::sidelistview::list_item::h);
        setEdges(RectangleEdge::None);
        body = new BellBaseLayout(this);

        auto topMessage = new TextFixedSize(body->firstBox);
        topMessage->setMaximumSize(style::bell_base_layout::w, style::bell_base_layout::outer_layouts_h);
        topMessage->setFont(style::bell_sidelist_item::title_font);
        topMessage->setEdges(gui::RectangleEdge::None);
        topMessage->activeItem = false;
        topMessage->setAlignment(Alignment(gui::Alignment::Horizontal::Center, gui::Alignment::Vertical::Center));
        topMessage->setRichText(description);
        topMessage->drawUnderline(false);
    }

    void BellSideListItem::setupBottomDescription(const std::string &description)
    {
        bottomText = new TextFixedSize(body->lastBox);
        bottomText->setMaximumSize(::style::bell_base_layout::w, ::style::bell_base_layout::outer_layouts_h);
        bottomText->setFont(::style::bell_sidelist_item::description_font);
        bottomText->setEdges(RectangleEdge::None);
        bottomText->activeItem = false;
        bottomText->setAlignment(Alignment(Alignment::Horizontal::Center, Alignment::Vertical::Center));
        bottomText->setRichText(description);
        bottomText->drawUnderline(false);
    }

    void BellSideListItem::setBottomDescribtionText(const std::string &description)
    {
        if (bottomText != nullptr) {
            bottomText->setText(description);
        }
    }

} /* namespace gui */