DALI_PROPERTY_REGISTRATION( Demo, ShadowButton, "activeTransition", ARRAY, ACTIVE_TRANSITION );
DALI_PROPERTY_REGISTRATION( Demo, ShadowButton, "inactiveTransition", ARRAY, INACTIVE_TRANSITION );
-DALI_PROPERTY_REGISTRATION( Demo, ShadowButton, "clickTransition", ARRAY, CLICK_TRANSITION );
+DALI_PROPERTY_REGISTRATION( Demo, ShadowButton, "checkTransition", ARRAY, CHECK_TRANSITION );
+DALI_PROPERTY_REGISTRATION( Demo, ShadowButton, "uncheckTransition", ARRAY, UNCHECK_TRANSITION );
DALI_PROPERTY_REGISTRATION( Demo, ShadowButton, "backgroundVisual", MAP, BACKGROUND_VISUAL );
DALI_PROPERTY_REGISTRATION( Demo, ShadowButton, "checkboxBgVisual", MAP, CHECKBOX_BG_VISUAL );
DALI_PROPERTY_REGISTRATION( Demo, ShadowButton, "checkboxFgVisual", MAP, CHECKBOX_FG_VISUAL );
void ShadowButton::SetCheckState( bool checkState )
{
mCheckState = checkState;
- EnableVisual( Demo::ShadowButton::Property::CHECKBOX_FG_VISUAL, mCheckState );
+ EnableVisual( Demo::ShadowButton::Property::CHECKBOX_FG_VISUAL, true );
+ if( Self().OnStage() )
+ {
+ if( checkState )
+ {
+ StartTransition( Demo::ShadowButton::Property::CHECK_TRANSITION );
+ }
+ else
+ {
+ StartTransition( Demo::ShadowButton::Property::UNCHECK_TRANSITION );
+ }
+ }
RelayoutRequest();
}
// Consider relayouting the text.
break;
}
+ case Demo::ShadowButton::Property::UNCHECK_TRANSITION:
+ {
+ EnableVisual( Demo::ShadowButton::Property::CHECKBOX_FG_VISUAL, false );
+ break;
+ }
}
break;
}
if( map )
{
visual = Toolkit::VisualFactory::Get().CreateVisual( *map );
- RegisterVisual( index, visual );
// Set the appropriate depth index.
// @todo Should be able to set this from the style sheet
{
case Demo::ShadowButton::Property::BACKGROUND_VISUAL:
{
+ RegisterVisual( index, visual );
visual.SetDepthIndex(0.0f);
break;
}
case Demo::ShadowButton::Property::CHECKBOX_BG_VISUAL:
{
+ RegisterVisual( index, visual );
visual.SetDepthIndex(1.0f);
break;
}
case Demo::ShadowButton::Property::CHECKBOX_FG_VISUAL:
{
+ RegisterVisual( index, visual, mCheckState );
visual.SetDepthIndex(2.0f);
break;
}
case Demo::ShadowButton::Property::LABEL_VISUAL:
{
+ RegisterVisual( index, visual );
visual.SetDepthIndex(1.0f);
break;
}
}
case Demo::ShadowButton::Property::ACTIVE_TRANSITION:
case Demo::ShadowButton::Property::INACTIVE_TRANSITION:
- case Demo::ShadowButton::Property::CLICK_TRANSITION:
+ case Demo::ShadowButton::Property::CHECK_TRANSITION:
+ case Demo::ShadowButton::Property::UNCHECK_TRANSITION:
{
impl.ResetTransition( index, value );
break;
{
ACTIVE_TRANSITION = PROPERTY_START_INDEX,
INACTIVE_TRANSITION,
- CLICK_TRANSITION,
+ CHECK_TRANSITION,
+ UNCHECK_TRANSITION,
BACKGROUND_VISUAL,
CHECKBOX_BG_VISUAL,
CHECKBOX_FG_VISUAL,
mShadowButton = ShadowButton::New();
mShadowButton.SetName("ShadowButton");
mShadowButton.SetActiveState( false );
- mShadowButton.SetCheckState( false );
mShadowButton.SetAnchorPoint( AnchorPoint::CENTER );
mShadowButton.SetParentOrigin( ParentOrigin::CENTER );
mShadowButton.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
}
SetLabelText( mActionButtons[0], "Activate" );
SetLabelText( mActionButtons[1], "Check" );
+ mActionButtons[1].SetProperty( Button::Property::DISABLED, true );
contentLayout.Add( actionButtonLayout );
contentLayout.SetFitHeight(2);
{
SetLabelText( button, "Deactivate" );
}
+ mActionButtons[1].SetProperty( Button::Property::DISABLED, activeState );
break;
}
case 1:
{
bool checkState = mShadowButton.GetCheckState();
mShadowButton.SetCheckState( ! checkState );
+ if( checkState )
+ {
+ SetLabelText( button, "Check" );
+ }
+ else
+ {
+ SetLabelText( button, "Uncheck" );
+ }
break;
}
case 2:
}
}
}
+ ],
+ "checkTransition":
+ [
+ {
+ "target":"checkboxFgVisual",
+ "property":"pixelArea",
+ "initialValue":[0.0, 0.0, 0.0, 1.0],
+ "targetValue":[0.0, 0.0, 1.0, 1.0],
+ "animator":
+ {
+ "alphaFunction":"EASE_IN",
+ "timePeriod":
+ {
+ "duration":0.4,
+ "delay":0
+ }
+ }
+ },
+ {
+ "target":"checkboxFgVisual",
+ "property":"size",
+ "initialValue":[0.0, 0.37],
+ "targetValue":[0.12, 0.37],
+ "animator":
+ {
+ "alphaFunction":"EASE_IN",
+ "timePeriod":
+ {
+ "duration":0.4,
+ "delay":0
+ }
+ }
+ }
+ ],
+ "uncheckTransition":
+ [
+ {
+ "target":"checkboxFgVisual",
+ "property":"pixelArea",
+ "initialValue":[0.0, 0.0, 1.0, 1.0],
+ "targetValue":[0.0, 0.0, 0.0, 1.0],
+ "animator":
+ {
+ "alphaFunction":"EASE_OUT",
+ "timePeriod":
+ {
+ "duration":0.4,
+ "delay":0
+ }
+ }
+ },
+ {
+ "target":"checkboxFgVisual",
+ "property":"size",
+ "targetValue":[0.0, 0.37],
+ "animator":
+ {
+ "alphaFunction":"EASE_OUT",
+ "timePeriod":
+ {
+ "duration":0.4,
+ "delay":0
+ }
+ }
+ }
]
}
}
}
}
}
+ ],
+ "checkTransition":
+ [
+ {
+ "target":"checkboxFgVisual",
+ "property":"pixelArea",
+ "initialValue":[0.0, 0.0, 0.0, 1.0],
+ "targetValue":[0.0, 0.0, 1.0, 1.0],
+ "animator":
+ {
+ "alphaFunction":"EASE_IN",
+ "timePeriod":
+ {
+ "duration":0.4,
+ "delay":0
+ }
+ }
+ },
+ {
+ "target":"checkboxFgVisual",
+ "property":"size",
+ "initialValue":[0.0, 0.37],
+ "targetValue":[0.12, 0.37],
+ "animator":
+ {
+ "alphaFunction":"EASE_IN",
+ "timePeriod":
+ {
+ "duration":0.4,
+ "delay":0
+ }
+ }
+ }
+ ],
+ "uncheckTransition":
+ [
+ {
+ "target":"checkboxFgVisual",
+ "property":"pixelArea",
+ "initialValue":[0.0, 0.0, 1.0, 1.0],
+ "targetValue":[0.0, 0.0, 0.0, 1.0],
+ "animator":
+ {
+ "alphaFunction":"EASE_OUT",
+ "timePeriod":
+ {
+ "duration":0.4,
+ "delay":0
+ }
+ }
+ },
+ {
+ "target":"checkboxFgVisual",
+ "property":"size",
+ "targetValue":[0.0, 0.37],
+ "animator":
+ {
+ "alphaFunction":"EASE_OUT",
+ "timePeriod":
+ {
+ "duration":0.4,
+ "delay":0
+ }
+ }
+ }
]
}
}