New IHM
Dependencies: Array_Matrix TS_DISCO_F746NG LCD_DISCO_F746NG BSP_DISCO_F746NG
SeekbarGroup.hpp@11:7debdaa7b503, 2016-04-27 (annotated)
- Committer:
- MikamiUitOpen
- Date:
- Wed Apr 27 07:28:04 2016 +0000
- Revision:
- 11:7debdaa7b503
- Child:
- 12:687ec6183385
12
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
MikamiUitOpen | 11:7debdaa7b503 | 1 | //----------------------------------------------------------- |
MikamiUitOpen | 11:7debdaa7b503 | 2 | // SeekbarGroup class -- Header |
MikamiUitOpen | 11:7debdaa7b503 | 3 | // |
MikamiUitOpen | 11:7debdaa7b503 | 4 | // 2016/04/27, Copyright (c) 2016 MIKAMI, Naoki |
MikamiUitOpen | 11:7debdaa7b503 | 5 | //----------------------------------------------------------- |
MikamiUitOpen | 11:7debdaa7b503 | 6 | |
MikamiUitOpen | 11:7debdaa7b503 | 7 | #ifndef F746_SEEKBAR_GROUP_HPP |
MikamiUitOpen | 11:7debdaa7b503 | 8 | #define F746_SEEKBAR_GROUP_HPP |
MikamiUitOpen | 11:7debdaa7b503 | 9 | |
MikamiUitOpen | 11:7debdaa7b503 | 10 | #include "SeekBar.hpp" |
MikamiUitOpen | 11:7debdaa7b503 | 11 | |
MikamiUitOpen | 11:7debdaa7b503 | 12 | namespace Mikami |
MikamiUitOpen | 11:7debdaa7b503 | 13 | { |
MikamiUitOpen | 11:7debdaa7b503 | 14 | class SeekbarGroup : public GuiBase |
MikamiUitOpen | 11:7debdaa7b503 | 15 | { |
MikamiUitOpen | 11:7debdaa7b503 | 16 | public: |
MikamiUitOpen | 11:7debdaa7b503 | 17 | SeekbarGroup(uint16_t x0, uint16_t y0, uint16_t length, |
MikamiUitOpen | 11:7debdaa7b503 | 18 | uint16_t number, uint16_t space, |
MikamiUitOpen | 11:7debdaa7b503 | 19 | float min, float max, float initialValue, |
MikamiUitOpen | 11:7debdaa7b503 | 20 | SeekBar::Orientation hv = SeekBar::Holizontal, |
MikamiUitOpen | 11:7debdaa7b503 | 21 | uint32_t thumbColor = LCD_COLOR_WHITE, |
MikamiUitOpen | 11:7debdaa7b503 | 22 | uint16_t thumbSize = 30, uint16_t width = 4, |
MikamiUitOpen | 11:7debdaa7b503 | 23 | uint32_t colorL = LCD_COLOR_LIGHTGRAY, |
MikamiUitOpen | 11:7debdaa7b503 | 24 | uint32_t colorH = 0xFFB0B0B0, |
MikamiUitOpen | 11:7debdaa7b503 | 25 | uint32_t backColor = GuiBase::ENUM_BACK); |
MikamiUitOpen | 11:7debdaa7b503 | 26 | |
MikamiUitOpen | 11:7debdaa7b503 | 27 | ~SeekbarGroup(); |
MikamiUitOpen | 11:7debdaa7b503 | 28 | |
MikamiUitOpen | 11:7debdaa7b503 | 29 | bool Slide(int num) { return seekBars_[num]->Slide(); } |
MikamiUitOpen | 11:7debdaa7b503 | 30 | float GetValue(int num) { return seekBars_[num]->GetValue(); } |
MikamiUitOpen | 11:7debdaa7b503 | 31 | int GetIntValue(int num) { return seekBars_[num]->Round(seekBars_[num]->GetIntValue()); } |
MikamiUitOpen | 11:7debdaa7b503 | 32 | |
MikamiUitOpen | 11:7debdaa7b503 | 33 | // Get slided number |
MikamiUitOpen | 11:7debdaa7b503 | 34 | bool GetSlidedNumber(int &num); |
MikamiUitOpen | 11:7debdaa7b503 | 35 | |
MikamiUitOpen | 11:7debdaa7b503 | 36 | void Draw(int num, float value, bool fill = false) |
MikamiUitOpen | 11:7debdaa7b503 | 37 | { seekBars_[num]->Draw(value, fill); } |
MikamiUitOpen | 11:7debdaa7b503 | 38 | |
MikamiUitOpen | 11:7debdaa7b503 | 39 | // Draw all thumbs with same value |
MikamiUitOpen | 11:7debdaa7b503 | 40 | void DrawAll(float value, bool fill = false) |
MikamiUitOpen | 11:7debdaa7b503 | 41 | { for (int n=0; n<numberOfSeekBar_; n++) Draw(n, value, fill); } |
MikamiUitOpen | 11:7debdaa7b503 | 42 | |
MikamiUitOpen | 11:7debdaa7b503 | 43 | void Redraw(int num, bool fill = false) |
MikamiUitOpen | 11:7debdaa7b503 | 44 | { seekBars_[num]->Draw(seekBars_[num]->GetValue(), fill); } |
MikamiUitOpen | 11:7debdaa7b503 | 45 | |
MikamiUitOpen | 11:7debdaa7b503 | 46 | void RedrawAll(bool fill = false) |
MikamiUitOpen | 11:7debdaa7b503 | 47 | { for (int n=0; n<numberOfSeekBar_; n++) Redraw(n, fill); } |
MikamiUitOpen | 11:7debdaa7b503 | 48 | |
MikamiUitOpen | 11:7debdaa7b503 | 49 | // Activate and inactivate |
MikamiUitOpen | 11:7debdaa7b503 | 50 | void Activate(int num) { seekBars_[num]->Activate(); } |
MikamiUitOpen | 11:7debdaa7b503 | 51 | void Inactivate(int num) { seekBars_[num]->Inactivate(); } |
MikamiUitOpen | 11:7debdaa7b503 | 52 | void ActivateAll() |
MikamiUitOpen | 11:7debdaa7b503 | 53 | { |
MikamiUitOpen | 11:7debdaa7b503 | 54 | for (int n=0; n<numberOfSeekBar_; n++) |
MikamiUitOpen | 11:7debdaa7b503 | 55 | seekBars_[n]->Activate(); |
MikamiUitOpen | 11:7debdaa7b503 | 56 | } |
MikamiUitOpen | 11:7debdaa7b503 | 57 | void InactivateAll() |
MikamiUitOpen | 11:7debdaa7b503 | 58 | { |
MikamiUitOpen | 11:7debdaa7b503 | 59 | for (int n=0; n<numberOfSeekBar_; n++) |
MikamiUitOpen | 11:7debdaa7b503 | 60 | seekBars_[n]->Inactivate(); |
MikamiUitOpen | 11:7debdaa7b503 | 61 | } |
MikamiUitOpen | 11:7debdaa7b503 | 62 | |
MikamiUitOpen | 11:7debdaa7b503 | 63 | private: |
MikamiUitOpen | 11:7debdaa7b503 | 64 | SeekBar **seekBars_; |
MikamiUitOpen | 11:7debdaa7b503 | 65 | int numberOfSeekBar_; |
MikamiUitOpen | 11:7debdaa7b503 | 66 | |
MikamiUitOpen | 11:7debdaa7b503 | 67 | // Check range of argument |
MikamiUitOpen | 11:7debdaa7b503 | 68 | bool Range(int n) |
MikamiUitOpen | 11:7debdaa7b503 | 69 | { return ((n >= 0) && (n < numberOfSeekBar_)); } |
MikamiUitOpen | 11:7debdaa7b503 | 70 | |
MikamiUitOpen | 11:7debdaa7b503 | 71 | // disallow copy constructor and assignment operator |
MikamiUitOpen | 11:7debdaa7b503 | 72 | SeekbarGroup(const SeekbarGroup&); |
MikamiUitOpen | 11:7debdaa7b503 | 73 | SeekbarGroup& operator=(const SeekbarGroup&); |
MikamiUitOpen | 11:7debdaa7b503 | 74 | }; |
MikamiUitOpen | 11:7debdaa7b503 | 75 | } |
MikamiUitOpen | 11:7debdaa7b503 | 76 | #endif // F746_SEEKBAR_GROUP_HPP |