1 #ifndef __DALI_INTERNAL_TOUCH_DATA_H__
2 #define __DALI_INTERNAL_TOUCH_DATA_H__
5 * Copyright (c) 2016 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali/public-api/common/vector-wrapper.h>
23 #include <dali/public-api/events/point-state.h>
24 #include <dali/public-api/events/touch-data.h>
25 #include <dali/public-api/events/touch-point.h>
26 #include <dali/public-api/object/base-object.h>
38 * @copydoc Dali::TouchData
40 class TouchData : public BaseObject
44 // Construction & Destruction
47 * @brief Default constructor
53 * @param[in] time The time the event occurred
55 TouchData( unsigned long time );
65 * @copydoc Dali::TouchData::GetTime()
67 unsigned long GetTime() const;
70 * @copydoc Dali::TouchData::GetPointCount()
72 size_t GetPointCount() const;
75 * @copydoc Dali::TouchData::GetDeviceId()
77 int32_t GetDeviceId( size_t point ) const;
80 * @copydoc Dali::TouchData::GetGetState()
82 PointState::Type GetState( size_t point ) const;
85 * @copydoc Dali::TouchData::GetHitActor()
87 Dali::Actor GetHitActor( size_t point ) const;
90 * @copydoc Dali::TouchData::GetLocalPosition()
92 const Vector2& GetLocalPosition( size_t point ) const;
95 * @copydoc Dali::TouchData::GetScreenPosition()
97 const Vector2& GetScreenPosition( size_t point ) const;
100 * @brief Returns a reference to a point at the index requested.
102 * The first point in the set is always the primary point (i.e. the first point touched in a multi-touch event).
105 * @param[in] point The index of the required Point.
106 * @return A reference to the Point at the position requested
107 * @note point should be less than the value returned by GetPointCount(). Will assert if out of range.
109 const TouchPoint& GetPoint( size_t point ) const;
114 * @brief Adds a point to this touch event handler.
115 * @param[in] point The point to add to the touch event handler.
117 void AddPoint( const TouchPoint& point );
120 * @brief Overwrites the internal container with the point container specified.
122 * @param[in] points The point container.
124 void SetPoints( const TouchPointContainer& points );
128 /// Undefined Copy constructor
129 TouchData( const TouchData& other );
132 TouchData& operator=( const TouchData& other );
134 TouchPointContainer mPoints; ///< Container of the points for this touch event.
135 unsigned long mTime; ///< The time (in ms) that the touch event occurred.
138 } // namespace Internal
140 // Helpers for public-api forwarding methods
142 inline Internal::TouchData& GetImplementation( Dali::TouchData& touchData )
144 DALI_ASSERT_ALWAYS( touchData && "Touch Data handle is empty" );
146 BaseObject& object = touchData.GetBaseObject();
148 return static_cast< Internal::TouchData& >( object );
151 inline const Internal::TouchData& GetImplementation( const Dali::TouchData& touchData )
153 DALI_ASSERT_ALWAYS( touchData && "Touch Data handle is empty" );
155 const BaseObject& object = touchData.GetBaseObject();
157 return static_cast< const Internal::TouchData& >( object );
162 #endif // __DALI_INTERNAL_TOUCH_DATA_H__