Téo DHIEN-FANE / F746_GUI

Dependencies:   Array_Matrix TS_DISCO_F746NG LCD_DISCO_F746NG BSP_DISCO_F746NG

Dependents:   dashboard_f1

Files at this revision

API Documentation at this revision

Comitter:
MikamiUitOpen
Date:
Fri Apr 08 09:32:49 2016 +0000
Parent:
3:fe6ff954824a
Child:
5:9c3ea4d4bc6b
Commit message:
5

Changed in this revision

BlinkLabel.hpp Show annotated file Show diff for this revision Revisions of this file
Button.cpp Show annotated file Show diff for this revision Revisions of this file
Label.cpp Show annotated file Show diff for this revision Revisions of this file
Label.hpp Show annotated file Show diff for this revision Revisions of this file
NumericLabel.hpp Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/BlinkLabel.hpp	Fri Apr 08 09:32:49 2016 +0000
@@ -0,0 +1,43 @@
+//-----------------------------------------------------------
+//  BlinkLabel class -- derived class of Label class
+//      This class for displaying error message
+//
+//  2016/04/07, Copyright (c) 2016 MIKAMI, Naoki
+//-----------------------------------------------------------
+
+#ifndef F746_BLINK_LABEL_HPP
+#define F746_BLINK_LABEL_HPP
+
+#include "Label.hpp"
+
+namespace Mikami
+{
+    class BlinkLabel : public Label
+    {
+    public:
+        // Constructor
+        BlinkLabel(uint16_t x, uint16_t y, const string str,
+                   TextAlignMode mode = LEFT,
+                   sFONT &fonts = Font20,
+                   uint32_t textColor = LCD_COLOR_RED,
+                   uint32_t backColor = GuiBase::ENUM_BACK,
+                   uint32_t on = 500, uint32_t off = 200)
+            : Label(x, y, str, mode, fonts, textColor, backColor)
+        {
+            while (true)    // Blinking here
+            {
+                wait_ms(on);
+                Draw(backColor);
+                wait_ms(off);
+                Draw(textColor);
+            }
+        }
+
+    private:
+        // disallow copy constructor and assignment operator
+        BlinkLabel(const BlinkLabel&);
+        BlinkLabel& operator=(const BlinkLabel&);
+    };
+}
+#endif  // F746_BLINK_LABEL_HPP
+
--- a/Button.cpp	Thu Apr 07 00:08:19 2016 +0000
+++ b/Button.cpp	Fri Apr 08 09:32:49 2016 +0000
@@ -2,7 +2,7 @@
 //  Button class handling multi-touch
 //      Multi-touch: Enabled (default)
 //
-//  2016/03/29, Copyright (c) 2016 MIKAMI, Naoki
+//  2016/04/08, Copyright (c) 2016 MIKAMI, Naoki
 //-----------------------------------------------------------
 
 #include "Button.hpp"
@@ -12,6 +12,7 @@
     // Draw button
     void Button::Draw(uint32_t color, uint32_t textColor)
     {
+        if (color == BACK_COLOR_) active_ = true;
         if (!active_) return;
         lcd_.SetTextColor(color);
         lcd_.FillRect(X_, Y_, W_, H_);
--- a/Label.cpp	Thu Apr 07 00:08:19 2016 +0000
+++ b/Label.cpp	Fri Apr 08 09:32:49 2016 +0000
@@ -1,7 +1,7 @@
 //-----------------------------------------------------------
 //  Label class
 //
-//  2016/04/03, Copyright (c) 2016 MIKAMI, Naoki
+//  2016/04/07, Copyright (c) 2016 MIKAMI, Naoki
 //-----------------------------------------------------------
 
 #include "Label.hpp"
--- a/Label.hpp	Thu Apr 07 00:08:19 2016 +0000
+++ b/Label.hpp	Fri Apr 08 09:32:49 2016 +0000
@@ -1,7 +1,7 @@
 //-----------------------------------------------------------
 //  Label class -- Header
 //
-//  2016/04/05, Copyright (c) 2016 MIKAMI, Naoki
+//  2016/04/07, Copyright (c) 2016 MIKAMI, Naoki
 //-----------------------------------------------------------
 
 #ifndef F746_LABEL_HPP
@@ -22,6 +22,15 @@
               uint32_t textColor = GuiBase::ENUM_TEXT,
               uint32_t backColor = GuiBase::ENUM_BACK);
 
+        // Constructor without string
+        Label(uint16_t x, uint16_t y,
+              TextAlignMode mode = LEFT,
+              sFONT &fonts = Font12,
+              uint32_t textColor = GuiBase::ENUM_TEXT,
+              uint32_t backColor = GuiBase::ENUM_BACK)
+            : GuiBase(x, y, fonts, textColor, backColor),
+              MODE_(mode), STR_("") {}
+
         void Draw()
         {   Draw(STR_, TEXT_COLOR_); }
 
@@ -33,7 +42,7 @@
 
         void Draw(const string str,
                   uint32_t textColor);
-
+                  
     private:
         const TextAlignMode MODE_;
         const string STR_;
--- a/NumericLabel.hpp	Thu Apr 07 00:08:19 2016 +0000
+++ b/NumericLabel.hpp	Fri Apr 08 09:32:49 2016 +0000
@@ -1,7 +1,7 @@
 //-----------------------------------------------------------
 //  NumericLabel class -- derived class of Label class
 //
-//  2016/03/29, Copyright (c) 2016 MIKAMI, Naoki
+//  2016/04/08, Copyright (c) 2016 MIKAMI, Naoki
 //-----------------------------------------------------------
 
 #ifndef F746_NUMERIC_LABEL_HPP
@@ -16,7 +16,7 @@
     public:
         // Constructor without drawing value
         NumericLabel(uint16_t x, uint16_t y,
-                     TextAlignMode mode = Label::LEFT,
+                     TextAlignMode mode = LEFT,
                      sFONT &fonts = Font12,
                      uint32_t textColor = GuiBase::ENUM_TEXT,
                      uint32_t backColor = GuiBase::ENUM_BACK)
@@ -25,7 +25,7 @@
         // Constructor with drawing value
         NumericLabel(uint16_t x, uint16_t y,
                      const char fmt[], T val,
-                     TextAlignMode mode = Label::LEFT,
+                     TextAlignMode mode = LEFT,
                      sFONT &fonts = Font12,
                      uint32_t textColor = GuiBase::ENUM_TEXT,
                      uint32_t backColor = GuiBase::ENUM_BACK)