Add Extension to control-impl.h
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / public-api / controls / control-impl.h
index a816989..5363c25 100644 (file)
@@ -2,7 +2,7 @@
 #define __DALI_TOOLKIT_CONTROL_IMPL_H__
 
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2015 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.
@@ -20,7 +20,6 @@
 
 // EXTERNAL INCLUDES
 #include <dali/public-api/adaptor-framework/style-change.h>
-#include <dali/public-api/common/vector-wrapper.h>
 #include <dali/public-api/events/long-press-gesture.h>
 #include <dali/public-api/events/pan-gesture.h>
 #include <dali/public-api/events/pinch-gesture.h>
@@ -58,6 +57,8 @@ class DALI_IMPORT_API Control : public CustomActorImpl, public ConnectionTracker
 {
 public:
 
+  class Extension; ///< Forward declare future extension interface
+
   // Creation & Destruction
 
   /**
@@ -86,24 +87,10 @@ public:
   virtual float GetWidthForHeight( float height );
 
   /**
-   * @copydoc Toolkit::Control::GetNaturalSize()
+   * @copydoc Toolkit::CustomActorImpl::GetNaturalSize()
    */
   virtual Vector3 GetNaturalSize();
 
-  /**
-   * @brief Retrieves the current Control's size.
-   *
-   * @return The control's size.
-   */
-  const Vector3& GetControlSize() const;
-
-  /**
-   * @brief Retrieves the Control's size set by the Application / Control.
-   *
-   * @return The control's size.
-   */
-  const Vector3& GetSizeSet() const;
-
   // Key Input
 
   /**
@@ -209,7 +196,7 @@ public:
   /**
    * @brief Sets whether this control supports two dimensional
    * keyboard navigation (i.e. whether it knows how to handle the
-   * keyboardn focus movement between its child actors).
+   * keyboard focus movement between its child actors).
    *
    * The control doesn't support it by default.
    * @param[in] isSupported Whether this control supports two dimensional keyboard navigation.
@@ -296,6 +283,15 @@ public:
    */
   virtual void OnKeyboardFocusChangeCommitted(Actor commitedFocusableActor);
 
+  /**
+   * @brief Emits KeyInputFocusGained signal if true else emits KeyInputFocusLost signal
+   *
+   * Should be called last by the control after it acts on the Input Focus change.
+   *
+   * @param[in] focusGained True if gained, False if lost
+   */
+  void EmitKeyInputFocusSignal( bool focusGained );
+
   // Actions & Signals
 
   /**
@@ -325,6 +321,16 @@ public:
   Toolkit::Control::KeyEventSignalType& KeyEventSignal();
 
   /**
+   * @copydoc Dali::Toolkit::Control::KeyInputFocusGainedSignal()
+   */
+  Toolkit::Control::KeyInputFocusSignalType& KeyInputFocusGainedSignal();
+
+  /**
+   * @copydoc Dali::Toolkit::Control::KeyInputFocusLostSignal()
+   */
+  Toolkit::Control::KeyInputFocusSignalType& KeyInputFocusLostSignal();
+
+  /**
    * @brief Called by the KeyInputFocusManager to emit key event signals.
    *
    * @param[in] event The key event.
@@ -339,14 +345,14 @@ protected:
   // Flags for the constructor
   enum ControlBehaviour
   {
-    CONTROL_BEHAVIOUR_NONE        = 0,
-    REQUIRES_TOUCH_EVENTS         = 1<<1,     ///< True if the OnTouchEvent() callback is required.
-    REQUIRES_STYLE_CHANGE_SIGNALS = 1<<2,     ///< True if needs to monitor style change signals such as theme/font change
-    NO_SIZE_NEGOTIATION           = 1<<3,     ///< True if control does not need size negotiation, i.e. it can be skipped in the algorithm
-    REQUIRES_HOVER_EVENTS         = 1<<4,     ///< True if the OnHoverEvent() callback is required.
-    REQUIRES_MOUSE_WHEEL_EVENTS   = 1<<5      ///< True if the OnMouseWheelEvent() callback is required.
+    REQUIRES_STYLE_CHANGE_SIGNALS        = 1 << ( CustomActorImpl::ACTOR_FLAG_COUNT + 0 ),     ///< True if needs to monitor style change signals such as theme/font change
+    REQUIRES_KEYBOARD_NAVIGATION_SUPPORT = 1 << ( CustomActorImpl::ACTOR_FLAG_COUNT + 1 ),     ///< True if needs to support keyboard navigation
+
+    LAST_CONTROL_BEHAVIOUR_FLAG
   };
 
+  static const int CONTROL_BEHAVIOUR_FLAG_COUNT = Log< LAST_CONTROL_BEHAVIOUR_FLAG - 1 >::value + 1;      ///< Total count of flags
+
   /**
    * @brief Create a Control.
    *
@@ -384,7 +390,7 @@ protected:
   /**
    * @copydoc Dali::CustomActorImpl::RelayoutDependentOnChildren()
    */
-  virtual bool RelayoutDependentOnChildren( Dimension dimension = ALL_DIMENSIONS );
+  virtual bool RelayoutDependentOnChildren( Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
 
 private:
 
@@ -550,12 +556,12 @@ private:
   /**
    * @copydoc Dali::CustomActorImpl::OnCalculateRelayoutSize()
    */
-  virtual void OnCalculateRelayoutSize( Dimension dimension );
+  virtual void OnCalculateRelayoutSize( Dimension::Type dimension );
 
   /**
    * @copydoc Dali::CustomActorImpl::OnLayoutNegotiated()
    */
-  virtual void OnLayoutNegotiated( float size, Dimension dimension );
+  virtual void OnLayoutNegotiated( float size, Dimension::Type dimension );
 
   /**
    * @copydoc Dali::CustomActorImpl::OnRelayout()
@@ -565,12 +571,12 @@ private:
   /**
    * @copydoc Dali::CustomActorImpl::OnSetResizePolicy()
    */
-  virtual void OnSetResizePolicy( ResizePolicy policy, Dimension dimension );
+  virtual void OnSetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension );
 
   /**
    * @copydoc Dali::CustomActorImpl::CalculateChildSize()
    */
-  virtual float CalculateChildSize( const Dali::Actor& child, Dimension dimension );
+  virtual float CalculateChildSize( const Dali::Actor& child, Dimension::Type dimension );
 
   // From CustomActorImpl, derived classes should NOT override these.
 
@@ -587,51 +593,22 @@ private:
   virtual void OnStageConnection();
 
   /**
-   * @brief Calls OnControlStageDisconnection() to notify derived classed.
-   *
-   * @see Dali::CustomActorImpl::OnStageDisconnection()
+   * @copydoc Dali::CustomActorImpl::OnStageDisconnection()
    */
   virtual void OnStageDisconnection();
 
   /**
-   * @brief Sends a request to relayout this control.
-   *
-   * The control will be relaid out after the
-   * Dali::Stage::SignalMessageQueueFlushed() signal is emitted.  It
-   * calls OnControlChildAdd() to notify derived classes.
-   *
-   * @note This method shouldn't be overridden by derived classes.
-   *
-   * @param[in] child The added actor.
-   *
-   * @see Dali::CustomActorImpl::OnChildAdd(Actor&)
+   * @copydoc Dali::CustomActorImpl::OnChildAdd(Actor&)
    */
   virtual void OnChildAdd(Actor& child);
 
   /**
-   * @brief Sends a request to relayout this control.
-   *
-   * The control will be relaid out after the
-   * Dali::Stage::SignalMessageQueueFlushed() signal is emitted.  It
-   * calls OnControlChildRemove() to notify derived classes.
-   *
-   * @note This method shouldn't be overridden by derived classes.
-   *
-   * @param[in] child The removed actor.
-   *
-   * @see Dali::CustomActorImpl::OnChildRemove(Actor&)
+   * @copydoc Dali::CustomActorImpl::OnChildRemove(Actor&)
    */
   virtual void OnChildRemove(Actor& child);
 
   /**
-   * @brief It stores the size set by size negotiation and relayout.
-   *
-   * It also keeps a backup of the size set through the Actor's API used in the size negotiation.
-   * It calls the OnControlSizeSet() to notify derived classes.
-   *
-   * @param[in] targetSize The new size.
-   *
-   * @see Dali::CustomActorImpl::OnSizeSet(const Vector3&)
+   * @copydoc Dali::CustomActorImpl::OnSizeSet(const Vector3&)
    */
   virtual void OnSizeSet(const Vector3& targetSize);
 
@@ -647,6 +624,16 @@ private:
    */
   virtual void SignalDisconnected( SlotObserver* slotObserver, CallbackBase* callback );
 
+  /**
+   * Retrieve the extension for this control
+   *
+   * @return The extension if available, NULL otherwise
+   */
+  virtual Extension* GetExtension()
+  {
+    return NULL;
+  }
+
 private:
 
   // Undefined