diff --git a/data/theme/color/white/CheckBox.json b/data/theme/color/white/CheckBox.json index 4438cdf5..016f8d17 100644 --- a/data/theme/color/white/CheckBox.json +++ b/data/theme/color/white/CheckBox.json @@ -5,6 +5,6 @@ { name:"EW_foreground", color:"#8884" }, { name:"EW_foregroundHover", color:"#00A6" }, { name:"EW_foregroundSelected", color:"#000A" }, - { name:"EW_foregroundPressed", color:"#A006" }, + { name:"EW_foregroundPressed", color:"#000A" }, ] } diff --git a/data/theme/shape/square/CheckBox.vert b/data/theme/shape/square/CheckBox.vert index e1c5aae7..50900e2c 100644 --- a/data/theme/shape/square/CheckBox.vert +++ b/data/theme/shape/square/CheckBox.vert @@ -42,12 +42,16 @@ void main(void) { colorOld = EW_foregroundPressed; } else if(EW_status.stateOld == 2) { colorOld = EW_foregroundHover; + } else if(EW_status.stateOld == 3) { + colorOld = EW_foregroundSelected; } vec4 colorNew = EW_foreground; if(EW_status.stateNew == 1) { colorNew = EW_foregroundPressed; } else if(EW_status.stateNew == 2) { colorNew = EW_foregroundHover; + } else if(EW_status.stateNew == 3) { + colorNew = EW_foregroundSelected; } v_colorInside = EW_foreground; @@ -58,6 +62,10 @@ void main(void) { // note : int() is needed for the OpenGL ES platform v_colorTansition = colorOld * (1.0 - 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_colorBackground = EW_background; } diff --git a/ewol/widget/CheckBox.cpp b/ewol/widget/CheckBox.cpp index f1387d29..71b482de 100644 --- a/ewol/widget/CheckBox.cpp +++ b/ewol/widget/CheckBox.cpp @@ -13,6 +13,7 @@ #define STATUS_UP (0) #define STATUS_HOVER (2) #define STATUS_PRESSED (1) +#define STATUS_SELECTED (2) #undef __class__ #define __class__ "CheckBox" @@ -168,19 +169,25 @@ bool ewol::widget::CheckBox::onEventEntry(const ewol::event::Entry& _event) { } void ewol::widget::CheckBox::CheckStatus() { - if (true == m_buttonPressed) { - changeStatusIn(STATUS_PRESSED); - } else { - if (true == m_mouseHover) { - changeStatusIn(STATUS_HOVER); - } else { - changeStatusIn(STATUS_UP); - } + if (m_shaper->setState(m_value==true?1:0) == true) { + markToRedraw(); } + 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) { - if (true == m_shaper->changeStatusIn(_newStatusId) ) { + if (m_shaper->changeStatusIn(_newStatusId) == true) { periodicCallEnable(); markToRedraw(); } @@ -188,7 +195,7 @@ void ewol::widget::CheckBox::changeStatusIn(int32_t _newStatusId) { void ewol::widget::CheckBox::periodicCall(const ewol::event::Time& _event) { - if (false == m_shaper->periodicCall(_event) ) { + if (m_shaper->periodicCall(_event) == false) { periodicCallDisable(); } markToRedraw();