Mladen Adamovic / F746_GUI

Dependencies:   Array_Matrix BSP_DISCO_F746NG LCD_DISCO_F746NG TS_DISCO_F746NG

Dependents:   Spectrogram

Fork of F746_GUI by 不韋 呂

Files at this revision

API Documentation at this revision

Comitter:
MikamiUitOpen
Date:
Mon Jul 11 05:20:33 2016 +0000
Parent:
14:b977160de2f3
Child:
16:b2762ec08863
Commit message:
16

Changed in this revision

SeekBar.cpp Show annotated file Show diff for this revision Revisions of this file
SeekBar.hpp Show annotated file Show diff for this revision Revisions of this file
--- a/SeekBar.cpp	Sun Jul 03 02:07:07 2016 +0000
+++ b/SeekBar.cpp	Mon Jul 11 05:20:33 2016 +0000
@@ -1,7 +1,7 @@
 //-----------------------------------------------------------
 //  SeekBar class
 //
-//  2016/04/30, Copyright (c) 2016 MIKAMI, Naoki
+//  2016/07/11, Copyright (c) 2016 MIKAMI, Naoki
 //-----------------------------------------------------------
 
 #include "SeekBar.hpp"
@@ -23,19 +23,19 @@
           labelOn_(true), slided_(false), active_(true)
     {
         Draw(initialValue);
-        labelLCR = new Label *[3];
+        labelLCR_ = new Label *[3];
         uint16_t y0 = y - thumbSize/2 - 13;
-        labelLCR[0] = new Label(x, y0, left, Label::CENTER);
-        labelLCR[1] = new Label(x+length/2, y0, center, Label::CENTER);
-        labelLCR[2] = new Label(x+length, y0, right, Label::CENTER);
+        labelLCR_[0] = new Label(x, y0, left, Label::CENTER);
+        labelLCR_[1] = new Label(x+length/2, y0, center, Label::CENTER);
+        labelLCR_[2] = new Label(x+length, y0, right, Label::CENTER);
     }
 
     SeekBar::~SeekBar()
     {
         if (labelOn_)
         {
-            for (int n=0; n<3; n++) delete labelLCR[n];
-            delete[] labelLCR;
+            for (int n=0; n<3; n++) delete labelLCR_[n];
+            delete[] labelLCR_;
         }
     }
 
@@ -68,7 +68,7 @@
         active_ = true;
         Draw(v_);
         if (labelOn_)
-            for (int n=0; n<3; n++) labelLCR[n]->Draw(TEXT_COLOR_);
+            for (int n=0; n<3; n++) labelLCR_[n]->Draw(TEXT_COLOR_);
     }
 
     void SeekBar::Inactivate()
@@ -76,7 +76,7 @@
         active_ = false;
         Draw(v_);
         if (labelOn_)
-            for (int n=0; n<3; n++) labelLCR[n]->Draw(INACTIVE_TEXT_COLOR_);
+            for (int n=0; n<3; n++) labelLCR_[n]->Draw(INACTIVE_TEXT_COLOR_);
     }
 
     // If touched position is on the thumb, return true
@@ -156,6 +156,13 @@
         }
     }
 
+    void SeekBar::Redraw(bool fill)
+    {
+        Draw(GetValue(), fill);
+        if (labelOn_)
+            for (int n=0; n<3; n++) labelLCR_[n]->Draw(TEXT_COLOR_);
+    }
+
     SeekBar::Point SeekBar::ToPoint(float value)
     {
         if (ORIENT_ == Holizontal)
--- a/SeekBar.hpp	Sun Jul 03 02:07:07 2016 +0000
+++ b/SeekBar.hpp	Mon Jul 11 05:20:33 2016 +0000
@@ -1,7 +1,7 @@
 //-----------------------------------------------------------
 //  SeekBar class -- Header
 //
-//  2016/05/30, Copyright (c) 2016 MIKAMI, Naoki
+//  2016/07/11, Copyright (c) 2016 MIKAMI, Naoki
 //-----------------------------------------------------------
 
 #ifndef F746_SEEKBAR_HPP
@@ -61,6 +61,7 @@
 
         bool IsOnThumb(uint16_t &x, uint16_t &y);
         void Draw(float value, bool fill = false);
+        void Redraw(bool fill = false);
         float ToValue(Point pt);
 
         void SetValue(float v) { v_ = v; }
@@ -74,7 +75,7 @@
         const float MIN_, MAX_;
         const Orientation ORIENT_;
 
-        Label **labelLCR;
+        Label **labelLCR_;
         float v_;             // value of seekbar
         bool labelOn_;
         bool slided_;
@@ -90,4 +91,3 @@
     };
 }
 #endif  // F746_SEEKBAR_HPP
-