#include <dali-toolkit/devel-api/align-enums.h>
#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
+#include <dali-toolkit/devel-api/controls/control-devel.h>
#include <cstdio>
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 );
+ DevelControl::EnableVisual( *this, 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();
}
iter->mAnimation.FinishedSignal().Disconnect( this, &ShadowButton::OnTransitionFinished );
}
- iter->mAnimation = CreateTransition( iter->mTransitionData );
+ iter->mAnimation = DevelControl::CreateTransition( *this, iter->mTransitionData );
StoreTargetLayouts( iter->mTransitionData );
iter->mAnimation.FinishedSignal().Connect( this, &ShadowButton::OnTransitionFinished );
// Consider relayouting the text.
break;
}
+ case Demo::ShadowButton::Property::UNCHECK_TRANSITION:
+ {
+ DevelControl::EnableVisual( *this, 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:
{
- visual.SetDepthIndex(0.0f);
+ DevelControl::RegisterVisual( *this, index, visual, 0 );
break;
}
case Demo::ShadowButton::Property::CHECKBOX_BG_VISUAL:
{
- visual.SetDepthIndex(1.0f);
+ DevelControl::RegisterVisual( *this, index, visual, 1 );
break;
}
case Demo::ShadowButton::Property::CHECKBOX_FG_VISUAL:
{
- visual.SetDepthIndex(2.0f);
+ DevelControl::RegisterVisual( *this, index, visual, mCheckState, 2 );
break;
}
case Demo::ShadowButton::Property::LABEL_VISUAL:
{
- visual.SetDepthIndex(1.0f);
+ DevelControl::RegisterVisual( *this, index, visual, 1 );
break;
}
}
bool IsTransformProperty( const std::string& property )
{
- const char* transformProperties[]= { "size", "offset", "origin", "anchorPoint", "offsetSizeMode" };
+ const char* transformProperties[]= { "size", "offset", "origin", "anchorPoint", "offsetPolicy", "sizePolicy" };
const int NUM_TRANSFORM_PROPERTIES = sizeof( transformProperties ) / sizeof( const char * );
bool found=false;
{
// Pseudo code
// foreach animator in transitionData
- // if animator{"property"} in [ "size", "offset", "origin", "anchorPoint", "offsetSizeMode" ]
+ // if animator{"property"} in [ "size", "offset", "origin", "anchorPoint", "offsetPolicy", "sizePolicy" ]
// transforms{ animator{"target"} }->{animator{"property"}} = animator{"targetValue"}
case Demo::ShadowButton::Property::CHECKBOX_FG_VISUAL:
{
impl.ResetVisual( index, impl.mCheckboxFgVisual, value );
- impl.EnableVisual( Demo::ShadowButton::Property::CHECKBOX_FG_VISUAL, impl.mCheckState );
+ DevelControl::EnableVisual( impl, Demo::ShadowButton::Property::CHECKBOX_FG_VISUAL, impl.mCheckState );
break;
}
case Demo::ShadowButton::Property::LABEL_VISUAL:
}
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;