~aleteoryx/muditaos

ref: 323786c4d2cd22d91d1a966a231b866c75146b8b muditaos/module-apps/application-messages/widgets/SMSTemplateItem.cpp -rw-r--r-- 1.0 KiB
323786c4 — Wojtek Rzepecki [EGD-4797] Battery bar as widget 5 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
// Copyright (c) 2017-2020, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "SMSTemplateItem.hpp"

#include <time/time_conversion.hpp>
#include <Style.hpp>

namespace gui
{
    SMSTemplateItem::SMSTemplateItem()
    {
        setMargins(Margins(0, style::margins::big, 0, 0));
        setMinimumSize(style::smsTemplItem::w, style::smsTemplItem::h);
        setMaximumSize(style::smsTemplItem::w, style::smsTemplItem::h);

        text = new gui::Label(this, 0, 0, 0, 0);
        style::window::decorateOption(text);
        text->setEllipsis(gui::Ellipsis::Right);
    }

    bool SMSTemplateItem::onDimensionChanged(const BoundingBox &oldDim, const BoundingBox &newDim)
    {
        text->setPosition(0, 0);
        text->setSize(newDim.w, newDim.h);

        return true;
    }

    void SMSTemplateItem::setTemplate(std::shared_ptr<SMSTemplateRecord> templ)
    {
        this->templ = templ;
        text->setText(templ->text);
    }

} /* namespace gui */