~aleteoryx/muditaos

ref: eca248c6884d9a1e85d05f7ef79670763f1579af muditaos/module-apps/application-messages/widgets/SMSTemplateItem.cpp -rw-r--r-- 1014 bytes
eca248c6 — Marcin Zieliński [MOS-35] Add more input modes for USSD reply 2 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
// Copyright (c) 2017-2022, 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->setTextEllipsisType(gui::TextEllipsis::Right);

        dimensionChangedCallback = [&](gui::Item &, const BoundingBox &newDim) -> bool {
            text->setArea({0, 0, newDim.w, newDim.h});
            return true;
        };
    }

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

} /* namespace gui */