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
SeekbarGroup.cpp
00001 //----------------------------------------------------------- 00002 // SeekbarGroup class 00003 // 00004 // 2017/01/25, Copyright (c) 2017 MIKAMI, Naoki 00005 //----------------------------------------------------------- 00006 00007 #include "SeekbarGroup.hpp" 00008 00009 namespace Mikami 00010 { 00011 SeekbarGroup::SeekbarGroup( 00012 uint16_t x0, uint16_t y0, uint16_t length, 00013 uint16_t number, uint16_t space, 00014 float min, float max, float initialValue, 00015 SeekBar::Orientation hv, 00016 uint32_t thumbColor, uint16_t thumbSize, uint16_t width, 00017 uint32_t colorL, uint32_t colorH, uint32_t backColor) 00018 : NUMBER_(number) 00019 { 00020 seekBars_.SetSize(number); 00021 for (int n=0; n<number; n++) 00022 { 00023 uint16_t x = x0; 00024 uint16_t y = y0; 00025 if (hv == SeekBar::Holizontal) y += space*n; 00026 else x += space*n; 00027 seekBars_[n] = 00028 new SeekBar(x, y, length, min, max, initialValue, hv, 00029 thumbColor, thumbSize, width, 00030 colorL, colorH, backColor); 00031 } 00032 } 00033 00034 // Get slided number 00035 bool SeekbarGroup::GetSlidedNumber(int &num) 00036 { 00037 bool active = false; 00038 for (int n=0; n<NUMBER_; n++) 00039 if (seekBars_[n]->IsActive()) active = true; 00040 if (!active) return false; 00041 00042 if (!GuiBase::PanelTouched()) 00043 { 00044 for (int n=0; n<NUMBER_; n++) 00045 { 00046 if (seekBars_[n]->GetSlided()) 00047 seekBars_[n]->Draw(seekBars_[n]->GetValue()); 00048 seekBars_[n]->SetSlided(false); 00049 } 00050 return false; 00051 } 00052 00053 bool rtn = false; 00054 uint16_t x, y; 00055 for (int n=0; n<NUMBER_; n++) 00056 { 00057 if (seekBars_[n]->IsOnThumb(x, y)) 00058 { 00059 if ((num != n) && Range(num)) 00060 seekBars_[num]->Draw(seekBars_[num]->GetValue()); 00061 num = n; 00062 seekBars_[n]->SetValue(seekBars_[n]->ToValue(SeekBar::Point(x, y))); 00063 seekBars_[n]->Draw(seekBars_[n]->GetValue(), true); 00064 seekBars_[n]->SetSlided(true); 00065 rtn = true; 00066 } 00067 if (rtn) break; 00068 } 00069 return rtn; 00070 } 00071 } 00072
Generated on Wed Jul 13 2022 14:24:25 by 1.7.2