~aleteoryx/muditaos

ref: 42ca53a732487f7dabf5e06ee4c03f73c329882b muditaos/module-apps/apps-common/widgets/DateWidget.hpp -rw-r--r-- 1.2 KiB
42ca53a7 — Maciej-Mudita [MOS-686] Fix the accessibility of user files by MTP 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
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once

#include <BoxLayout.hpp>
#include <Label.hpp>
#include <date/date.h>

namespace gui
{
    class DateWidget : public VBox
    {
      public:
        DateWidget(Item *parent);
        void loadData(const date::year_month_day &yearMonthDay);

        const date::year_month_day getChosenDate();

      private:
        VBox *vBox        = nullptr;
        HBox *labelsHBox  = nullptr;
        HBox *dateHBox    = nullptr;
        Label *dayLabel   = nullptr;
        Label *monthLabel = nullptr;
        Label *yearLabel  = nullptr;
        Label *dayInput   = nullptr;
        Label *monthInput = nullptr;
        Label *yearInput  = nullptr;

        void buildInterface();
        void applyItemSpecificProperties(Label *item);
        void applyLabelSpecificProperties(Label *label);
        void applyCallbacks();
        date::year_month_day validateDate();
        void setDate(int keyValue, Label &item);
        void setOnInputCallback(Label &dateInput);
        void clearInput(Label &dateInput);
    };

} /* namespace gui */