Class library: Button class and ButtonGroup class for DISCO-F746NG. クラスライブラリ: DISCO-F746NG 用の,Button クラス,ButtonGroup クラス.

Dependents:   F746_SpectralAnalysis_NoPhoto F746_Fourier_series_of_square_wave_01 F746_ButtonGroup_Demo F746_Mandelbrot ... more

Revision:
6:d268555e2f50
Parent:
5:2cc388e91bde
Child:
7:6913aebb3905
--- a/button_group.cpp	Tue Dec 08 14:19:41 2015 +0000
+++ b/button_group.cpp	Wed Dec 09 01:55:25 2015 +0000
@@ -1,7 +1,7 @@
 //-----------------------------------------------------------
 //  Button group class
 //
-//  2015/12/07, Copyright (c) 2015 MIKAMI, Naoki
+//  2015/12/09, Copyright (c) 2015 MIKAMI, Naoki
 //-----------------------------------------------------------
 
 #include "button_group.hpp"
@@ -50,6 +50,20 @@
         return false;
     }
 
+    // Check touch detected for specified button and redraw
+    bool ButtonGroup::Touched(int num, uint32_t color,
+                              uint32_t textColor)
+    {
+        if (buttons_[num]->Touched(color, textColor))
+        {
+            for (int n=0; n<numberOfButtons_; n++)
+                if (n != num) buttons_[n]->Redraw();
+            return true;
+        }
+        else
+            return false;
+    }
+
     // Get touched number and redraw button if touched
     bool ButtonGroup::GetTouchedNumber(int &num, uint32_t color)
     {
@@ -59,7 +73,7 @@
                 if (n == num)
                     buttons_[n]->Draw(color);
                 else
-                    buttons_[n]->Draw(buttons_[n]->GetOriginalColor());
+                    buttons_[n]->Redraw();
             return true;
         }
         else