GUI parts for DISCO-F746NG. GuiBase, Button, ButtonGroup, ResetButton, Label, BlinkLabel, NumericLabel, SeekBar, SeekbarGroup, NumericUpDown

Dependencies:   Array_Matrix BSP_DISCO_F746NG LCD_DISCO_F746NG TS_DISCO_F746NG

Dependents:   F746_AudioOutQSPI F746_AudioPlayerSD DISCO-F746NG_test001 F746_SD_WavPlayer ... more

Revision:
0:a2686ef737c2
Child:
4:cbf7ed9092a3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/NumericLabel.hpp	Thu Mar 31 07:28:42 2016 +0000
@@ -0,0 +1,49 @@
+//-----------------------------------------------------------
+//  NumericLabel class -- derived class of Label class
+//
+//  2016/03/29, Copyright (c) 2016 MIKAMI, Naoki
+//-----------------------------------------------------------
+
+#ifndef F746_NUMERIC_LABEL_HPP
+#define F746_NUMERIC_LABEL_HPP
+
+#include "Label.hpp"
+
+namespace Mikami
+{
+    template <typename T> class NumericLabel : public Label
+    {
+    public:
+        // Constructor without drawing value
+        NumericLabel(uint16_t x, uint16_t y,
+                     TextAlignMode mode = Label::LEFT,
+                     sFONT &fonts = Font12,
+                     uint32_t textColor = GuiBase::ENUM_TEXT,
+                     uint32_t backColor = GuiBase::ENUM_BACK)
+            : Label(x, y, "", mode, fonts, textColor, backColor) {}
+
+        // Constructor with drawing value
+        NumericLabel(uint16_t x, uint16_t y,
+                     const char fmt[], T val,
+                     TextAlignMode mode = Label::LEFT,
+                     sFONT &fonts = Font12,
+                     uint32_t textColor = GuiBase::ENUM_TEXT,
+                     uint32_t backColor = GuiBase::ENUM_BACK)
+            : Label(x, y, "", mode, fonts, textColor, backColor)
+        {   Draw(fmt, val); }
+
+        // Draw value
+        void Draw(const char fmt[], T val)
+        {
+            char str[81];
+            sprintf(str, fmt, val);
+            Label::Draw(str);
+        }
+
+    private:
+        // disallow copy constructor and assignment operator
+        NumericLabel(const NumericLabel&);
+        NumericLabel& operator=(const NumericLabel&);
+    };
+}
+#endif  // F746_NUMERIC_LABEL_HPP