Add GetMouseButton to identify right/left mouse button click
[platform/core/uifw/dali-core.git] / dali / internal / event / events / touch-data-impl.cpp
old mode 100644 (file)
new mode 100755 (executable)
index f076099..481407a
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
@@ -39,6 +39,14 @@ TouchData::TouchData( unsigned long time )
 {
 }
 
+TouchDataPtr TouchData::Clone( const TouchData& other )
+{
+  TouchDataPtr touchData( new TouchData );
+  touchData->mPoints = other.mPoints;
+  touchData->mTime = other.mTime;
+  return touchData;
+}
+
 TouchData::~TouchData()
 {
 }
@@ -48,70 +56,134 @@ unsigned long TouchData::GetTime() const
   return mTime;
 }
 
-size_t TouchData::GetPointCount() const
+std::size_t TouchData::GetPointCount() const
 {
   return mPoints.size();
 }
 
-int32_t TouchData::GetDeviceId( size_t point ) const
+int32_t TouchData::GetDeviceId( std::size_t point ) const
 {
   if( point < mPoints.size() )
   {
-    return mPoints[ point ].deviceId;
+    return mPoints[ point ].GetDeviceId();
   }
   return -1;
 }
 
-PointState::Type TouchData::GetState( size_t point ) const
+PointState::Type TouchData::GetState( std::size_t point ) const
 {
   if( point < mPoints.size() )
   {
-    return static_cast< PointState::Type >( mPoints[ point ].state );
+    return mPoints[ point ].GetState();
   }
   return PointState::FINISHED;
 }
 
-Dali::Actor TouchData::GetHitActor( size_t point ) const
+Dali::Actor TouchData::GetHitActor( std::size_t point ) const
 {
   if( point < mPoints.size() )
   {
-    return mPoints[ point ].hitActor;
+    return mPoints[ point ].GetHitActor();
   }
   return Dali::Actor();
 }
 
-const Vector2& TouchData::GetLocalPosition( size_t point ) const
+const Vector2& TouchData::GetLocalPosition( std::size_t point ) const
+{
+  if( point < mPoints.size() )
+  {
+    return mPoints[ point ].GetLocalPosition();
+  }
+  return Vector2::ZERO;
+}
+
+const Vector2& TouchData::GetScreenPosition( std::size_t point ) const
 {
   if( point < mPoints.size() )
   {
-    return mPoints[ point ].local;
+    return mPoints[ point ].GetScreenPosition();
   }
   return Vector2::ZERO;
 }
 
-const Vector2& TouchData::GetScreenPosition( size_t point ) const
+float TouchData::GetRadius( std::size_t point ) const
+{
+  if( point < mPoints.size() )
+  {
+    return mPoints[ point ].GetRadius();
+  }
+  return 0.0f;
+}
+
+const Vector2& TouchData::GetEllipseRadius( std::size_t point ) const
 {
   if( point < mPoints.size() )
   {
-    return mPoints[ point ].screen;
+    return mPoints[ point ].GetEllipseRadius();
   }
   return Vector2::ZERO;
 }
 
-const TouchPoint& TouchData::GetPoint( size_t point ) const
+float TouchData::GetPressure( std::size_t point ) const
+{
+  if( point < mPoints.size() )
+  {
+    return mPoints[ point ].GetPressure();
+  }
+  return 1.0f;
+}
+
+Degree TouchData::GetAngle( std::size_t point ) const
+{
+  if( point < mPoints.size() )
+  {
+    return mPoints[ point ].GetAngle();
+  }
+  return Degree();
+}
+
+const Integration::Point& TouchData::GetPoint( std::size_t point ) const
+{
+  DALI_ASSERT_DEBUG( point < mPoints.size() && "No point at index" );
+  return mPoints[ point ];
+}
+
+Integration::Point& TouchData::GetPoint( std::size_t point )
 {
   DALI_ASSERT_DEBUG( point < mPoints.size() && "No point at index" );
   return mPoints[ point ];
 }
 
-void TouchData::AddPoint( const TouchPoint& point )
+void TouchData::AddPoint( const Integration::Point& point )
 {
   mPoints.push_back( point );
 }
 
-void TouchData::SetPoints( const TouchPointContainer& points )
+Device::Class::Type TouchData::GetDeviceClass( std::size_t point ) const
+{
+  if( point < mPoints.size() )
+  {
+    return mPoints[ point ].GetDeviceClass();
+  }
+  return Device::Class::NONE;
+}
+
+Device::Subclass::Type TouchData::GetDeviceSubclass( std::size_t point ) const
+{
+  if( point < mPoints.size() )
+  {
+    return mPoints[ point ].GetDeviceSubclass();
+  }
+  return Device::Subclass::NONE;
+}
+
+MouseButton::Type TouchData::GetMouseButton( std::size_t point ) const
 {
-  mPoints = points;
+  if( point < mPoints.size() )
+  {
+    return mPoints[ point ].GetMouseButton();
+  }
+  return MouseButton::INVALID;
 }
 
 } // namsespace Internal