[DEBUG] correct the checkbox missing check (base)

This commit is contained in:
Edouard DUPIN 2016-01-29 23:56:50 +01:00
parent e20efd56e2
commit 8ccb93508d
3 changed files with 26 additions and 11 deletions

View File

@ -5,6 +5,6 @@
{ name:"EW_foreground", color:"#8884" }, { name:"EW_foreground", color:"#8884" },
{ name:"EW_foregroundHover", color:"#00A6" }, { name:"EW_foregroundHover", color:"#00A6" },
{ name:"EW_foregroundSelected", color:"#000A" }, { name:"EW_foregroundSelected", color:"#000A" },
{ name:"EW_foregroundPressed", color:"#A006" }, { name:"EW_foregroundPressed", color:"#000A" },
] ]
} }

View File

@ -42,12 +42,16 @@ void main(void) {
colorOld = EW_foregroundPressed; colorOld = EW_foregroundPressed;
} else if(EW_status.stateOld == 2) { } else if(EW_status.stateOld == 2) {
colorOld = EW_foregroundHover; colorOld = EW_foregroundHover;
} else if(EW_status.stateOld == 3) {
colorOld = EW_foregroundSelected;
} }
vec4 colorNew = EW_foreground; vec4 colorNew = EW_foreground;
if(EW_status.stateNew == 1) { if(EW_status.stateNew == 1) {
colorNew = EW_foregroundPressed; colorNew = EW_foregroundPressed;
} else if(EW_status.stateNew == 2) { } else if(EW_status.stateNew == 2) {
colorNew = EW_foregroundHover; colorNew = EW_foregroundHover;
} else if(EW_status.stateNew == 3) {
colorNew = EW_foregroundSelected;
} }
v_colorInside = EW_foreground; v_colorInside = EW_foreground;
@ -58,6 +62,10 @@ void main(void) {
// note : int() is needed for the OpenGL ES platform // note : int() is needed for the OpenGL ES platform
v_colorTansition = colorOld * (1.0 - EW_status.transition) v_colorTansition = colorOld * (1.0 - EW_status.transition)
+ colorNew * EW_status.transition; + colorNew * EW_status.transition;
// for test ... TODO : Remove
if (EW_status.activate == 1) {
v_colorTansition = EW_foregroundSelected;
}
v_colorBorder = EW_border; v_colorBorder = EW_border;
v_colorBackground = EW_background; v_colorBackground = EW_background;
} }

View File

@ -13,6 +13,7 @@
#define STATUS_UP (0) #define STATUS_UP (0)
#define STATUS_HOVER (2) #define STATUS_HOVER (2)
#define STATUS_PRESSED (1) #define STATUS_PRESSED (1)
#define STATUS_SELECTED (2)
#undef __class__ #undef __class__
#define __class__ "CheckBox" #define __class__ "CheckBox"
@ -168,19 +169,25 @@ bool ewol::widget::CheckBox::onEventEntry(const ewol::event::Entry& _event) {
} }
void ewol::widget::CheckBox::CheckStatus() { void ewol::widget::CheckBox::CheckStatus() {
if (true == m_buttonPressed) { if (m_shaper->setState(m_value==true?1:0) == true) {
changeStatusIn(STATUS_PRESSED); markToRedraw();
} else {
if (true == m_mouseHover) {
changeStatusIn(STATUS_HOVER);
} else {
changeStatusIn(STATUS_UP);
}
} }
if (m_buttonPressed == true) {
EWOL_WARNING("SET state : PRESSED");
changeStatusIn(STATUS_PRESSED);
return;
}
if (true == m_mouseHover) {
EWOL_WARNING("SET state : HOVER");
changeStatusIn(STATUS_HOVER);
return;
}
EWOL_WARNING("SET state : UP");
changeStatusIn(STATUS_UP);
} }
void ewol::widget::CheckBox::changeStatusIn(int32_t _newStatusId) { void ewol::widget::CheckBox::changeStatusIn(int32_t _newStatusId) {
if (true == m_shaper->changeStatusIn(_newStatusId) ) { if (m_shaper->changeStatusIn(_newStatusId) == true) {
periodicCallEnable(); periodicCallEnable();
markToRedraw(); markToRedraw();
} }
@ -188,7 +195,7 @@ void ewol::widget::CheckBox::changeStatusIn(int32_t _newStatusId) {
void ewol::widget::CheckBox::periodicCall(const ewol::event::Time& _event) { void ewol::widget::CheckBox::periodicCall(const ewol::event::Time& _event) {
if (false == m_shaper->periodicCall(_event) ) { if (m_shaper->periodicCall(_event) == false) {
periodicCallDisable(); periodicCallDisable();
} }
markToRedraw(); markToRedraw();