diff options
author | Mike Fiore <mfiore@multitech.com> | 2015-11-11 14:24:21 -0600 |
---|---|---|
committer | Mike Fiore <mfiore@multitech.com> | 2015-11-11 14:24:21 -0600 |
commit | 4e31ea44c166a59a273a51597c498c1367eeb38d (patch) | |
tree | e2af0d022836dc3577a219fff0bb21b9e2658e41 /Layout/Layout.h | |
parent | 1a7194aced3b2c914257b8582dec4bb80cb97f5e (diff) | |
download | mtdot-box-evb-factory-firmware-4e31ea44c166a59a273a51597c498c1367eeb38d.tar.gz mtdot-box-evb-factory-firmware-4e31ea44c166a59a273a51597c498c1367eeb38d.tar.bz2 mtdot-box-evb-factory-firmware-4e31ea44c166a59a273a51597c498c1367eeb38d.zip |
reorganize Layout as a base class for screen layouts
Diffstat (limited to 'Layout/Layout.h')
-rw-r--r-- | Layout/Layout.h | 75 |
1 files changed, 40 insertions, 35 deletions
diff --git a/Layout/Layout.h b/Layout/Layout.h index c8dc4f3..5b25458 100644 --- a/Layout/Layout.h +++ b/Layout/Layout.h @@ -1,48 +1,53 @@ -#ifndef __DISPLAYMANAGER_H__ -#define __DISPLAYMANAGER_H__ +#ifndef __LAYOUT_H__ +#define __LAYOUT_H__ #include "DOGS102.h" - #include <string> -#include <vector> - -typedef struct field { - int32_t id; - uint8_t column; - uint8_t page; - uint8_t maxSize; -} Field; - -typedef struct label { - uint8_t column; - uint8_t page; - const char* value; - uint8_t size; -} Label; - -typedef std::vector<Field> Fields; -typedef std::vector<Label> Labels; -typedef std::pair<Labels, Fields> Layout; - -class DisplayManager { + +class Label { public: - DisplayManager(DOGS102* lcd); - DisplayManager(DOGS102* lcd, const Layout layout); - ~DisplayManager(); + Label(uint8_t col, uint8_t row, std::string value); + + uint8_t _col; + uint8_t _row; + std::string _value; +}; - void displaySplashScreen(); +class Field { + public: + Field(uint8_t col, uint8_t row, uint8_t maxSize); - bool addLayout(const Layout layout); + uint8_t _col; + uint8_t _row; + uint8_t _maxSize; +}; - bool updateField(const int32_t& id, const char* field, const uint32_t& fieldSize); - bool updateField(const int32_t& id, const std::string& field); +class Image { + public: + Image(uint8_t col, uint8_t row, const uint8_t* bmp); + + uint8_t _col; + uint8_t _row; + const uint8_t* _bmp; +}; + +class Layout { + public: + Layout(DOGS102* lcd); + ~Layout(); + + virtual void display() = 0; + + protected: + void clear(); + void startUpdate(); + void endUpdate(); + bool writeField(uint8_t col, uint8_t row, std::string field, bool apply = false); + bool writeField(uint8_t col, uint8_t row, const char* field, size_t size, bool apply = false); + bool writeImage(uint8_t col, uint8_t row, const uint8_t* bmp, bool apply = false); private: - Layout _layout; DOGS102* _lcd; - static std::string _product_name; - static std::string _program_name; - static std::string _program_version; }; #endif |