GUI parts for DISCO-F746NG. GuiBase, Button, ButtonGroup, ResetButton, Label, BlinkLabel, NumericLabel, SeekBar, SeekbarGroup, NumericUpDown
Dependencies: Array_Matrix TS_DISCO_F746NG LCD_DISCO_F746NG BSP_DISCO_F746NG
Diff: SeekbarGroup.hpp
- Revision:
- 28:e2b7ea78b7a0
- Parent:
- 16:b2762ec08863
--- a/SeekbarGroup.hpp Mon Jan 16 00:23:53 2017 +0000 +++ b/SeekbarGroup.hpp Wed Jan 25 13:56:02 2017 +0000 @@ -1,17 +1,18 @@ //----------------------------------------------------------- // SeekbarGroup class -- Header // -// 2016/07/12, Copyright (c) 2016 MIKAMI, Naoki +// 2017/01/25, Copyright (c) 2017 MIKAMI, Naoki //----------------------------------------------------------- #ifndef F746_SEEKBAR_GROUP_HPP #define F746_SEEKBAR_GROUP_HPP #include "SeekBar.hpp" +#include "Array.hpp" namespace Mikami { - class SeekbarGroup : public GuiBase + class SeekbarGroup { public: SeekbarGroup(uint16_t x0, uint16_t y0, uint16_t length, @@ -24,49 +25,50 @@ uint32_t colorH = 0xFFB0B0B0, uint32_t backColor = GuiBase::ENUM_BACK); - virtual ~SeekbarGroup(); - + virtual ~SeekbarGroup() + { for (int n=0; n<NUMBER_; n++) delete seekBars_[n]; } + bool Slide(int num) { return seekBars_[num]->Slide(); } float GetValue(int num) { return seekBars_[num]->GetValue(); } int GetIntValue(int num) { return 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); } + { for (int n=0; n<NUMBER_; 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); } + { for (int n=0; n<NUMBER_; 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++) + { + for (int n=0; n<NUMBER_; n++) seekBars_[n]->Activate(); } void InactivateAll() { - for (int n=0; n<numberOfSeekBar_; n++) + for (int n=0; n<NUMBER_; n++) seekBars_[n]->Inactivate(); } private: - SeekBar **seekBars_; - int numberOfSeekBar_; + const int NUMBER_; + Array<SeekBar *> seekBars_; // Check range of argument bool Range(int n) - { return ((n >= 0) && (n < numberOfSeekBar_)); } + { return ((n >= 0) && (n < NUMBER_)); } // disallow copy constructor and assignment operator SeekbarGroup(const SeekbarGroup&); @@ -74,3 +76,4 @@ }; } #endif // F746_SEEKBAR_GROUP_HPP +