New IHM
Dependencies: Array_Matrix TS_DISCO_F746NG LCD_DISCO_F746NG BSP_DISCO_F746NG
Diff: ButtonGroup.hpp
- Revision:
- 14:b977160de2f3
- Parent:
- 8:8c5107c91d02
- Child:
- 16:b2762ec08863
--- a/ButtonGroup.hpp Mon May 30 14:34:44 2016 +0000 +++ b/ButtonGroup.hpp Sun Jul 03 02:07:07 2016 +0000 @@ -1,7 +1,7 @@ //----------------------------------------------------------- // ButtonGroup class -- Header // -// 2016/04/21, Copyright (c) 2016 MIKAMI, Naoki +// 2016/07/02, Copyright (c) 2016 MIKAMI, Naoki //----------------------------------------------------------- #ifndef F746_BUTTON_GROUP_HPP @@ -41,14 +41,13 @@ // Draw all buttons void DrawAll(uint32_t color, uint32_t textColor) - { - for (int n=0; n<numberOfButtons_; n++) - buttons_[n]->Draw(color, textColor); - } + { for (int n=0; n<number_; n++) Draw(n, color, textColor); } void DrawAll() { DrawAll(CREATED_COLOR_, TEXT_COLOR_); } // Erase button bool Erase(int num); + void EraseAll() + { for (int n=0; n<number_; n++) Erase(n); } // Check touch detected for specified button bool Touched(int num); @@ -56,28 +55,22 @@ // Get touched number bool GetTouchedNumber(int &num); - // Activate and inactivate + // Activate and inactivate button(s) bool Activate(int num); - bool Inactivate(int num); void ActivateAll() - { - for (int n=0; n<numberOfButtons_; n++) - buttons_[n]->Activate(); - } + { for (int n=0; n<number_; n++) Activate(n); } + bool Inactivate(int num); void InactivateAll() - { - for (int n=0; n<numberOfButtons_; n++) - buttons_[n]->Inactivate(); - } + { for (int n=0; n<number_; n++) Inactivate(n); } private: Button **buttons_; - int numberOfButtons_; + int number_; __IO int prevNum_; // Check range of argument bool Range(int n) - { return ((n >= 0) && (n < numberOfButtons_)); } + { return ((n >= 0) && (n < number_)); } // disallow copy constructor and assignment operator ButtonGroup(const ButtonGroup&);