aboutsummaryrefslogtreecommitdiffstats
path: root/src/DisplayApp/Screens/Label.h
blob: 9d91974da4dc6fd01c4c885433b5b22244b82e22 (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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#pragma once

#include <vector>
#include "Screen.h"
#include <lvgl/lvgl.h>

namespace Pinetime {
  namespace Applications {
    namespace Screens {
      class Label {
        public:
          Label() = default;
          explicit Label(const char* text);
          ~Label();
          void Refresh();

          void Hide();
          void Show();
        private:
          lv_obj_t * label = nullptr;
          const char* text = nullptr;
      };

      class Label2 : public Screen {
        public:
          Label2(DisplayApp* app, const char* text) : Screen(app), text{text} {
            label = lv_label_create(lv_scr_act(), NULL);
            lv_label_set_align(label, LV_LABEL_ALIGN_LEFT);
            lv_obj_set_size(label, 240, 240);
            lv_label_set_text(label, text);
          }

          ~Label2() override {
            lv_obj_clean(lv_scr_act());
          }

          bool Refresh() override {return false;}

        private:
          lv_obj_t * label = nullptr;
          const char* text = nullptr;
      };
    }
  }
}