cash2ecash

cash2ecash: cash acceptor that issues digital cash (experimental)
Log | Files | Refs | Submodules | README | LICENSE

screenAcceptCash.hpp (1181B)


      1 #ifndef SCREEN_ACCEPTCASH_H
      2 #define SCREEN_ACCEPTCASH_H
      3 
      4 #include "screen.hpp"
      5 #include "lvgl.h"
      6 #include <src/core/lv_obj_pos.h>
      7 #include <src/misc/lv_types.h>
      8 #include <src/widgets/label/lv_label.h>
      9 
     10 #include "global.hpp"
     11 
     12 class ScreenAcceptCash : public Screen{
     13   private:
     14   lv_obj_t *finishButton;
     15   lv_obj_t *amountLabel;
     16 
     17   static void finishedButtonEvent(lv_event_t *e){
     18     event(EVENT_BUTTON_FINISH_CASHIN);
     19   }
     20   
     21   protected:
     22   public:
     23   ScreenAcceptCash(char* amountString){
     24     //Set set the "instruction"
     25     lv_label_set_text(instructionLabel, "Insert Cash and press Finish if you're done");
     26 
     27     //Add button "Finish"
     28     finishButton = lv_button_create(buttonsContainer);
     29     lv_obj_add_style(finishButton, &buttonDefaultStyle, 0);
     30     lv_obj_t *label = lv_label_create(finishButton);
     31     lv_label_set_text(label, "Finish");
     32     lv_obj_add_style(label, &buttonLabelDefaultStyle, 0);
     33     lv_obj_add_event_cb(finishButton, finishedButtonEvent, LV_EVENT_CLICKED, NULL);
     34 
     35     //Add field, displaying amount
     36     amountLabel = lv_label_create(mainContentContainer);
     37     lv_label_set_text_static(amountLabel, amountString);
     38     lv_obj_center(amountLabel);
     39   }
     40 };
     41 
     42 #endif