GUI parts for DISCO-F746NG. GuiBase, Button, ButtonGroup, Label, BlinkLabel, NumericLabel, SeekBar, SeekbarGroup
Dependents: F746_SD_GraphicEqualizer_ren0620
Fork of F746_GUI by
Diff: SeekBar.cpp
- Revision:
- 5:9c3ea4d4bc6b
- Parent:
- 0:a2686ef737c2
- Child:
- 6:b8f197b0012c
--- a/SeekBar.cpp Fri Apr 08 09:32:49 2016 +0000
+++ b/SeekBar.cpp Sun Apr 10 09:25:36 2016 +0000
@@ -1,7 +1,7 @@
//-----------------------------------------------------------
// SeekBar class
//
-// 2016/03/29, Copyright (c) 2016 MIKAMI, Naoki
+// 2016/04/10, Copyright (c) 2016 MIKAMI, Naoki
//-----------------------------------------------------------
#include "SeekBar.hpp"
@@ -12,6 +12,8 @@
// If the thumb is not touched, return false
bool SeekBar::Slide()
{
+ if (!active_) return false;
+
if (!PanelTouched())
{
if (slided_) Draw(v_);
@@ -30,6 +32,18 @@
return rtn;
}
+
+ void SeekBar::Activate()
+ {
+ active_ = true;
+ Draw(v_);
+ }
+
+ void SeekBar::Inactivate()
+ {
+ active_ = false;
+ Draw(v_);
+ }
// Draw seekbar
void SeekBar::Draw(float value, bool fill)
@@ -40,25 +54,28 @@
lcd_.FillRect(X_-SIZE_/2, Y_-SIZE_/2, L_+SIZE_+1, SIZE_+1);
else
lcd_.FillRect(X_-SIZE_/2, Y_-SIZE_/2, SIZE_+1, L_+SIZE_+1);
-
+
Point pt = ToPoint(Saturate(value)); // Position of thumb
// Draw upper line
- lcd_.SetTextColor(COLOR_H_);
+ if (active_) lcd_.SetTextColor(COLOR_H_);
+ else lcd_.SetTextColor(INACTIVE_TEXT_COLOR_-0x404040);
if (ORIENT_ == Holizontal)
lcd_.FillRect(pt.x, Y_-W_/4, X_+L_-pt.x, W_/2);
else
lcd_.FillRect(X_-W_/4, Y_, W_/2, pt.y-Y_);
// Draw lower line
- lcd_.SetTextColor(COLOR_L_);
+ if (active_) lcd_.SetTextColor(COLOR_L_);
+ else lcd_.SetTextColor(INACTIVE_TEXT_COLOR_-0x202020);
if ((ORIENT_ == Holizontal) && ((pt.x-X_) > 0))
lcd_.FillRect(X_, Y_-W_/2, pt.x-X_, W_);
if ((ORIENT_ == Vertical) && ((Y_+L_-pt.y) > 0))
lcd_.FillRect(X_-W_/2, pt.y, W_, Y_+L_-pt.y);
// Draw thumb
- lcd_.SetTextColor(CREATED_COLOR_);
+ if (active_) lcd_.SetTextColor(CREATED_COLOR_);
+ else lcd_.SetTextColor(INACTIVE_TEXT_COLOR_);
if (fill)
lcd_.FillCircle(pt.x, pt.y, SIZE_/2);
else
@@ -111,3 +128,4 @@
return value;
}
}
+
