GUI parts for DISCO-F746NG. GuiBase, Button, ButtonGroup, ResetButton, Label, BlinkLabel, NumericLabel, SeekBar, SeekbarGroup, NumericUpDown

Dependencies:   Array_Matrix BSP_DISCO_F746NG LCD_DISCO_F746NG TS_DISCO_F746NG

Dependents:   F746_AudioOutQSPI F746_AudioPlayerSD DISCO-F746NG_test001 F746_SD_WavPlayer ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers SeekbarGroup.hpp Source File

SeekbarGroup.hpp

00001 //-----------------------------------------------------------
00002 //  SeekbarGroup class -- Header
00003 //
00004 //  2017/01/25, Copyright (c) 2017 MIKAMI, Naoki
00005 //-----------------------------------------------------------
00006 
00007 #ifndef F746_SEEKBAR_GROUP_HPP
00008 #define F746_SEEKBAR_GROUP_HPP
00009 
00010 #include "SeekBar.hpp"
00011 #include "Array.hpp"
00012 
00013 namespace Mikami
00014 {
00015     class SeekbarGroup
00016     {
00017     public:
00018         SeekbarGroup(uint16_t x0, uint16_t y0,  uint16_t length,
00019                      uint16_t number, uint16_t space,
00020                      float min, float max, float initialValue,
00021                      SeekBar::Orientation hv = SeekBar::Holizontal,
00022                      uint32_t thumbColor = 0xFFB0B0FF,
00023                      uint16_t thumbSize = 30, uint16_t width = 4,
00024                      uint32_t colorL = LCD_COLOR_LIGHTGRAY,
00025                      uint32_t colorH = 0xFFB0B0B0,
00026                      uint32_t backColor = GuiBase::ENUM_BACK);
00027 
00028         virtual ~SeekbarGroup()
00029         {   for (int n=0; n<NUMBER_; n++) delete seekBars_[n]; }
00030 
00031         bool Slide(int num) { return seekBars_[num]->Slide(); }
00032         float GetValue(int num) { return seekBars_[num]->GetValue(); }
00033         int GetIntValue(int num) { return seekBars_[num]->GetIntValue(); }
00034 
00035         // Get slided number
00036         bool GetSlidedNumber(int &num);
00037 
00038         void Draw(int num, float value, bool fill = false)
00039         {   seekBars_[num]->Draw(value, fill); }
00040 
00041         // Draw all thumbs with same value
00042         void DrawAll(float value, bool fill = false)
00043         {   for (int n=0; n<NUMBER_; n++) Draw(n, value, fill); }
00044 
00045         void Redraw(int num, bool fill = false)
00046         {   seekBars_[num]->Draw(seekBars_[num]->GetValue(), fill); }
00047 
00048         void RedrawAll(bool fill = false)
00049         {   for (int n=0; n<NUMBER_; n++) Redraw(n, fill); }
00050 
00051         // Activate and inactivate
00052         void Activate(int num) { seekBars_[num]->Activate(); }
00053         void Inactivate(int num) { seekBars_[num]->Inactivate(); }
00054         void ActivateAll()
00055         {
00056             for (int n=0; n<NUMBER_; n++)
00057                 seekBars_[n]->Activate();
00058         }
00059         void InactivateAll()
00060         {
00061             for (int n=0; n<NUMBER_; n++)
00062                 seekBars_[n]->Inactivate();
00063         }
00064 
00065     private:
00066         const int NUMBER_;
00067         Array<SeekBar *> seekBars_;
00068 
00069         // Check range of argument
00070         bool Range(int n)
00071         { return ((n >= 0) && (n < NUMBER_)); }
00072 
00073         // disallow copy constructor and assignment operator
00074         SeekbarGroup(const SeekbarGroup&);
00075         SeekbarGroup& operator=(const SeekbarGroup&);
00076     };
00077 }
00078 #endif  //  F746_SEEKBAR_GROUP_HPP
00079