From 2826dfde568ab4da81d44f52f9f22ff02ecaeeeb Mon Sep 17 00:00:00 2001 From: Reed Nightingale Date: Mon, 10 Feb 2020 01:30:01 -0800 Subject: [PATCH] First pass at button drawing implementation --- button.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 button.cpp diff --git a/button.cpp b/button.cpp new file mode 100644 index 0000000..50adcb4 --- /dev/null +++ b/button.cpp @@ -0,0 +1,25 @@ +#include "button.h" +#include "nano_gui.h" +#include "color_theme.h" +#include "ubitx.h"//b + +void drawButton(Button* button) +{ + uint16_t tc = COLOR_INACTIVE_TEXT; + uint16_t bgc = COLOR_INACTIVE_BACKGROUND; + const uint16_t bdc = COLOR_INACTIVE_BORDER; + const char* text = nullptr; + if(nullptr != button->text){ + text = button->text; + } + else if(nullptr != button->text_override){ + button->text_override(b,sizeof(b)); + text = b; + } + else{ + //Something's messed up + //Serial.println(F("No text for button!")); + return; + } + displayText(text, button->x, button->y, button->w, button->h, tc, bgc, bdc); +}