Fix compile error. Non initialized variable.
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / buttons / button-impl.cpp
index d355c17..3bebcde 100644 (file)
@@ -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 <cstring> // for strcmp
 #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/events/touch-event.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>
@@ -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();
 }