New IHM
Dependencies: Array_Matrix TS_DISCO_F746NG LCD_DISCO_F746NG BSP_DISCO_F746NG
Diff: SeekBar.cpp
- Revision:
- 15:0511a08a3c09
- Parent:
- 12:687ec6183385
- Child:
- 16:b2762ec08863
--- 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)