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:
- 6:b8f197b0012c
- Parent:
- 5:9c3ea4d4bc6b
- Child:
- 9:c379410bda15
diff -r 9c3ea4d4bc6b -r b8f197b0012c SeekBar.cpp --- a/SeekBar.cpp Sun Apr 10 09:25:36 2016 +0000 +++ b/SeekBar.cpp Tue Apr 12 04:15:41 2016 +0000 @@ -1,13 +1,33 @@ //----------------------------------------------------------- // SeekBar class // -// 2016/04/10, Copyright (c) 2016 MIKAMI, Naoki +// 2016/04/12, Copyright (c) 2016 MIKAMI, Naoki //----------------------------------------------------------- #include "SeekBar.hpp" namespace Mikami { + // Constructor with scale value (only horizontal) + SeekBar::SeekBar(uint16_t x, uint16_t y, uint16_t length, + float min, float max, float initialValue, + string left, string center, string right, + uint32_t thumbColor, + uint16_t thumbSize, uint16_t width, + uint32_t colorL, uint32_t colorH, + uint32_t backColor) + : GuiBase(x, y, Font12, GuiBase::ENUM_TEXT, backColor, thumbColor), + L_(length), W_(width), + SIZE_(thumbSize), COLOR_L_(colorL), COLOR_H_(colorH), + MIN_(min), MAX_(max), ORIENT_(Holizontal), + v_(initialValue), active_(true) + { + Draw(initialValue); + labelL = new Label(x, y-28, left, Label::CENTER); + labelC = new Label(x+length/2, y-28, center, Label::CENTER); + labelR = new Label(x+length, y-28, right, Label::CENTER); + } + // Slide thumb // If the thumb is not touched, return false bool SeekBar::Slide() @@ -32,17 +52,29 @@ return rtn; } - + void SeekBar::Activate() { active_ = true; Draw(v_); + if (labelL != NULL) + { + labelL->Draw(TEXT_COLOR_); + labelC->Draw(TEXT_COLOR_); + labelR->Draw(TEXT_COLOR_); + } } - + void SeekBar::Inactivate() { active_ = false; Draw(v_); + if (labelL != NULL) + { + labelL->Draw(INACTIVE_TEXT_COLOR_); + labelC->Draw(INACTIVE_TEXT_COLOR_); + labelR->Draw(INACTIVE_TEXT_COLOR_); + } } // Draw seekbar @@ -128,4 +160,3 @@ return value; } } -