~aleteoryx/muditaos

ref: 0823d82e5141f44812c54debf07245d0ca746124 muditaos/module-apps/application-notes/widgets/NotesItem.hpp -rw-r--r-- 1.4 KiB
0823d82e — Radoslaw Wicik [EGD-3743] Update copyrights in fies - add empty line after license 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
 * @file NotesItem.hpp
 * @author Robert Borzecki (robert.borzecki@mudita.com)
 * @date 12 sie 2019
 * @brief
 * @copyright Copyright (C) 2019 mudita.com
 * @details
 */
#ifndef MODULE_APPS_APPLICATION_NOTES_WIDGETS_NOTESITEM_HPP_
#define MODULE_APPS_APPLICATION_NOTES_WIDGETS_NOTESITEM_HPP_

#include "Label.hpp"
#include "ListItem.hpp"
#include "../NotesModel.hpp"

namespace gui
{

    /*
     * @brief Widget used to display information about note in the notes list view.
     */
    class NotesItem : public ListItem
    {

        NotesModel *model = nullptr;
        // pointer to the notes record
        std::shared_ptr<NotesRecord> note = nullptr;
        // this is hour in the mode defined in settings
        gui::Label *hour    = nullptr;
        gui::Label *title   = nullptr;
        gui::Label *snippet = nullptr;
        // flag that defines if time should be displayed in 24h mode
        bool mode24H = false;

      public:
        NotesItem(NotesModel *model, bool mode24H);
        virtual ~NotesItem();
        // sets copy of alarm's
        void setNote(std::shared_ptr<NotesRecord> &note);

        // returns alarm structure
        std::shared_ptr<NotesRecord> getAlarm();
        // virtual methods from Item
        bool onDimensionChanged(const BoundingBox &oldDim, const BoundingBox &newDim) override;
        bool onActivated(void *data) override;
    };

} /* namespace gui */

#endif /* MODULE_APPS_APPLICATION_NOTES_WIDGETS_NOTESITEM_HPP_ */