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

Dependents:   F746_SD_GraphicEqualizer_ren0620

Fork of F746_GUI by 不韋 呂

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers SeekbarGroup.hpp Source File

SeekbarGroup.hpp

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