~aleteoryx/muditaos

ref: master muditaos/module-apps/application-notes/widgets/NotesItem.hpp -rw-r--r-- 1.0 KiB
2cd0e472 — Lefucjusz [BH-000] Update Harmony 2.10.0 changelog 2 months 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-2024, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/blob/master/LICENSE.md

#pragma once

#include <module-gui/gui/widgets/text/Label.hpp>
#include <module-gui/gui/widgets/ListItem.hpp>
#include <module-gui/gui/widgets/text/TextFixedSize.hpp>

#include <module-db/Interface/NotesRecord.hpp>

namespace gui
{
    class NotesItem : public ListItem
    {
      public:
        explicit NotesItem(std::shared_ptr<NotesRecord> record);

        bool onDimensionChanged(const BoundingBox &oldDim, const BoundingBox &newDim) override;

      private:
        static gui::TextFixedSize *createTextField(Item *parent, const UTF8 &fontName);

        void buildInterface();
        void setSnippet(const UTF8 &noteText);
        void setDateText(std::uint32_t timestamp);

        std::shared_ptr<NotesRecord> note;
        gui::Label *date            = nullptr;
        gui::TextFixedSize *title   = nullptr;
        gui::TextFixedSize *snippet = nullptr;
    };
} // namespace gui