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:
Wed Apr 27 07:28:04 2016 +0000
Parent:
10:5a2068884fd9
Child:
12:687ec6183385
Commit message:
12

Changed in this revision

SeekBar.hpp Show annotated file Show diff for this revision Revisions of this file
SeekBarGroup.cpp Show diff for this revision Revisions of this file
SeekBarGroup.hpp Show diff for this revision Revisions of this file
SeekbarGroup.cpp Show annotated file Show diff for this revision Revisions of this file
SeekbarGroup.hpp Show annotated file Show diff for this revision Revisions of this file
--- a/SeekBar.hpp	Wed Apr 27 00:24:18 2016 +0000
+++ b/SeekBar.hpp	Wed Apr 27 07:28:04 2016 +0000
@@ -1,7 +1,7 @@
 //-----------------------------------------------------------
 //  SeekBar class -- Header
 //
-//  2016/04/26, Copyright (c) 2016 MIKAMI, Naoki
+//  2016/04/27, Copyright (c) 2016 MIKAMI, Naoki
 //-----------------------------------------------------------
 
 #ifndef F746_SEEKBAR_HPP
@@ -89,3 +89,4 @@
     };
 }
 #endif  // F746_SEEKBAR_HPP
+
--- a/SeekBarGroup.cpp	Wed Apr 27 00:24:18 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-//-----------------------------------------------------------
-//  SeekBarGroup class
-//
-//  2016/04/26, Copyright (c) 2016 MIKAMI, Naoki
-//-----------------------------------------------------------
-
-#include "SeekBarGroup.hpp"
-
-namespace Mikami
-{
-    SeekbarGroup::SeekbarGroup(
-            uint16_t x0, uint16_t y0, uint16_t length,
-            uint16_t number, uint16_t space,
-            float min, float max, float initialValue,
-            SeekBar::Orientation hv,
-            uint32_t thumbColor,
-            uint16_t thumbSize, uint16_t width,
-            uint32_t colorL, uint32_t colorH,
-            uint32_t backColor)
-        : GuiBase(x0, y0, Font12, GuiBase::ENUM_TEXT, backColor, thumbColor),
-          numberOfSeekBar_(number)
-    {
-        seekBars_ = new SeekBar *[number];
-        for (int n=0; n<number; n++)
-        {
-            uint16_t x = x0;
-            uint16_t y = y0;
-            if (hv == SeekBar::Holizontal) y += space*n;
-            else                           x += space*n;
-            seekBars_[n] =
-                new SeekBar(x, y, length, min, max, initialValue, hv,
-                            thumbColor, thumbSize, width,
-                            colorL, colorH, backColor);
-        }
-    }
-
-    // Destructor
-    SeekbarGroup::~SeekbarGroup()
-    {
-        for (int n=0; n<numberOfSeekBar_; n++) delete seekBars_[n];
-        delete[] *seekBars_;
-    }
-
-    // Get slided number
-    bool SeekbarGroup::GetSlidedNumber(int &num)
-    {
-        bool active = false;
-        for (int n=0; n<numberOfSeekBar_; n++)
-            if (seekBars_[n]->IsActive()) active = true;
-        if (!active) return false;
-
-        if (!PanelTouched())
-        {
-            for (int n=0; n<numberOfSeekBar_; n++)
-            {
-                if (seekBars_[n]->GetSlided())
-                    seekBars_[n]->Draw(seekBars_[n]->GetValue());
-                seekBars_[n]->SetSlided(false);
-            }
-            return false;
-        }
-
-        bool rtn = false;
-        uint16_t x, y;
-        for (int n=0; n<numberOfSeekBar_; n++)
-        {
-            if (seekBars_[n]->IsOnThumb(x, y))
-            {
-                if ((num != n) && Range(num))
-                    seekBars_[num]->Draw(seekBars_[num]->GetValue());
-                num = n;
-                seekBars_[n]->SetValue(seekBars_[n]->ToValue(SeekBar::Point(x, y)));
-                seekBars_[n]->Draw(seekBars_[n]->GetValue(), true);
-                seekBars_[n]->SetSlided(true);
-                rtn = true;
-            }
-        }
-        return rtn;
-    }
-}
--- a/SeekBarGroup.hpp	Wed Apr 27 00:24:18 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +0,0 @@
-//-----------------------------------------------------------
-//  SeekBarGroup class -- Header
-//
-//  2016/04/26, Copyright (c) 2016 MIKAMI, Naoki
-//-----------------------------------------------------------
-
-#ifndef F746_SEEKBAR_GROUP_HPP
-#define F746_SEEKBAR_GROUP_HPP
-
-#include "SeekBar.hpp"
-
-namespace Mikami
-{
-    class SeekbarGroup : public GuiBase
-    {
-    public:
-        SeekbarGroup(uint16_t x0, uint16_t y0,  uint16_t length,
-                     uint16_t number, uint16_t space,
-                     float min, float max, float initialValue,
-                     SeekBar::Orientation hv = SeekBar::Holizontal,
-                     uint32_t thumbColor = LCD_COLOR_WHITE,
-                     uint16_t thumbSize = 30, uint16_t width = 4,
-                     uint32_t colorL = LCD_COLOR_LIGHTGRAY,
-                     uint32_t colorH = 0xFFB0B0B0,
-                     uint32_t backColor = GuiBase::ENUM_BACK);
-
-        ~SeekbarGroup();
-        
-        bool Slide(int num) { return seekBars_[num]->Slide(); }
-        float GetValue(int num) { return seekBars_[num]->GetValue(); }
-        int GetIntValue(int num) { return seekBars_[num]->Round(seekBars_[num]->GetIntValue()); }
-
-        // Get slided number
-        bool GetSlidedNumber(int &num);
-        
-        void Draw(int num, float value, bool fill = false)
-        {   seekBars_[num]->Draw(value, fill); }
-
-        void Redraw(int num, bool fill = false)
-        {   seekBars_[num]->Draw(seekBars_[num]->GetValue(), fill); }
-
-        void RedrawAll(bool fill = false)
-        {   for (int n=0; n<numberOfSeekBar_; n++) Redraw(n, fill); }
-
-        // Activate and inactivate
-        void Activate(int num) { seekBars_[num]->Activate(); }
-        void Inactivate(int num) { seekBars_[num]->Inactivate(); }
-        void ActivateAll()
-        {   
-            for (int n=0; n<numberOfSeekBar_; n++)
-                seekBars_[n]->Activate();
-        }
-        void InactivateAll()
-        {
-            for (int n=0; n<numberOfSeekBar_; n++)
-                seekBars_[n]->Inactivate();
-        }
-
-    private:
-        SeekBar **seekBars_;
-        int numberOfSeekBar_;
-
-        // Check range of argument
-        bool Range(int n)
-        { return ((n >= 0) && (n < numberOfSeekBar_)); }
-
-        // disallow copy constructor and assignment operator
-        SeekbarGroup(const SeekbarGroup&);
-        SeekbarGroup& operator=(const SeekbarGroup&);
-    };
-}
-#endif  //  F746_SEEKBAR_GROUP_HPP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SeekbarGroup.cpp	Wed Apr 27 07:28:04 2016 +0000
@@ -0,0 +1,80 @@
+//-----------------------------------------------------------
+//  SeekbarGroup class
+//
+//  2016/04/27, Copyright (c) 2016 MIKAMI, Naoki
+//-----------------------------------------------------------
+
+#include "SeekbarGroup.hpp"
+
+namespace Mikami
+{
+    SeekbarGroup::SeekbarGroup(
+            uint16_t x0, uint16_t y0, uint16_t length,
+            uint16_t number, uint16_t space,
+            float min, float max, float initialValue,
+            SeekBar::Orientation hv,
+            uint32_t thumbColor,
+            uint16_t thumbSize, uint16_t width,
+            uint32_t colorL, uint32_t colorH,
+            uint32_t backColor)
+        : GuiBase(x0, y0, Font12, GuiBase::ENUM_TEXT, backColor, thumbColor),
+          numberOfSeekBar_(number)
+    {
+        seekBars_ = new SeekBar *[number];
+        for (int n=0; n<number; n++)
+        {
+            uint16_t x = x0;
+            uint16_t y = y0;
+            if (hv == SeekBar::Holizontal) y += space*n;
+            else                           x += space*n;
+            seekBars_[n] =
+                new SeekBar(x, y, length, min, max, initialValue, hv,
+                            thumbColor, thumbSize, width,
+                            colorL, colorH, backColor);
+        }
+    }
+
+    // Destructor
+    SeekbarGroup::~SeekbarGroup()
+    {
+        for (int n=0; n<numberOfSeekBar_; n++) delete seekBars_[n];
+        delete[] *seekBars_;
+    }
+
+    // Get slided number
+    bool SeekbarGroup::GetSlidedNumber(int &num)
+    {
+        bool active = false;
+        for (int n=0; n<numberOfSeekBar_; n++)
+            if (seekBars_[n]->IsActive()) active = true;
+        if (!active) return false;
+
+        if (!PanelTouched())
+        {
+            for (int n=0; n<numberOfSeekBar_; n++)
+            {
+                if (seekBars_[n]->GetSlided())
+                    seekBars_[n]->Draw(seekBars_[n]->GetValue());
+                seekBars_[n]->SetSlided(false);
+            }
+            return false;
+        }
+
+        bool rtn = false;
+        uint16_t x, y;
+        for (int n=0; n<numberOfSeekBar_; n++)
+        {
+            if (seekBars_[n]->IsOnThumb(x, y))
+            {
+                if ((num != n) && Range(num))
+                    seekBars_[num]->Draw(seekBars_[num]->GetValue());
+                num = n;
+                seekBars_[n]->SetValue(seekBars_[n]->ToValue(SeekBar::Point(x, y)));
+                seekBars_[n]->Draw(seekBars_[n]->GetValue(), true);
+                seekBars_[n]->SetSlided(true);
+                rtn = true;
+            }
+        }
+        return rtn;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SeekbarGroup.hpp	Wed Apr 27 07:28:04 2016 +0000
@@ -0,0 +1,76 @@
+//-----------------------------------------------------------
+//  SeekbarGroup class -- Header
+//
+//  2016/04/27, Copyright (c) 2016 MIKAMI, Naoki
+//-----------------------------------------------------------
+
+#ifndef F746_SEEKBAR_GROUP_HPP
+#define F746_SEEKBAR_GROUP_HPP
+
+#include "SeekBar.hpp"
+
+namespace Mikami
+{
+    class SeekbarGroup : public GuiBase
+    {
+    public:
+        SeekbarGroup(uint16_t x0, uint16_t y0,  uint16_t length,
+                     uint16_t number, uint16_t space,
+                     float min, float max, float initialValue,
+                     SeekBar::Orientation hv = SeekBar::Holizontal,
+                     uint32_t thumbColor = LCD_COLOR_WHITE,
+                     uint16_t thumbSize = 30, uint16_t width = 4,
+                     uint32_t colorL = LCD_COLOR_LIGHTGRAY,
+                     uint32_t colorH = 0xFFB0B0B0,
+                     uint32_t backColor = GuiBase::ENUM_BACK);
+
+        ~SeekbarGroup();
+        
+        bool Slide(int num) { return seekBars_[num]->Slide(); }
+        float GetValue(int num) { return seekBars_[num]->GetValue(); }
+        int GetIntValue(int num) { return seekBars_[num]->Round(seekBars_[num]->GetIntValue()); }
+
+        // Get slided number
+        bool GetSlidedNumber(int &num);
+        
+        void Draw(int num, float value, bool fill = false)
+        {   seekBars_[num]->Draw(value, fill); }
+
+        // Draw all thumbs with same value
+        void DrawAll(float value, bool fill = false)
+        {   for (int n=0; n<numberOfSeekBar_; n++) Draw(n, value, fill); }
+
+        void Redraw(int num, bool fill = false)
+        {   seekBars_[num]->Draw(seekBars_[num]->GetValue(), fill); }
+
+        void RedrawAll(bool fill = false)
+        {   for (int n=0; n<numberOfSeekBar_; n++) Redraw(n, fill); }
+
+        // Activate and inactivate
+        void Activate(int num) { seekBars_[num]->Activate(); }
+        void Inactivate(int num) { seekBars_[num]->Inactivate(); }
+        void ActivateAll()
+        {   
+            for (int n=0; n<numberOfSeekBar_; n++)
+                seekBars_[n]->Activate();
+        }
+        void InactivateAll()
+        {
+            for (int n=0; n<numberOfSeekBar_; n++)
+                seekBars_[n]->Inactivate();
+        }
+
+    private:
+        SeekBar **seekBars_;
+        int numberOfSeekBar_;
+
+        // Check range of argument
+        bool Range(int n)
+        { return ((n >= 0) && (n < numberOfSeekBar_)); }
+
+        // disallow copy constructor and assignment operator
+        SeekbarGroup(const SeekbarGroup&);
+        SeekbarGroup& operator=(const SeekbarGroup&);
+    };
+}
+#endif  //  F746_SEEKBAR_GROUP_HPP