GUI parts for DISCO-F469I a fork of DISCO-F746NG. GuiBase, Button, ButtonGroup, ResetButton, Label, BlinkLabel, NumericLabel, SeekBar, SeekbarGroup
Dependents: DISCO-F469NI_LCDTS_GUI_demo DISCO-F469NI_LCDTS_GUI_demo projekt_PSW_v1 DISCO-F469NI_LCDTS_GUI_demoaaaaaaaaaxxxx ... more
Fork of F746_GUI by
Diff: SeekBar.cpp
- Revision:
- 15:0511a08a3c09
- Parent:
- 12:687ec6183385
- Child:
- 16:b2762ec08863
diff -r b977160de2f3 -r 0511a08a3c09 SeekBar.cpp --- a/SeekBar.cpp Sun Jul 03 02:07:07 2016 +0000 +++ b/SeekBar.cpp Mon Jul 11 05:20:33 2016 +0000 @@ -1,7 +1,7 @@ //----------------------------------------------------------- // SeekBar class // -// 2016/04/30, Copyright (c) 2016 MIKAMI, Naoki +// 2016/07/11, Copyright (c) 2016 MIKAMI, Naoki //----------------------------------------------------------- #include "SeekBar.hpp" @@ -23,19 +23,19 @@ labelOn_(true), slided_(false), active_(true) { Draw(initialValue); - labelLCR = new Label *[3]; + labelLCR_ = new Label *[3]; uint16_t y0 = y - thumbSize/2 - 13; - labelLCR[0] = new Label(x, y0, left, Label::CENTER); - labelLCR[1] = new Label(x+length/2, y0, center, Label::CENTER); - labelLCR[2] = new Label(x+length, y0, right, Label::CENTER); + labelLCR_[0] = new Label(x, y0, left, Label::CENTER); + labelLCR_[1] = new Label(x+length/2, y0, center, Label::CENTER); + labelLCR_[2] = new Label(x+length, y0, right, Label::CENTER); } SeekBar::~SeekBar() { if (labelOn_) { - for (int n=0; n<3; n++) delete labelLCR[n]; - delete[] labelLCR; + for (int n=0; n<3; n++) delete labelLCR_[n]; + delete[] labelLCR_; } } @@ -68,7 +68,7 @@ active_ = true; Draw(v_); if (labelOn_) - for (int n=0; n<3; n++) labelLCR[n]->Draw(TEXT_COLOR_); + for (int n=0; n<3; n++) labelLCR_[n]->Draw(TEXT_COLOR_); } void SeekBar::Inactivate() @@ -76,7 +76,7 @@ active_ = false; Draw(v_); if (labelOn_) - for (int n=0; n<3; n++) labelLCR[n]->Draw(INACTIVE_TEXT_COLOR_); + for (int n=0; n<3; n++) labelLCR_[n]->Draw(INACTIVE_TEXT_COLOR_); } // If touched position is on the thumb, return true @@ -156,6 +156,13 @@ } } + void SeekBar::Redraw(bool fill) + { + Draw(GetValue(), fill); + if (labelOn_) + for (int n=0; n<3; n++) labelLCR_[n]->Draw(TEXT_COLOR_); + } + SeekBar::Point SeekBar::ToPoint(float value) { if (ORIENT_ == Holizontal)