From da0143627375761a5cb07a1f315aae3135f18b9e Mon Sep 17 00:00:00 2001 From: Ryan Klaassen Date: Tue, 16 Aug 2016 14:10:00 -0500 Subject: Replace Layout.h --- Layout/Layout.h | 84 ++++++++++++++++++++++++++++++++------------------------- 1 file changed, 48 insertions(+), 36 deletions(-) diff --git a/Layout/Layout.h b/Layout/Layout.h index c493ce2..90ffe8d 100644 --- a/Layout/Layout.h +++ b/Layout/Layout.h @@ -16,49 +16,61 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#ifndef __LAYOUTJOIN_H__ -#define __LAYOUTJOIN_H__ +#ifndef __LAYOUT_H__ +#define __LAYOUT_H__ -#include "Layout.h" -#include "mDot.h" +#include "DOGS102.h" +#include -class LayoutJoin : public Layout { +class Label { public: - LayoutJoin(DOGS102* lcd, uint8_t band); - ~LayoutJoin(); + Label(uint8_t col, uint8_t row, std::string value); - void display(); - void displayEditFsb(uint8_t rate, uint32_t power, uint8_t band, string key, string id); + uint8_t _col; + uint8_t _row; + std::string _value; +}; + +class Field { + public: + Field(uint8_t col, uint8_t row, uint8_t maxSize); + + uint8_t _col; + uint8_t _row; + uint8_t _maxSize; +}; + +class Image { + public: + Image(uint8_t col, uint8_t row, const uint8_t* bmp); + + uint8_t _col; + uint8_t _row; + const uint8_t* _bmp; +}; - void updateId(std::string id); - void updateKey(std::string key); - void updateFsb(uint8_t band); - void updateJoinFsb(uint8_t band); - void updateRate(uint8_t rate); - void updatePower(uint32_t power); - void updateAttempt(uint32_t attempt); - void updateStatus(std::string status); - void updateCountdown(uint32_t seconds); - void displayCancel(bool display = true); +class Layout { + public: + Layout(DOGS102* lcd); + ~Layout(); + + virtual void display() = 0; + + protected: + void clear(); + void startUpdate(); + void endUpdate(); + bool writeLabel(const Label& label); + bool writeField(const Field& field, const std::string& value, bool apply = false); + bool writeField(const Field& field, const char* value, size_t size, bool apply = false); + bool writeImage(const Image& image, bool apply = false); + void removeField(const Field& field); private: - Label _lId; - Label _lKey; - Label _lFsb; - Label _lRate; - Label _lPower; - Label _lAttempt; + bool writeText(uint8_t col, uint8_t row, const char* value, size_t size); + bool writeBmp(uint8_t col, uint8_t row, const uint8_t* bmp); - Field _fStatus; - Field _fId; - Field _fKey; - Field _fFsb; - Field _fRate; - Field _fPower; - Field _fAttempt; - Field _fCountdown; - Field _fCountdownLabel; - Field _fCancel; - uint8_t _band; + DOGS102* _lcd; }; + #endif -- cgit v1.2.3