X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Fbuttons%2Fbutton-impl.cpp;h=3bebcdefcc22efabc60667b8c118b0be4594c063;hp=1af6848989ca93f00468a95ea4aeac6ddc09bbc0;hb=b1e8521ad77e7b4e62b59613b2edef64429130e9;hpb=c0d8c3caf853d94266c589b425cadc26333f716a diff --git a/dali-toolkit/internal/controls/buttons/button-impl.cpp b/dali-toolkit/internal/controls/buttons/button-impl.cpp index 1af6848..3bebcde 100644 --- a/dali-toolkit/internal/controls/buttons/button-impl.cpp +++ b/dali-toolkit/internal/controls/buttons/button-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,8 +22,7 @@ #include // for strcmp #include #include -#include -#include +#include #include #include #include @@ -289,7 +288,7 @@ void Button::ChangeState( State requestedState ) mPreviousButtonState = mButtonState; // Store previous state for visual removal (used when animations ended) mButtonState = requestedState; // Update current state - if ( Self().OnStage() ) + if ( Self().GetProperty< bool >( Actor::Property::CONNECTED_TO_SCENE ) ) { OnStateChange( mButtonState ); // Notify derived buttons SelectRequiredVisual( VISUAL_INDEX_FOR_STATE[ mButtonState ][ BACKGROUND ] ); @@ -619,7 +618,7 @@ void Button::OnInitialize() mTapDetector.Attach( self ); mTapDetector.DetectedSignal().Connect(this, &Button::OnTap); - self.SetKeyboardFocusable( true ); + self.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE, true ); self.TouchSignal().Connect( this, &Button::OnTouch ); } @@ -629,13 +628,9 @@ bool Button::OnAccessibilityActivated() return OnKeyboardEnter(); } -bool Button::OnTouch( Actor actor, const TouchData& touch ) +bool Button::OnTouch( Actor actor, const TouchEvent& touch ) { - - // Only events are processed when the button is not disabled - auto result( false ); - - if( !IsDisabled() ) + if( !IsDisabled() && (actor == touch.GetHitActor(0)) ) { if ( 1 == touch.GetPointCount() ) { @@ -676,9 +671,8 @@ bool Button::OnTouch( Actor actor, const TouchData& touch ) // Sets the button state to the default mButtonPressedState = UNPRESSED; } - result = true; } - return result; + return false; } bool Button::OnKeyboardEnter() @@ -690,7 +684,7 @@ bool Button::OnKeyboardEnter() return ret; } -void Button::OnStageDisconnection() +void Button::OnSceneDisconnection() { if( DEPRESSED == mButtonPressedState ) { @@ -707,18 +701,18 @@ void Button::OnStageDisconnection() mButtonPressedState = UNPRESSED; - Control::OnStageDisconnection(); // Visuals will be set off stage + Control::OnSceneDisconnection(); // Visuals will be set off stage } -void Button::OnStageConnection( int depth ) +void Button::OnSceneConnection( int depth ) { - DALI_LOG_INFO( gLogButtonFilter, Debug::Verbose, "Button::OnStageConnection ptr(%p) \n", this ); + DALI_LOG_INFO( gLogButtonFilter, Debug::Verbose, "Button::OnSceneConnection ptr(%p) \n", this ); OnButtonVisualRemoval( VISUAL_INDEX_FOR_STATE[ mPreviousButtonState ][ BACKGROUND ] ); OnButtonVisualRemoval( VISUAL_INDEX_FOR_STATE[ mPreviousButtonState ][ FOREGROUND ] ); SelectRequiredVisual( Toolkit::Button::Property::LABEL ); SelectRequiredVisual( VISUAL_INDEX_FOR_STATE[ mButtonState ][ BACKGROUND ] ); SelectRequiredVisual( VISUAL_INDEX_FOR_STATE[ mButtonState ][ FOREGROUND ] ); - Control::OnStageConnection( depth ); // Enabled visuals will be put on stage + Control::OnSceneConnection( depth ); // Enabled visuals will be put on stage RelayoutRequest(); }