/*
- * 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.
#include <dali/devel-api/scripting/enum-helper.h>
#include <dali/integration-api/debug.h>
#include <dali/public-api/events/touch-data.h>
-#include <dali/public-api/images/resource-image.h>
#include <dali/public-api/object/type-registry.h>
#include <dali/public-api/object/type-registry-helper.h>
#include <dali/public-api/size-negotiation/relayout-container.h>
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 ] );
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 );
}
bool Button::OnTouch( Actor actor, const TouchData& 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() )
{
// Sets the button state to the default
mButtonPressedState = UNPRESSED;
}
- result = true;
}
- return result;
+ return false;
}
bool Button::OnKeyboardEnter()