(Gestures) Each actor is now aware of what gestures it requires which is used when...
[platform/core/uifw/dali-core.git] / dali / internal / event / actors / actor-impl.h
index 26b7887..239b162 100644 (file)
@@ -1,22 +1,21 @@
 #ifndef __DALI_INTERNAL_ACTOR_H__
 #define __DALI_INTERNAL_ACTOR_H__
 
-/*
- * Copyright (c) 2014 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
 
 // EXTERNAL INCLUDES
 #include <string>
@@ -27,6 +26,7 @@
 #include <dali/public-api/object/ref-object.h>
 #include <dali/public-api/actors/actor.h>
 #include <dali/public-api/common/dali-common.h>
+#include <dali/public-api/events/gesture.h>
 #include <dali/public-api/math/viewport.h>
 #include <dali/internal/event/common/proxy-object.h>
 #include <dali/internal/event/common/stage-def.h>
@@ -49,9 +49,11 @@ namespace Internal
 {
 
 class Actor;
+class GestureDetector;
 class RenderTask;
 class ShaderEffect;
 struct DynamicsData;
+struct GestureData;
 
 typedef IntrusivePtr<Actor>                   ActorPtr;
 typedef IntrusivePtr<ShaderEffect>            ShaderEffectPtr;
@@ -941,6 +943,30 @@ public:
    */
   bool IsHittable() const;
 
+  // Gestures
+
+  /**
+   * Adds a gesture detector to the actor so that the actor is aware that it requires this type of
+   * gesture.
+   * @param[in] detector The detector being added.
+   * @note A raw pointer to the detector is stored, so the detector MUST remove itself when it is
+   * destroyed using RemoveGestureDetector()
+   */
+  void AddGestureDetector( GestureDetector& detector );
+
+  /**
+   * Removes a previously added gesture detector from the actor. If no more gesture detectors of
+   * this type are registered with this actor then the actor will no longer be hit-tested for that
+   * gesture.
+   * @param[in] detector The detector to remove.
+   */
+  void RemoveGestureDetector( GestureDetector& detector );
+
+  /**
+   * Queries whether the actor requires the gesture type.
+   * @param[in] type The gesture type.
+   */
+  bool IsGestureRequred( Gesture::Type type ) const;
 
   // Signals
 
@@ -1305,6 +1331,8 @@ protected:
   DynamicsData*           mDynamicsData; ///< optional physics data
 #endif
 
+  GestureData*            mGestureData; /// Optional Gesture data. Only created when actor requires gestures
+
   ActorAttachmentPtr      mAttachment;   ///< Optional referenced attachment
   ShaderEffectPtr         mShaderEffect; ///< Optional referenced shader effect