/*
- * 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/internal/event/common/object-registry-impl.h>
#include <dali/integration-api/platform-abstraction.h>
#include <dali/public-api/common/constants.h>
-#include <dali/public-api/events/touch-data.h>
+#include <dali/public-api/events/touch-event.h>
#include <dali/public-api/object/type-registry.h>
#include <dali/public-api/render-tasks/render-task-list.h>
#include <dali/public-api/rendering/frame-buffer.h>
+#include <dali/public-api/common/constants.h>
using Dali::Internal::SceneGraph::Node;
const char* const SIGNAL_KEY_EVENT_GENERATED = "keyEventGenerated";
const char* const SIGNAL_EVENT_PROCESSING_FINISHED = "eventProcessingFinished";
const char* const SIGNAL_TOUCHED = "touched";
-const char* const SIGNAL_TOUCH = "touch";
const char* const SIGNAL_WHEEL_EVENT = "wheelEvent";
const char* const SIGNAL_CONTEXT_LOST = "contextLost";
const char* const SIGNAL_CONTEXT_REGAINED = "contextRegained";
SignalConnectorType signalConnector1( mType, SIGNAL_KEY_EVENT, &Stage::DoConnectSignal );
SignalConnectorType signalConnector2( mType, SIGNAL_EVENT_PROCESSING_FINISHED, &Stage::DoConnectSignal );
-SignalConnectorType signalConnector3( mType, SIGNAL_TOUCHED, &Stage::DoConnectSignal );
SignalConnectorType signalConnector4( mType, SIGNAL_WHEEL_EVENT, &Stage::DoConnectSignal );
SignalConnectorType signalConnector5( mType, SIGNAL_CONTEXT_LOST, &Stage::DoConnectSignal );
SignalConnectorType signalConnector6( mType, SIGNAL_CONTEXT_REGAINED, &Stage::DoConnectSignal );
SignalConnectorType signalConnector7( mType, SIGNAL_SCENE_CREATED, &Stage::DoConnectSignal );
SignalConnectorType signalConnector8( mType, SIGNAL_KEY_EVENT_GENERATED, &Stage::DoConnectSignal );
-SignalConnectorType signalConnector9( mType, SIGNAL_TOUCH, &Stage::DoConnectSignal );
+SignalConnectorType signalConnector9( mType, SIGNAL_TOUCHED, &Stage::DoConnectSignal );
} // unnamed namespace
void Stage::Initialize( Scene& scene )
{
mScene = &scene;
- mScene->SetBackgroundColor( Dali::Stage::DEFAULT_BACKGROUND_COLOR );
+ mScene->SetBackgroundColor( Dali::DEFAULT_BACKGROUND_COLOR );
+ mScene->EventProcessingFinishedSignal().Connect( this, &Stage::OnEventProcessingFinished );
+ mScene->KeyEventSignal().Connect( this, &Stage::OnKeyEvent );
+ mScene->TouchedSignal().Connect( this, &Stage::OnTouchEvent );
+ mScene->WheelEventSignal().Connect( this, &Stage::OnWheelEvent );
}
StagePtr Stage::GetCurrent()
{
stage->TouchedSignal().Connect( tracker, functor );
}
- else if( 0 == strcmp( signalName.c_str(), SIGNAL_TOUCH ) )
- {
- stage->TouchSignal().Connect( tracker, functor );
- }
else if( 0 == strcmp( signalName.c_str(), SIGNAL_WHEEL_EVENT ) )
{
stage->WheelEventSignal().Connect( tracker, functor );
return connected;
}
+void Stage::OnEventProcessingFinished()
+{
+ EmitEventProcessingFinishedSignal();
+}
+
+void Stage::OnKeyEvent( const Dali::KeyEvent& event )
+{
+ bool consumed = EmitKeyEventGeneratedSignal( event );
+ if( !consumed )
+ {
+ EmitKeyEventSignal( event );
+ }
+}
+
+void Stage::OnTouchEvent( const Dali::TouchEvent& touch )
+{
+ EmitTouchedSignal( touch );
+}
+
+void Stage::OnWheelEvent( const Dali::WheelEvent& event )
+{
+ EmitWheelEventSignal( event );
+}
+
void Stage::EmitKeyEventSignal(const KeyEvent& event)
{
// Emit the key event signal when no actor in the stage has gained the key input focus
void Stage::EmitEventProcessingFinishedSignal()
{
- mEventProcessingFinishedSignal.Emit();
+ mEventProcessingFinishedSignal.Emit();
}
-void Stage::EmitTouchedSignal( const TouchEvent& touchEvent, const Dali::TouchData& touch )
+void Stage::EmitTouchedSignal( const Dali::TouchEvent& touch )
{
- mTouchedSignal.Emit( touchEvent );
- mTouchSignal.Emit( touch );
+ mTouchedSignal.Emit( touch );
}
-void Stage::EmitWheelEventSignal(const WheelEvent& event)
+void Stage::EmitWheelEventSignal( const WheelEvent& event )
{
// Emit the wheel event signal when no actor in the stage has gained the wheel input focus
return mEventProcessingFinishedSignal;
}
-Dali::Stage::TouchedSignalType& Stage::TouchedSignal()
+Dali::Stage::TouchEventSignalType& Stage::TouchedSignal()
{
- DALI_LOG_WARNING( "Deprecated. Use TouchSignal() instead.\n" );
return mTouchedSignal;
}
-Dali::Stage::TouchSignalType& Stage::TouchSignal()
-{
- return mTouchSignal;
-}
-
Dali::Stage::WheelEventSignalType& Stage::WheelEventSignal()
{
return mWheelEventSignal;
mKeyEventGeneratedSignal(),
mEventProcessingFinishedSignal(),
mTouchedSignal(),
- mTouchSignal(),
mWheelEventSignal(),
mContextLostSignal(),
mContextRegainedSignal(),