aboutsummaryrefslogtreecommitdiffstats
path: root/apps/main_clock/main.hpp
blob: 0919fd76412ec0754b57de2ae78d5d32f2931370 (plain)
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
#pragma once

#include "pico/util/datetime.h"

// Includes also buttons, API and ss_oled
#include "../../app/base_app.hpp"

class app_main_clock : public BaseApp {
    private:
        bool *ask_user_choice;
        int *user_choice;
        const char *choices[10] = {"One", "Close (fg)", "Quit (fg)", "Close (bg)", "Quit (bg)"};

        void time_as_str(char *buf, uint buf_size, const datetime_t *t);
        void date_as_str(char *buf, uint buf_size, const datetime_t *t);
        void show_datetime(Api *app_api);

        AppAttributes app_attributes = {1, true};
    public:
        const AppAttributes& app_get_attributes() {
            return app_attributes;
        }

        app_main_clock(Api *app_api);
        AppReturnValues render(Api *app_api);
        AppReturnValues btnpressed(Api *app_api, uint gpio, unsigned long delta);
        AppReturnValues bgrefresh(Api *app_api, bool in_foreground);
        ~app_main_clock();
};