Changes after Custom actor impl extension, cleanup, extension and test cases for... 41/39941/1
authorKimmo Hoikka <kimmo.hoikka@samsung.com>
Tue, 26 May 2015 16:22:05 +0000 (17:22 +0100)
committerKimmo Hoikka <kimmo.hoikka@samsung.com>
Tue, 26 May 2015 16:22:05 +0000 (17:22 +0100)
Change-Id: I0bc19a5bd6bfff6c087d0edb949e08ef63dace3b

automated-tests/src/dali-toolkit/utc-Dali-Control.cpp
dali-toolkit/internal/focus-manager/focus-manager-impl.cpp
dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp
dali-toolkit/internal/focus-manager/keyinput-focus-manager-impl.cpp
dali-toolkit/public-api/controls/control-impl.cpp
dali-toolkit/public-api/controls/control-impl.h
dali-toolkit/public-api/controls/control.cpp
dali-toolkit/public-api/controls/control.h

index 47a13ec..3223daa 100644 (file)
@@ -204,17 +204,16 @@ int UtcDaliControlKeyInputFocus(void)
   END_TEST;
 }
 
   END_TEST;
 }
 
-int UtcDaliControlGetImplementation(void)
+int UtcDaliControlGetImplementationN(void)
 {
   ToolkitTestApplication application;
 {
   ToolkitTestApplication application;
-
   DummyControl control;
 
   // Get Empty
   {
     try
     {
   DummyControl control;
 
   // Get Empty
   {
     try
     {
-      Toolkit::Internal::Control& controlImpl = control.GetImplementation();
+      Toolkit::Internal::Control& controlImpl = Toolkit::Internal::GetImplementation( control );
       (void)controlImpl; // Avoid unused warning
       tet_result(TET_FAIL);
     }
       (void)controlImpl; // Avoid unused warning
       tet_result(TET_FAIL);
     }
@@ -223,13 +222,20 @@ int UtcDaliControlGetImplementation(void)
       tet_result(TET_PASS);
     }
   }
       tet_result(TET_PASS);
     }
   }
+  END_TEST;
+}
+
+int UtcDaliControlGetImplementationConstN(void)
+{
+  ToolkitTestApplication application;
+  DummyControl control;
 
   // Get Const Empty
   {
     try
     {
       const DummyControl constControl(control);
 
   // Get Const Empty
   {
     try
     {
       const DummyControl constControl(control);
-      const Toolkit::Internal::Control& controlImpl = constControl.GetImplementation();
+      const Toolkit::Internal::Control& controlImpl = Toolkit::Internal::GetImplementation( constControl );
       (void)controlImpl; // Avoid unused warning
       tet_result(TET_FAIL);
     }
       (void)controlImpl; // Avoid unused warning
       tet_result(TET_FAIL);
     }
@@ -238,14 +244,19 @@ int UtcDaliControlGetImplementation(void)
       tet_result(TET_PASS);
     }
   }
       tet_result(TET_PASS);
     }
   }
+  END_TEST;
+}
 
 
-  control = DummyControl::New();
+int UtcDaliControlGetImplementationP(void)
+{
+  ToolkitTestApplication application;
+  DummyControl control = DummyControl::New();
 
   // Get
   {
     try
     {
 
   // Get
   {
     try
     {
-      Toolkit::Internal::Control& controlImpl = control.GetImplementation();
+      Toolkit::Internal::Control& controlImpl = Toolkit::Internal::GetImplementation( control );
       (void)controlImpl; // Avoid unused warning
       tet_result(TET_PASS);
     }
       (void)controlImpl; // Avoid unused warning
       tet_result(TET_PASS);
     }
@@ -254,13 +265,19 @@ int UtcDaliControlGetImplementation(void)
       tet_result(TET_FAIL);
     }
   }
       tet_result(TET_FAIL);
     }
   }
+  END_TEST;
+}
 
 
+int UtcDaliControlGetImplementationConstP(void)
+{
+  ToolkitTestApplication application;
+  DummyControl control = DummyControl::New();
   // Get Const
   {
     try
     {
       const DummyControl constControl(control);
   // Get Const
   {
     try
     {
       const DummyControl constControl(control);
-      const Toolkit::Internal::Control& controlImpl = constControl.GetImplementation();
+      const Toolkit::Internal::Control& controlImpl = Toolkit::Internal::GetImplementation( constControl );
       (void)controlImpl; // Avoid unused warning
       tet_result(TET_PASS);
     }
       (void)controlImpl; // Avoid unused warning
       tet_result(TET_PASS);
     }
@@ -281,7 +298,7 @@ int UtcDaliControlSignalConnectDisconnect(void)
 
     Actor actor = Actor::New();
     DALI_TEST_EQUALS( actor.OnStageSignal().GetConnectionCount(), 0u, TEST_LOCATION );
 
     Actor actor = Actor::New();
     DALI_TEST_EQUALS( actor.OnStageSignal().GetConnectionCount(), 0u, TEST_LOCATION );
-    Toolkit::Internal::Control& control = dummy.GetImplementation();
+    Toolkit::Internal::Control& control = Toolkit::Internal::GetImplementation( dummy );
     DummyControlImpl* dummyImpl = dynamic_cast<DummyControlImpl*>(&control);
     DALI_TEST_CHECK( dummyImpl );
 
     DummyControlImpl* dummyImpl = dynamic_cast<DummyControlImpl*>(&control);
     DALI_TEST_CHECK( dummyImpl );
 
@@ -310,7 +327,7 @@ int UtcDaliControlSignalAutomaticDisconnect(void)
 
   {
     DummyControl dummy = DummyControlImpl::New();
 
   {
     DummyControl dummy = DummyControlImpl::New();
-    Toolkit::Internal::Control& control = dummy.GetImplementation();
+    Toolkit::Internal::Control& control = Toolkit::Internal::GetImplementation( dummy );
     DummyControlImpl* dummyImpl = dynamic_cast<DummyControlImpl*>(&control);
     DALI_TEST_CHECK( dummyImpl );
 
     DummyControlImpl* dummyImpl = dynamic_cast<DummyControlImpl*>(&control);
     DALI_TEST_CHECK( dummyImpl );
 
@@ -362,11 +379,9 @@ int UtcDaliControlBackgroundColor(void)
   ToolkitTestApplication application;
   Control control = Control::New();
 
   ToolkitTestApplication application;
   Control control = Control::New();
 
-  DALI_TEST_CHECK( !control.GetBackgroundActor() );
   DALI_TEST_EQUALS( control.GetBackgroundColor(), Color::TRANSPARENT, TEST_LOCATION );
 
   control.SetBackgroundColor( Color::RED );
   DALI_TEST_EQUALS( control.GetBackgroundColor(), Color::TRANSPARENT, TEST_LOCATION );
 
   control.SetBackgroundColor( Color::RED );
-  DALI_TEST_CHECK( control.GetBackgroundActor() );
   DALI_TEST_EQUALS( control.GetBackgroundColor(), Color::RED, TEST_LOCATION );
 
   END_TEST;
   DALI_TEST_EQUALS( control.GetBackgroundColor(), Color::RED, TEST_LOCATION );
 
   END_TEST;
@@ -377,24 +392,20 @@ int UtcDaliControlBackgroundImage(void)
   ToolkitTestApplication application;
   Control control = Control::New();
 
   ToolkitTestApplication application;
   Control control = Control::New();
 
-  DALI_TEST_CHECK( !control.GetBackgroundActor() );
   DALI_TEST_EQUALS( control.GetBackgroundColor(), Color::TRANSPARENT, TEST_LOCATION );
 
   Image image = ResourceImage::New("TestImage");
   control.SetBackgroundImage( image );
   DALI_TEST_EQUALS( control.GetBackgroundColor(), Color::TRANSPARENT, TEST_LOCATION );
 
   Image image = ResourceImage::New("TestImage");
   control.SetBackgroundImage( image );
-  DALI_TEST_CHECK( control.GetBackgroundActor() );
   DALI_TEST_EQUALS( control.GetBackgroundColor(), Color::WHITE, TEST_LOCATION );
 
   control.SetBackgroundColor( Color::GREEN );
   DALI_TEST_EQUALS( control.GetBackgroundColor(), Color::GREEN, TEST_LOCATION );
 
   control.ClearBackground();
   DALI_TEST_EQUALS( control.GetBackgroundColor(), Color::WHITE, TEST_LOCATION );
 
   control.SetBackgroundColor( Color::GREEN );
   DALI_TEST_EQUALS( control.GetBackgroundColor(), Color::GREEN, TEST_LOCATION );
 
   control.ClearBackground();
-  DALI_TEST_CHECK( !control.GetBackgroundActor() );
   DALI_TEST_EQUALS( control.GetBackgroundColor(), Color::TRANSPARENT, TEST_LOCATION );
 
   control.SetBackgroundColor( Color::YELLOW );
   control.SetBackgroundImage( image );
   DALI_TEST_EQUALS( control.GetBackgroundColor(), Color::TRANSPARENT, TEST_LOCATION );
 
   control.SetBackgroundColor( Color::YELLOW );
   control.SetBackgroundImage( image );
-  DALI_TEST_CHECK( control.GetBackgroundActor() );
   DALI_TEST_EQUALS( control.GetBackgroundColor(), Color::YELLOW, TEST_LOCATION );
 
   END_TEST;
   DALI_TEST_EQUALS( control.GetBackgroundColor(), Color::YELLOW, TEST_LOCATION );
 
   END_TEST;
@@ -405,13 +416,13 @@ int UtcDaliControlBackgroundProperties(void)
   ToolkitTestApplication application;
   Control control = Control::New();
 
   ToolkitTestApplication application;
   Control control = Control::New();
 
-  DALI_TEST_CHECK( !control.GetBackgroundActor() );
+  DALI_TEST_CHECK( control.GetChildCount() == 0 );
   DALI_TEST_EQUALS( control.GetBackgroundColor(), Color::TRANSPARENT, TEST_LOCATION );
   DALI_TEST_EQUALS( control.GetProperty( Control::Property::BACKGROUND_COLOR ).Get< Vector4 >(), Color::TRANSPARENT, TEST_LOCATION );
   DALI_TEST_CHECK( control.GetProperty( Control::Property::BACKGROUND_IMAGE ).Get< Property::Map >().Empty() );
 
   control.SetProperty( Control::Property::BACKGROUND_COLOR, Color::RED );
   DALI_TEST_EQUALS( control.GetBackgroundColor(), Color::TRANSPARENT, TEST_LOCATION );
   DALI_TEST_EQUALS( control.GetProperty( Control::Property::BACKGROUND_COLOR ).Get< Vector4 >(), Color::TRANSPARENT, TEST_LOCATION );
   DALI_TEST_CHECK( control.GetProperty( Control::Property::BACKGROUND_IMAGE ).Get< Property::Map >().Empty() );
 
   control.SetProperty( Control::Property::BACKGROUND_COLOR, Color::RED );
-  DALI_TEST_CHECK( control.GetBackgroundActor() );
+  DALI_TEST_CHECK( control.GetChildCount() > 0 );
   DALI_TEST_EQUALS( control.GetBackgroundColor(), Color::RED, TEST_LOCATION );
   DALI_TEST_EQUALS( control.GetProperty( Control::Property::BACKGROUND_COLOR ).Get< Vector4 >(), Color::RED, TEST_LOCATION );
 
   DALI_TEST_EQUALS( control.GetBackgroundColor(), Color::RED, TEST_LOCATION );
   DALI_TEST_EQUALS( control.GetProperty( Control::Property::BACKGROUND_COLOR ).Get< Vector4 >(), Color::RED, TEST_LOCATION );
 
@@ -420,7 +431,7 @@ int UtcDaliControlBackgroundProperties(void)
   Property::Map map;
   map[ "image" ] = imageMap;
   control.SetProperty( Control::Property::BACKGROUND_IMAGE, map );
   Property::Map map;
   map[ "image" ] = imageMap;
   control.SetProperty( Control::Property::BACKGROUND_IMAGE, map );
-  DALI_TEST_CHECK( control.GetBackgroundActor() );
+  DALI_TEST_CHECK( control.GetChildCount() > 0 );
   DALI_TEST_EQUALS( control.GetBackgroundColor(), Color::RED, TEST_LOCATION );
   DALI_TEST_EQUALS( control.GetProperty( Control::Property::BACKGROUND_COLOR ).Get< Vector4 >(), Color::RED, TEST_LOCATION );
 
   DALI_TEST_EQUALS( control.GetBackgroundColor(), Color::RED, TEST_LOCATION );
   DALI_TEST_EQUALS( control.GetProperty( Control::Property::BACKGROUND_COLOR ).Get< Vector4 >(), Color::RED, TEST_LOCATION );
 
@@ -431,7 +442,7 @@ int UtcDaliControlBackgroundProperties(void)
 
   Property::Map emptyMap;
   control.SetProperty( Control::Property::BACKGROUND_IMAGE, emptyMap );
 
   Property::Map emptyMap;
   control.SetProperty( Control::Property::BACKGROUND_IMAGE, emptyMap );
-  DALI_TEST_CHECK( !control.GetBackgroundActor() );
+  DALI_TEST_CHECK( control.GetChildCount() == 0 );
   DALI_TEST_EQUALS( control.GetBackgroundColor(), Color::TRANSPARENT, TEST_LOCATION );
   DALI_TEST_EQUALS( control.GetProperty( Control::Property::BACKGROUND_COLOR ).Get< Vector4 >(), Color::TRANSPARENT, TEST_LOCATION );
   DALI_TEST_CHECK( control.GetProperty( Control::Property::BACKGROUND_IMAGE ).Get< Property::Map >().Empty() );
   DALI_TEST_EQUALS( control.GetBackgroundColor(), Color::TRANSPARENT, TEST_LOCATION );
   DALI_TEST_EQUALS( control.GetProperty( Control::Property::BACKGROUND_COLOR ).Get< Vector4 >(), Color::TRANSPARENT, TEST_LOCATION );
   DALI_TEST_CHECK( control.GetProperty( Control::Property::BACKGROUND_IMAGE ).Get< Property::Map >().Empty() );
@@ -531,3 +542,15 @@ int UtcDaliControlImplKeyInputFocusLostSignal(void)
 
   END_TEST;
 }
 
   END_TEST;
 }
+
+int UtcDaliControlImplGetControlExtensionP(void)
+{
+  ToolkitTestApplication application;
+  Control control = Control::New();
+
+  Toolkit::Internal::Control& controlImpl = Toolkit::Internal::GetImplementation( control );
+
+  DALI_TEST_CHECK( NULL == controlImpl.GetControlExtension() );
+
+  END_TEST;
+}
index f1dab7e..b832eff 100644 (file)
@@ -467,7 +467,7 @@ void FocusManager::DoActivate(Actor actor)
     if(control)
     {
       // Notify the control that it is activated
     if(control)
     {
       // Notify the control that it is activated
-      control.GetImplementation().Activate();
+      GetImplementation( control ).Activate();
     }
 
     // Send notification for the activation of focused actor
     }
 
     // Send notification for the activation of focused actor
@@ -815,7 +815,7 @@ bool FocusManager::AccessibilityActionUp()
       if(control)
       {
         // Notify the control that it is activated
       if(control)
       {
         // Notify the control that it is activated
-        ret = control.GetImplementation().OnAccessibilityValueChange(true);
+        ret = GetImplementation( control ).OnAccessibilityValueChange(true);
       }
     }
   }
       }
     }
   }
@@ -836,7 +836,7 @@ bool FocusManager::AccessibilityActionDown()
       if(control)
       {
         // Notify the control that it is activated
       if(control)
       {
         // Notify the control that it is activated
-        ret = control.GetImplementation().OnAccessibilityValueChange(false);
+        ret = GetImplementation( control ).OnAccessibilityValueChange(false);
       }
     }
   }
       }
     }
   }
@@ -873,7 +873,7 @@ bool FocusManager::AccessibilityActionTouch(const TouchEvent& touchEvent)
   Dali::Toolkit::Control control = Dali::Toolkit::Control::DownCast(GetCurrentFocusActor());
   if(control)
   {
   Dali::Toolkit::Control control = Dali::Toolkit::Control::DownCast(GetCurrentFocusActor());
   if(control)
   {
-    handled = control.GetImplementation().OnAccessibilityTouch(touchEvent);
+    handled = GetImplementation( control ).OnAccessibilityTouch(touchEvent);
   }
 
   return handled;
   }
 
   return handled;
@@ -933,7 +933,7 @@ bool FocusManager::HandlePanGesture(const Integration::PanGestureEvent& panEvent
       pan.velocity.x = pan.displacement.x / panEvent.timeDelta;
       pan.velocity.y = pan.displacement.y / panEvent.timeDelta;
 
       pan.velocity.x = pan.displacement.x / panEvent.timeDelta;
       pan.velocity.y = pan.displacement.y / panEvent.timeDelta;
 
-      handled = control.GetImplementation().OnAccessibilityPan(pan);
+      handled = GetImplementation( control ).OnAccessibilityPan(pan);
     }
 
     // If the gesture is not handled by the control, check its parent
     }
 
     // If the gesture is not handled by the control, check its parent
index facff71..cfe7287 100644 (file)
@@ -195,7 +195,7 @@ Actor KeyboardFocusManager::GetCurrentFocusGroup()
 bool KeyboardFocusManager::IsLayoutControl(Actor actor) const
 {
   Toolkit::Control control = Toolkit::Control::DownCast(actor);
 bool KeyboardFocusManager::IsLayoutControl(Actor actor) const
 {
   Toolkit::Control control = Toolkit::Control::DownCast(actor);
-  return control && control.GetImplementation().IsKeyboardNavigationSupported();
+  return control && GetImplementation( control ).IsKeyboardNavigationSupported();
 }
 
 Toolkit::Control KeyboardFocusManager::GetParentLayoutControl(Actor actor) const
 }
 
 Toolkit::Control KeyboardFocusManager::GetParentLayoutControl(Actor actor) const
@@ -260,7 +260,7 @@ bool KeyboardFocusManager::MoveFocus(Toolkit::Control::KeyboardFocusNavigationDi
 bool KeyboardFocusManager::DoMoveFocusWithinLayoutControl(Toolkit::Control control, Actor actor, Toolkit::Control::KeyboardFocusNavigationDirection direction)
 {
   // Ask the control for the next actor to focus
 bool KeyboardFocusManager::DoMoveFocusWithinLayoutControl(Toolkit::Control control, Actor actor, Toolkit::Control::KeyboardFocusNavigationDirection direction)
 {
   // Ask the control for the next actor to focus
-  Actor nextFocusableActor = control.GetImplementation().GetNextKeyboardFocusableActor(actor, direction, mFocusGroupLoopEnabled);
+  Actor nextFocusableActor = GetImplementation( control ).GetNextKeyboardFocusableActor(actor, direction, mFocusGroupLoopEnabled);
   if(nextFocusableActor)
   {
     if(!nextFocusableActor.IsKeyboardFocusable())
   if(nextFocusableActor)
   {
     if(!nextFocusableActor.IsKeyboardFocusable())
@@ -299,7 +299,7 @@ bool KeyboardFocusManager::DoMoveFocusWithinLayoutControl(Toolkit::Control contr
             // If the application hasn't changed our proposed actor, we informs the layout control we will
             // move the focus to what the control returns. The control might wish to perform some actions
             // before the focus is actually moved.
             // If the application hasn't changed our proposed actor, we informs the layout control we will
             // move the focus to what the control returns. The control might wish to perform some actions
             // before the focus is actually moved.
-            control.GetImplementation().OnKeyboardFocusChangeCommitted(committedFocusActor);
+            GetImplementation( control ).OnKeyboardFocusChangeCommitted( committedFocusActor );
           }
 
           return SetCurrentFocusActor(committedFocusActor);
           }
 
           return SetCurrentFocusActor(committedFocusActor);
@@ -351,7 +351,7 @@ void KeyboardFocusManager::DoActivate(Actor actor)
     if(control)
     {
       // Notify the control that it is activated
     if(control)
     {
       // Notify the control that it is activated
-      control.GetImplementation().Activate();
+      GetImplementation( control ).Activate();
     }
 
     // Send notification for the activation of focused actor
     }
 
     // Send notification for the activation of focused actor
index 9fee428..48f0ebf 100644 (file)
@@ -88,13 +88,13 @@ void KeyInputFocusManager::SetFocus( Toolkit::Control control )
   if( previousFocusControl )
   {
     // Notify the control that it has lost key input focus
   if( previousFocusControl )
   {
     // Notify the control that it has lost key input focus
-    previousFocusControl.GetImplementation().OnKeyInputFocusLost();
+    GetImplementation( previousFocusControl ).OnKeyInputFocusLost();
   }
 
   mFocusStack.PushBack( &control.GetBaseObject() );
 
   // Tell the new actor that it has gained focus.
   }
 
   mFocusStack.PushBack( &control.GetBaseObject() );
 
   // Tell the new actor that it has gained focus.
-  control.GetImplementation().OnKeyInputFocusGained();
+  GetImplementation( control ).OnKeyInputFocusGained();
 
   // Emit the signal to inform focus change to the application.
   if ( !mKeyInputFocusChangedSignal.Empty() )
 
   // Emit the signal to inform focus change to the application.
   if ( !mKeyInputFocusChangedSignal.Empty() )
@@ -113,7 +113,7 @@ void KeyInputFocusManager::RemoveFocus( Toolkit::Control control )
       control.OffStageSignal().Disconnect( mSlotDelegate, &KeyInputFocusManager::OnFocusControlStageDisconnection );
 
       // Notify the control that it has lost key input focus
       control.OffStageSignal().Disconnect( mSlotDelegate, &KeyInputFocusManager::OnFocusControlStageDisconnection );
 
       // Notify the control that it has lost key input focus
-      control.GetImplementation().OnKeyInputFocusLost();
+      GetImplementation( control ).OnKeyInputFocusLost();
 
       // If this is the top-most actor, pop it and change focus to the previous control
       if( pos == mFocusStack.End() - 1 )
 
       // If this is the top-most actor, pop it and change focus to the previous control
       if( pos == mFocusStack.End() - 1 )
@@ -124,7 +124,7 @@ void KeyInputFocusManager::RemoveFocus( Toolkit::Control control )
         if( previouslyFocusedControl )
         {
           // Tell the control that it has gained focus.
         if( previouslyFocusedControl )
         {
           // Tell the control that it has gained focus.
-          previouslyFocusedControl.GetImplementation().OnKeyInputFocusGained();
+          GetImplementation( previouslyFocusedControl ).OnKeyInputFocusGained();
         }
       }
       else
         }
       }
       else
@@ -194,7 +194,7 @@ void KeyInputFocusManager::OnKeyEvent( const KeyEvent& event )
       if( control )
       {
         // Notify the control about the key event
       if( control )
       {
         // Notify the control about the key event
-        consumed = control.GetImplementation().EmitKeyEventSignal( event );
+        consumed = GetImplementation( control ).EmitKeyEventSignal( event );
       }
     }
   }
       }
     }
   }
index cd4301d..d655a3b 100644 (file)
@@ -180,8 +180,7 @@ public:
     mLongPressGestureDetector(),
     mFlags( Control::ControlBehaviour( ACTOR_BEHAVIOUR_NONE ) ),
     mIsKeyboardNavigationSupported( false ),
     mLongPressGestureDetector(),
     mFlags( Control::ControlBehaviour( ACTOR_BEHAVIOUR_NONE ) ),
     mIsKeyboardNavigationSupported( false ),
-    mIsKeyboardFocusGroup( false ),
-    mInitialized( false )
+    mIsKeyboardFocusGroup( false )
   {
   }
 
   {
   }
 
@@ -243,7 +242,7 @@ public:
 
     if ( control )
     {
 
     if ( control )
     {
-      Control& controlImpl( control.GetImplementation() );
+      Control& controlImpl( GetImplementation( control ) );
 
       switch ( index )
       {
 
       switch ( index )
       {
@@ -309,7 +308,7 @@ public:
 
     if ( control )
     {
 
     if ( control )
     {
-      Control& controlImpl( control.GetImplementation() );
+      Control& controlImpl( GetImplementation( control ) );
 
       switch ( index )
       {
 
       switch ( index )
       {
@@ -329,10 +328,10 @@ public:
         {
           Property::Map map;
 
         {
           Property::Map map;
 
-          Actor actor = controlImpl.GetBackgroundActor();
-          if ( actor )
+          Background* back = controlImpl.mImpl->mBackground;
+          if( back )
           {
           {
-            ImageActor imageActor = ImageActor::DownCast( actor );
+            ImageActor imageActor = ImageActor::DownCast( back->actor );
             if ( imageActor )
             {
               Image image = imageActor.GetImage();
             if ( imageActor )
             {
               Image image = imageActor.GetImage();
@@ -376,7 +375,6 @@ public:
   ControlBehaviour mFlags :CONTROL_BEHAVIOUR_FLAG_COUNT;    ///< Flags passed in from constructor.
   bool mIsKeyboardNavigationSupported :1;  ///< Stores whether keyboard navigation is supported by the control.
   bool mIsKeyboardFocusGroup :1;           ///< Stores whether the control is a focus group.
   ControlBehaviour mFlags :CONTROL_BEHAVIOUR_FLAG_COUNT;    ///< Flags passed in from constructor.
   bool mIsKeyboardNavigationSupported :1;  ///< Stores whether keyboard navigation is supported by the control.
   bool mIsKeyboardFocusGroup :1;           ///< Stores whether the control is a focus group.
-  bool mInitialized :1;
 
   // Properties - these need to be members of Internal::Control::Impl as they need to function within this class.
   static PropertyRegistration PROPERTY_1;
 
   // Properties - these need to be members of Internal::Control::Impl as they need to function within this class.
   static PropertyRegistration PROPERTY_1;
@@ -411,45 +409,6 @@ Control::~Control()
   delete mImpl;
 }
 
   delete mImpl;
 }
 
-Vector3 Control::GetNaturalSize()
-{
-  if( mImpl->mBackground )
-  {
-    Actor actor = mImpl->mBackground->actor;
-    if( actor )
-    {
-      return actor.GetNaturalSize();
-    }
-  }
-  return Vector3();
-}
-
-float Control::GetHeightForWidth( float width )
-{
-  if( mImpl->mBackground )
-  {
-    Actor actor = mImpl->mBackground->actor;
-    if( actor )
-    {
-      return actor.GetHeightForWidth( width );
-    }
-  }
-  return GetHeightForWidthBase( width );
-}
-
-float Control::GetWidthForHeight( float height )
-{
-  if( mImpl->mBackground )
-  {
-    Actor actor = mImpl->mBackground->actor;
-    if( actor )
-    {
-      return actor.GetWidthForHeight( height );
-    }
-  }
-  return GetWidthForHeightBase( height );
-}
-
 void Control::SetKeyInputFocus()
 {
   if( Self().OnStage() )
 void Control::SetKeyInputFocus()
 {
   if( Self().OnStage() )
@@ -577,16 +536,6 @@ void Control::ClearBackground()
   }
 }
 
   }
 }
 
-Actor Control::GetBackgroundActor() const
-{
-  if ( mImpl->mBackground )
-  {
-    return mImpl->mBackground->actor;
-  }
-
-  return Actor();
-}
-
 void Control::SetKeyboardNavigationSupport(bool isSupported)
 {
   mImpl->mIsKeyboardNavigationSupported = isSupported;
 void Control::SetKeyboardNavigationSupport(bool isSupported)
 {
   mImpl->mIsKeyboardNavigationSupported = isSupported;
@@ -600,7 +549,11 @@ bool Control::IsKeyboardNavigationSupported()
 void Control::Activate()
 {
   // Inform deriving classes
 void Control::Activate()
 {
   // Inform deriving classes
-  OnActivated();
+  OnAccessibilityActivated();
+}
+
+void Control::OnAccessibilityActivated()
+{
 }
 
 bool Control::OnAccessibilityPan(PanGesture gesture)
 }
 
 bool Control::OnAccessibilityPan(PanGesture gesture)
@@ -650,7 +603,7 @@ bool Control::DoAction(BaseObject* object, const std::string& actionName, const
     if( control )
     {
       // if cast succeeds there is an implementation so no need to check
     if( control )
     {
       // if cast succeeds there is an implementation so no need to check
-      control.GetImplementation().OnActivated();
+      GetImplementation( control ).OnAccessibilityActivated();
     }
   }
 
     }
   }
 
@@ -665,7 +618,7 @@ bool Control::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* t
   Toolkit::Control control = Toolkit::Control::DownCast( handle );
   if ( control )
   {
   Toolkit::Control control = Toolkit::Control::DownCast( handle );
   if ( control )
   {
-    Control& controlImpl( control.GetImplementation() );
+    Control& controlImpl( GetImplementation( control ) );
     connected = true;
 
     if ( 0 == strcmp( signalName.c_str(), SIGNAL_KEY_EVENT ) )
     connected = true;
 
     if ( 0 == strcmp( signalName.c_str(), SIGNAL_KEY_EVENT ) )
@@ -755,9 +708,6 @@ Control::Control( ControlBehaviour behaviourFlags )
 
 void Control::Initialize()
 {
 
 void Control::Initialize()
 {
-  // Calling deriving classes
-  OnInitialize();
-
   if( mImpl->mFlags & REQUIRES_STYLE_CHANGE_SIGNALS )
   {
     Toolkit::StyleManager styleManager = Toolkit::StyleManager::Get();
   if( mImpl->mFlags & REQUIRES_STYLE_CHANGE_SIGNALS )
   {
     Toolkit::StyleManager styleManager = Toolkit::StyleManager::Get();
@@ -774,7 +724,8 @@ void Control::Initialize()
     SetKeyboardNavigationSupport( true );
   }
 
     SetKeyboardNavigationSupport( true );
   }
 
-  mImpl->mInitialized = true;
+  // Calling deriving classes
+  OnInitialize();
 }
 
 void Control::EnableGestureDetection(Gesture::Type type)
 }
 
 void Control::EnableGestureDetection(Gesture::Type type)
@@ -839,7 +790,19 @@ void Control::OnInitialize()
 {
 }
 
 {
 }
 
-void Control::OnActivated()
+void Control::OnControlStageConnection()
+{
+}
+
+void Control::OnControlStageDisconnection()
+{
+}
+
+void Control::OnControlChildAdd( Actor& child )
+{
+}
+
+void Control::OnControlChildRemove( Actor& child )
 {
 }
 
 {
 }
 
@@ -880,56 +843,10 @@ void Control::OnLongPress( const LongPressGesture& longPress )
 {
 }
 
 {
 }
 
-void Control::OnControlStageConnection()
-{
-}
-
-void Control::OnControlStageDisconnection()
-{
-}
-
-void Control::OnControlChildAdd( Actor& child )
-{
-}
-
-void Control::OnControlChildRemove( Actor& child )
-{
-}
-
 void Control::OnControlSizeSet( const Vector3& size )
 {
 }
 
 void Control::OnControlSizeSet( const Vector3& size )
 {
 }
 
-void Control::OnCalculateRelayoutSize( Dimension::Type dimension )
-{
-}
-
-void Control::OnLayoutNegotiated( float size, Dimension::Type dimension )
-{
-}
-
-void Control::OnRelayout( const Vector2& size, RelayoutContainer& container )
-{
-  for( unsigned int i = 0, numChildren = Self().GetChildCount(); i < numChildren; ++i )
-  {
-    container.Add( Self().GetChildAt( i ), size );
-  }
-}
-
-void Control::OnSetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension )
-{
-}
-
-float Control::CalculateChildSize( const Dali::Actor& child, Dimension::Type dimension )
-{
-  return CalculateChildSizeBase( child, dimension );
-}
-
-bool Control::RelayoutDependentOnChildren( Dimension::Type dimension )
-{
-  return RelayoutDependentOnChildrenBase( dimension );
-}
-
 void Control::EmitKeyInputFocusSignal( bool focusGained )
 {
   Dali::Toolkit::Control handle( GetOwner() );
 void Control::EmitKeyInputFocusSignal( bool focusGained )
 {
   Dali::Toolkit::Control handle( GetOwner() );
@@ -962,9 +879,53 @@ void Control::OnKeyInputFocusLost()
   EmitKeyInputFocusSignal( false );
 }
 
   EmitKeyInputFocusSignal( false );
 }
 
+void Control::OnStageConnection()
+{
+  // Notify derived classes.
+  OnControlStageConnection();
+}
+
+void Control::OnStageDisconnection()
+{
+  // Notify derived classes
+  OnControlStageDisconnection();
+}
+
+void Control::OnChildAdd(Actor& child)
+{
+  // If this is the background actor, then we do not want to relayout or inform deriving classes
+  if ( mImpl->mBackground && ( child == mImpl->mBackground->actor ) )
+  {
+    return;
+  }
+
+  // Notify derived classes.
+  OnControlChildAdd( child );
+}
+
+void Control::OnChildRemove(Actor& child)
+{
+  // If this is the background actor, then we do not want to relayout or inform deriving classes
+  if ( mImpl->mBackground && ( child == mImpl->mBackground->actor ) )
+  {
+    return;
+  }
+
+  // Notify derived classes.
+  OnControlChildRemove( child );
+}
+
+void Control::OnSizeSet(const Vector3& targetSize)
+{
+  // Background is resized through size negotiation
+
+  // Notify derived classes.
+  OnControlSizeSet( targetSize );
+}
+
 void Control::OnSizeAnimation(Animation& animation, const Vector3& targetSize)
 {
 void Control::OnSizeAnimation(Animation& animation, const Vector3& targetSize)
 {
-  // @todo consider animating negotiated child sizes to target size
+  // @todo size negotiate background to new size, animate as well?
 }
 
 bool Control::OnTouchEvent(const TouchEvent& event)
 }
 
 bool Control::OnTouchEvent(const TouchEvent& event)
@@ -987,48 +948,73 @@ bool Control::OnMouseWheelEvent(const MouseWheelEvent& event)
   return false; // Do not consume
 }
 
   return false; // Do not consume
 }
 
-void Control::OnStageConnection()
+void Control::OnRelayout( const Vector2& size, RelayoutContainer& container )
 {
 {
-  // Notify derived classes.
-  OnControlStageConnection();
+  for( unsigned int i = 0, numChildren = Self().GetChildCount(); i < numChildren; ++i )
+  {
+    container.Add( Self().GetChildAt( i ), size );
+  }
 }
 
 }
 
-void Control::OnStageDisconnection()
+void Control::OnSetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension )
 {
 {
-  // Notify derived classes
-  OnControlStageDisconnection();
 }
 
 }
 
-void Control::OnChildAdd(Actor& child)
+Vector3 Control::GetNaturalSize()
 {
 {
-  // If this is the background actor, then we do not want to relayout or inform deriving classes
-  if ( mImpl->mBackground && ( child == mImpl->mBackground->actor ) )
+  if( mImpl->mBackground )
   {
   {
-    return;
+    Actor actor = mImpl->mBackground->actor;
+    if( actor )
+    {
+      return actor.GetNaturalSize();
+    }
   }
   }
+  return Vector3();
+}
 
 
-  // Notify derived classes.
-  OnControlChildAdd( child );
+float Control::CalculateChildSize( const Dali::Actor& child, Dimension::Type dimension )
+{
+  return CalculateChildSizeBase( child, dimension );
 }
 
 }
 
-void Control::OnChildRemove(Actor& child)
+float Control::GetHeightForWidth( float width )
 {
 {
-  // If this is the background actor, then we do not want to relayout or inform deriving classes
-  if ( mImpl->mBackground && ( child == mImpl->mBackground->actor ) )
+  if( mImpl->mBackground )
   {
   {
-    return;
+    Actor actor = mImpl->mBackground->actor;
+    if( actor )
+    {
+      return actor.GetHeightForWidth( width );
+    }
   }
   }
+  return GetHeightForWidthBase( width );
+}
 
 
-  // Notify derived classes.
-  OnControlChildRemove( child );
+float Control::GetWidthForHeight( float height )
+{
+  if( mImpl->mBackground )
+  {
+    Actor actor = mImpl->mBackground->actor;
+    if( actor )
+    {
+      return actor.GetWidthForHeight( height );
+    }
+  }
+  return GetWidthForHeightBase( height );
 }
 
 }
 
-void Control::OnSizeSet(const Vector3& targetSize)
+bool Control::RelayoutDependentOnChildren( Dimension::Type dimension )
 {
 {
-  // Background is resized through size negotiation
+  return RelayoutDependentOnChildrenBase( dimension );
+}
 
 
-  // Notify derived classes.
-  OnControlSizeSet( targetSize );
+void Control::OnCalculateRelayoutSize( Dimension::Type dimension )
+{
+}
+
+void Control::OnLayoutNegotiated( float size, Dimension::Type dimension )
+{
 }
 
 void Control::SignalConnected( SlotObserver* slotObserver, CallbackBase* callback )
 }
 
 void Control::SignalConnected( SlotObserver* slotObserver, CallbackBase* callback )
@@ -1041,6 +1027,22 @@ void Control::SignalDisconnected( SlotObserver* slotObserver, CallbackBase* call
   mImpl->SignalDisconnected( slotObserver, callback );
 }
 
   mImpl->SignalDisconnected( slotObserver, callback );
 }
 
+Control& GetImplementation( Dali::Toolkit::Control& handle )
+{
+  CustomActorImpl& customInterface = handle.GetImplementation();
+  // downcast to control
+  Control& impl = dynamic_cast< Internal::Control& >( customInterface );
+  return impl;
+}
+
+const Control& GetImplementation( const Dali::Toolkit::Control& handle )
+{
+  const CustomActorImpl& customInterface = handle.GetImplementation();
+  // downcast to control
+  const Control& impl = dynamic_cast< const Internal::Control& >( customInterface );
+  return impl;
+}
+
 } // namespace Internal
 
 } // namespace Toolkit
 } // namespace Internal
 
 } // namespace Toolkit
index 68a9c4b..a7e2c91 100644 (file)
@@ -35,16 +35,13 @@ namespace Dali
 
 namespace Toolkit
 {
 
 namespace Toolkit
 {
-
 class StyleManager;
 
 class StyleManager;
 
-namespace Internal DALI_INTERNAL
-{
-class KeyInputFocusManager;
-}
-
 namespace Internal
 {
 namespace Internal
 {
+class FocusManager;
+class KeyboardFocusManager;
+class KeyInputFocusManager;
 
 /**
  * @brief This is the internal base class for all controls.
 
 /**
  * @brief This is the internal base class for all controls.
@@ -74,23 +71,6 @@ public:
    */
   virtual ~Control();
 
    */
   virtual ~Control();
 
-  // Size negotiation
-
-  /**
-   * @copydoc Dali::CustomActorImpl::GetHeightForWidth()
-   */
-  virtual float GetHeightForWidth( float width );
-
-  /**
-   * @copydoc Dali::CustomActorImpl::GetWidthForHeight()
-   */
-  virtual float GetWidthForHeight( float height );
-
-  /**
-   * @copydoc Toolkit::CustomActorImpl::GetNaturalSize()
-   */
-  virtual Vector3 GetNaturalSize();
-
   // Key Input
 
   /**
   // Key Input
 
   /**
@@ -154,7 +134,7 @@ public:
    */
   LongPressGestureDetector GetLongPressGestureDetector() const;
 
    */
   LongPressGestureDetector GetLongPressGestureDetector() const;
 
-  // Background
+  // Styling
 
   /**
    * @copydoc Dali::Toolkit::Control::SetStyleName
 
   /**
    * @copydoc Dali::Toolkit::Control::SetStyleName
@@ -166,6 +146,8 @@ public:
    */
   const std::string& GetStyleName() const;
 
    */
   const std::string& GetStyleName() const;
 
+  // Background
+
   /**
    * @copydoc Dali::Toolkit::Control::SetBackgroundColor
    */
   /**
    * @copydoc Dali::Toolkit::Control::SetBackgroundColor
    */
@@ -186,11 +168,6 @@ public:
    */
   void ClearBackground();
 
    */
   void ClearBackground();
 
-  /**
-   * @copydoc Dali::Toolkit::Control::GetBackgroundActor
-   */
-  Actor GetBackgroundActor() const;
-
   // Keyboard Navigation
 
   /**
   // Keyboard Navigation
 
   /**
@@ -217,33 +194,6 @@ public:
    */
   DALI_INTERNAL void Activate();
 
    */
   DALI_INTERNAL void Activate();
 
-  /**
-   * @brief This method should be overridden by deriving classes when they wish to respond the accessibility
-   * pan gesture.
-   *
-   * @param[in] gesture The pan gesture.
-   * @return true if the pan gesture has been consumed by this control
-   */
-  virtual bool OnAccessibilityPan(PanGesture gesture);
-
-  /**
-   * @brief This method should be overridden by deriving classes when they wish to respond the accessibility
-   * touch event.
-   *
-   * @param[in] touchEvent The touch event.
-   * @return true if the touch event has been consumed by this control
-   */
-  virtual bool OnAccessibilityTouch(const TouchEvent& touchEvent);
-
-  /**
-   * @brief This method should be overridden by deriving classes when they wish to respond
-   * the accessibility up and down action (i.e. value change of slider control).
-   *
-   * @param[in] isIncrease Whether the value should be increased or decreased
-   * @return true if the value changed action has been consumed by this control
-   */
-  virtual bool OnAccessibilityValueChange(bool isIncrease);
-
   // Keyboard Focus
 
   /**
   // Keyboard Focus
 
   /**
@@ -263,27 +213,6 @@ public:
   bool IsKeyboardFocusGroup();
 
   /**
   bool IsKeyboardFocusGroup();
 
   /**
-   * @brief Gets the next keyboard focusable actor in this control towards the given direction.
-   *
-   * A control needs to override this function in order to support two dimensional keyboard navigation.
-   * @param[in] currentFocusedActor The current focused actor.
-   * @param[in] direction The direction to move the focus towards.
-   * @param[in] loopEnabled Whether the focus movement should be looped within the control.
-   * @return the next keyboard focusable actor in this control or an empty handle if no actor can be focused.
-   */
-  virtual Actor GetNextKeyboardFocusableActor(Actor currentFocusedActor, Toolkit::Control::KeyboardFocusNavigationDirection direction, bool loopEnabled);
-
-  /**
-   * @brief Informs this control that its chosen focusable actor will be focused.
-   *
-   * This allows the application to preform any actions if wishes
-   * before the focus is actually moved to the chosen actor.
-   *
-   * @param[in] commitedFocusableActor The commited focusable actor.
-   */
-  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.
    * @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.
@@ -338,7 +267,104 @@ public:
    */
   DALI_INTERNAL bool EmitKeyEventSignal(const KeyEvent& event);
 
    */
   DALI_INTERNAL bool EmitKeyEventSignal(const KeyEvent& event);
 
-protected:
+protected: // From CustomActorImpl, not to be used by application developers
+
+  /**
+   * @copydoc CustomActorImpl::OnStageConnection()
+   */
+  virtual void OnStageConnection();
+
+  /**
+   * @copydoc CustomActorImpl::OnStageDisconnection()
+   */
+  virtual void OnStageDisconnection();
+
+  /**
+   * @copydoc CustomActorImpl::OnChildAdd()
+   */
+  virtual void OnChildAdd(Actor& child);
+
+  /**
+   * @copydoc CustomActorImpl::OnChildRemove()
+   */
+  virtual void OnChildRemove(Actor& child);
+
+  /**
+   * @copydoc CustomActorImpl::OnSizeSet()
+   */
+  virtual void OnSizeSet(const Vector3& targetSize);
+
+  /**
+   * @copydoc CustomActorImpl::OnSizeAnimation()
+   */
+  virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize);
+
+  /**
+   * @copydoc CustomActorImpl::OnTouchEvent()
+   */
+  virtual bool OnTouchEvent(const TouchEvent& event);
+
+  /**
+   * @copydoc CustomActorImpl::OnHoverEvent()
+   */
+  virtual bool OnHoverEvent(const HoverEvent& event);
+
+  /**
+   * @copydoc CustomActorImpl::OnKeyEvent()
+   */
+  virtual bool OnKeyEvent(const KeyEvent& event);
+
+  /**
+   * @copydoc CustomActorImpl::OnMouseWheelEvent()
+   */
+  virtual bool OnMouseWheelEvent(const MouseWheelEvent& event);
+
+  /**
+   * @copydoc CustomActorImpl::OnRelayout()
+   */
+  virtual void OnRelayout( const Vector2& size, RelayoutContainer& container );
+
+  /**
+   * @copydoc CustomActorImpl::OnSetResizePolicy()
+   */
+  virtual void OnSetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension );
+
+  /**
+   * @copydoc CustomActorImpl::GetNaturalSize()
+   */
+  virtual Vector3 GetNaturalSize();
+
+  /**
+   * @copydoc CustomActorImpl::CalculateChildSize()
+   */
+  virtual float CalculateChildSize( const Dali::Actor& child, Dimension::Type dimension );
+
+  /**
+   * @copydoc CustomActorImpl::GetHeightForWidth()
+   */
+  virtual float GetHeightForWidth( float width );
+
+  /**
+   * @copydoc CustomActorImpl::GetWidthForHeight()
+   */
+  virtual float GetWidthForHeight( float height );
+
+  /**
+   * @copydoc CustomActorImpl::RelayoutDependentOnChildren()
+   */
+  virtual bool RelayoutDependentOnChildren( Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
+
+  /**
+   * @copydoc CustomActorImpl::OnCalculateRelayoutSize()
+   */
+  virtual void OnCalculateRelayoutSize( Dimension::Type dimension );
+
+  /**
+   * @copydoc CustomActorImpl::OnLayoutNegotiated()
+   */
+  virtual void OnLayoutNegotiated( float size, Dimension::Type dimension );
+
+protected: // Helpers for deriving classes
 
   // Construction
 
 
   // Construction
 
@@ -354,11 +380,11 @@ protected:
   static const int CONTROL_BEHAVIOUR_FLAG_COUNT = Log< LAST_CONTROL_BEHAVIOUR_FLAG - 1 >::value + 1;      ///< Total count of flags
 
   /**
   static const int CONTROL_BEHAVIOUR_FLAG_COUNT = Log< LAST_CONTROL_BEHAVIOUR_FLAG - 1 >::value + 1;      ///< Total count of flags
 
   /**
-   * @brief Create a Control.
+   * @brief Control constructor
    *
    * @param[in] behaviourFlags Behavioural flags from ControlBehaviour enum
    */
    *
    * @param[in] behaviourFlags Behavioural flags from ControlBehaviour enum
    */
-  Control(ControlBehaviour behaviourFlags);
+  Control( ControlBehaviour behaviourFlags );
 
   /**
    * @brief Second phase initialization.
 
   /**
    * @brief Second phase initialization.
@@ -376,7 +402,7 @@ protected:
    * @endcode
    * @param[in]  type  The gesture type(s) to enable.
    */
    * @endcode
    * @param[in]  type  The gesture type(s) to enable.
    */
-  void EnableGestureDetection(Gesture::Type type);
+  void EnableGestureDetection( Gesture::Type type );
 
   /**
    * @brief Allows deriving classes to disable any of the gesture detectors.
 
   /**
    * @brief Allows deriving classes to disable any of the gesture detectors.
@@ -385,16 +411,11 @@ protected:
    * @param[in]  type  The gesture type(s) to disable.
    * @see EnableGetureDetection
    */
    * @param[in]  type  The gesture type(s) to disable.
    * @see EnableGetureDetection
    */
-  void DisableGestureDetection(Gesture::Type type);
+  void DisableGestureDetection( Gesture::Type type );
 
 
-  /**
-   * @copydoc Dali::CustomActorImpl::RelayoutDependentOnChildren()
-   */
-  virtual bool RelayoutDependentOnChildren( Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
+public: // API for derived classes to override
 
 
-private:
-
-  // For derived classes to override
+  // Lifecycle
 
   /**
    * @brief This method is called after the Control has been initialized.
 
   /**
    * @brief This method is called after the Control has been initialized.
@@ -404,74 +425,6 @@ private:
   virtual void OnInitialize();
 
   /**
   virtual void OnInitialize();
 
   /**
-   * @brief This method is called when the control is activated.
-   *
-   * Derived classes should override this if they wish to be notified when they are activated.
-   */
-  virtual void OnActivated();
-
-  /**
-   * @brief This method should be overridden by deriving classes requiring notifications when the style changes.
-   *
-   * @param[in] styleManager  The StyleManager object.
-   * @param[in] change  Information denoting what has changed.
-   */
-  virtual void OnStyleChange( Toolkit::StyleManager styleManager, StyleChange::Type change );
-
-  /**
-   * @brief Called whenever a pinch gesture is detected on this control.
-   *
-   * This can be overridden by deriving classes when pinch detection
-   * is enabled.  The default behaviour is to scale the control by the
-   * pinch scale.
-   *
-   * @note If overridden, then the default behaviour will not occur.
-   * @note Pinch detection should be enabled via EnableGestureDetection().
-   * @param[in]  pinch  The pinch gesture.
-   * @see EnableGestureDetection
-   */
-  virtual void OnPinch(const PinchGesture& pinch);
-
-  /**
-   * @brief Called whenever a pan gesture is detected on this control.
-   *
-   * This should be overridden by deriving classes when pan detection
-   * is enabled.
-   *
-   * @note There is no default behaviour with panning.
-   * @note Pan detection should be enabled via EnableGestureDetection().
-   * @param[in]  pan  The pan gesture.
-   * @see EnableGestureDetection
-   */
-  virtual void OnPan( const PanGesture& pan );
-
-  /**
-   * @brief Called whenever a tap gesture is detected on this control.
-   *
-   * This should be overridden by deriving classes when tap detection
-   * is enabled.
-   *
-   * @note There is no default behaviour with a tap.
-   * @note Tap detection should be enabled via EnableGestureDetection().
-   * @param[in]  tap  The tap gesture.
-   * @see EnableGestureDetection
-   */
-  virtual void OnTap( const TapGesture& tap );
-
-  /**
-   * @brief Called whenever a long press gesture is detected on this control.
-   *
-   * This should be overridden by deriving classes when long press
-   * detection is enabled.
-   *
-   * @note There is no default behaviour associated with a long press.
-   * @note Long press detection should be enabled via EnableGestureDetection().
-   * @param[in]  longPress  The long press gesture.
-   * @see EnableGestureDetection
-   */
-  virtual void OnLongPress( const LongPressGesture& longPress );
-
-  /**
    * @brief Called whenever the control is added to the stage.
    *
    * Could be overridden by derived classes.
    * @brief Called whenever the control is added to the stage.
    *
    * Could be overridden by derived classes.
@@ -503,114 +456,152 @@ private:
    */
   virtual void OnControlChildRemove( Actor& child );
 
    */
   virtual void OnControlChildRemove( Actor& child );
 
-  /**
-   * @brief Called whenever the Control's size is set.
-   *
-   * Could be overridden by derived classes.
-   *
-   * @param[in] size The new size.
-   */
-  virtual void OnControlSizeSet( const Vector3& size );
+  // Styling
 
   /**
 
   /**
-   * @brief Called when the control gains key input focus.
+   * @brief This method should be overridden by deriving classes requiring notifications when the style changes.
    *
    *
-   * Should be overridden by derived classes if they need to customize what happens when focus is gained.
+   * @param[in] styleManager  The StyleManager object.
+   * @param[in] change  Information denoting what has changed.
    */
    */
-  virtual void OnKeyInputFocusGained();
+  virtual void OnStyleChange( Toolkit::StyleManager styleManager, StyleChange::Type change );
+
+  // Size negotiation
 
   /**
 
   /**
-   * @brief Called when the control loses key input focus.
+   * @brief Called whenever the Control's size is set.
    *
    *
-   * Should be overridden by derived classes if they need to customize what happens when focus is lost.
+   * @param[in] size The new size.
    */
    */
-  virtual void OnKeyInputFocusLost();
-
-  // From CustomActorImpl, derived classes can override these.
+  virtual void OnControlSizeSet( const Vector3& size );
 
 
-  /**
-   * @copydoc Dali::CustomActorImpl::OnSizeAnimation(Animation&, const Vector3&)
-   */
-  virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize);
+  // Accessibility
 
   /**
 
   /**
-   * @copydoc Dali::CustomActorImpl::OnTouchEvent(const TouchEvent&)
+   * @brief This method is called when the control is accessibility activated.
+   *
+   * Derived classes should override this to perform custom accessibility activation.
    */
    */
-  virtual bool OnTouchEvent(const TouchEvent& event);
+  virtual void OnAccessibilityActivated();
 
   /**
 
   /**
-   * @copydoc Dali::CustomActorImpl::OnHoverEvent(const HoverEvent&)
+   * @brief This method should be overridden by deriving classes when they wish to respond the accessibility
+   * pan gesture.
+   *
+   * @param[in] gesture The pan gesture.
+   * @return true if the pan gesture has been consumed by this control
    */
    */
-  virtual bool OnHoverEvent(const HoverEvent& event);
+  virtual bool OnAccessibilityPan(PanGesture gesture);
 
   /**
 
   /**
-   * @copydoc Dali::CustomActorImpl::OnKeyEvent(const KeyEvent&)
+   * @brief This method should be overridden by deriving classes when they wish to respond the accessibility
+   * touch event.
+   *
+   * @param[in] touchEvent The touch event.
+   * @return true if the touch event has been consumed by this control
    */
    */
-  virtual bool OnKeyEvent(const KeyEvent& event);
+  virtual bool OnAccessibilityTouch(const TouchEvent& touchEvent);
 
   /**
 
   /**
-   * @copydoc Dali::CustomActorImpl::OnMouseWheelEvent(const MouseWheelEvent&)
+   * @brief This method should be overridden by deriving classes when they wish to respond
+   * the accessibility up and down action (i.e. value change of slider control).
+   *
+   * @param[in] isIncrease Whether the value should be increased or decreased
+   * @return true if the value changed action has been consumed by this control
    */
    */
-  virtual bool OnMouseWheelEvent(const MouseWheelEvent& event);
+  virtual bool OnAccessibilityValueChange(bool isIncrease);
 
 
-  /**
-   * @copydoc Dali::CustomActorImpl::OnCalculateRelayoutSize()
-   */
-  virtual void OnCalculateRelayoutSize( Dimension::Type dimension );
+  // Keyboard focus
 
   /**
 
   /**
-   * @copydoc Dali::CustomActorImpl::OnLayoutNegotiated()
+   * @brief Called when the control gains key input focus.
+   *
+   * Should be overridden by derived classes if they need to customize what happens when focus is gained.
    */
    */
-  virtual void OnLayoutNegotiated( float size, Dimension::Type dimension );
+  virtual void OnKeyInputFocusGained();
 
   /**
 
   /**
-   * @copydoc Dali::CustomActorImpl::OnRelayout()
+   * @brief Called when the control loses key input focus.
+   *
+   * Should be overridden by derived classes if they need to customize what happens when focus is lost.
    */
    */
-  virtual void OnRelayout( const Vector2& size, RelayoutContainer& container );
+  virtual void OnKeyInputFocusLost();
 
   /**
 
   /**
-   * @copydoc Dali::CustomActorImpl::OnSetResizePolicy()
+   * @brief Gets the next keyboard focusable actor in this control towards the given direction.
+   *
+   * A control needs to override this function in order to support two dimensional keyboard navigation.
+   * @param[in] currentFocusedActor The current focused actor.
+   * @param[in] direction The direction to move the focus towards.
+   * @param[in] loopEnabled Whether the focus movement should be looped within the control.
+   * @return the next keyboard focusable actor in this control or an empty handle if no actor can be focused.
    */
    */
-  virtual void OnSetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension );
+  virtual Actor GetNextKeyboardFocusableActor(Actor currentFocusedActor, Toolkit::Control::KeyboardFocusNavigationDirection direction, bool loopEnabled);
 
   /**
 
   /**
-   * @copydoc Dali::CustomActorImpl::CalculateChildSize()
+   * @brief Informs this control that its chosen focusable actor will be focused.
+   *
+   * This allows the application to preform any actions if wishes
+   * before the focus is actually moved to the chosen actor.
+   *
+   * @param[in] commitedFocusableActor The commited focusable actor.
    */
    */
-  virtual float CalculateChildSize( const Dali::Actor& child, Dimension::Type dimension );
+  virtual void OnKeyboardFocusChangeCommitted(Actor commitedFocusableActor);
 
 
-  // From CustomActorImpl, derived classes should NOT override these.
+  // Gestures
 
   /**
 
   /**
-   * @brief Sends a request to relayout this control.
-   *
-   * The control will be relaid out after the
-   * Dali::Stage::SignalMessageQueueFlushed() signal is emitted.
+   * @brief Called whenever a pinch gesture is detected on this control.
    *
    *
-   * It calls OnControlStageConnection() to notify derived classes.
+   * This can be overridden by deriving classes when pinch detection
+   * is enabled.  The default behaviour is to scale the control by the
+   * pinch scale.
    *
    *
-   * @see Dali::CustomActorImpl::OnStageConnection()
-   */
-  virtual void OnStageConnection();
-
-  /**
-   * @copydoc Dali::CustomActorImpl::OnStageDisconnection()
+   * @note If overridden, then the default behaviour will not occur.
+   * @note Pinch detection should be enabled via EnableGestureDetection().
+   * @param[in]  pinch  The pinch gesture.
+   * @see EnableGestureDetection
    */
    */
-  virtual void OnStageDisconnection();
+  virtual void OnPinch(const PinchGesture& pinch);
 
   /**
 
   /**
-   * @copydoc Dali::CustomActorImpl::OnChildAdd(Actor&)
+   * @brief Called whenever a pan gesture is detected on this control.
+   *
+   * This should be overridden by deriving classes when pan detection
+   * is enabled.
+   *
+   * @note There is no default behaviour with panning.
+   * @note Pan detection should be enabled via EnableGestureDetection().
+   * @param[in]  pan  The pan gesture.
+   * @see EnableGestureDetection
    */
    */
-  virtual void OnChildAdd(Actor& child);
+  virtual void OnPan( const PanGesture& pan );
 
   /**
 
   /**
-   * @copydoc Dali::CustomActorImpl::OnChildRemove(Actor&)
+   * @brief Called whenever a tap gesture is detected on this control.
+   *
+   * This should be overridden by deriving classes when tap detection
+   * is enabled.
+   *
+   * @note There is no default behaviour with a tap.
+   * @note Tap detection should be enabled via EnableGestureDetection().
+   * @param[in]  tap  The tap gesture.
+   * @see EnableGestureDetection
    */
    */
-  virtual void OnChildRemove(Actor& child);
+  virtual void OnTap( const TapGesture& tap );
 
   /**
 
   /**
-   * @copydoc Dali::CustomActorImpl::OnSizeSet(const Vector3&)
+   * @brief Called whenever a long press gesture is detected on this control.
+   *
+   * This should be overridden by deriving classes when long press
+   * detection is enabled.
+   *
+   * @note There is no default behaviour associated with a long press.
+   * @note Long press detection should be enabled via EnableGestureDetection().
+   * @param[in]  longPress  The long press gesture.
+   * @see EnableGestureDetection
    */
    */
-  virtual void OnSizeSet(const Vector3& targetSize);
+  virtual void OnLongPress( const LongPressGesture& longPress );
 
   // From ConnectionTrackerInterface
 
 
   // From ConnectionTrackerInterface
 
@@ -629,7 +620,7 @@ private:
    *
    * @return The extension if available, NULL otherwise
    */
    *
    * @return The extension if available, NULL otherwise
    */
-  virtual Extension* GetExtension()
+  virtual Extension* GetControlExtension()
   {
     return NULL;
   }
   {
     return NULL;
   }
@@ -643,9 +634,26 @@ private:
   class Impl;
   Impl* mImpl;
 
   class Impl;
   Impl* mImpl;
 
-  friend class Internal::KeyInputFocusManager;     ///< KeyInputFocusManager needs to call several methods which are private. // TODO: Remove
 };
 
 };
 
+/**
+ * @brief Get implementation from the handle
+ *
+ * @pre handle is initialized and points to a control
+ * @param handle
+ * @return implementation
+ */
+Internal::Control& GetImplementation( Dali::Toolkit::Control& handle );
+
+/**
+ * @brief Get implementation from the handle
+ *
+ * @pre handle is initialized and points to a control
+ * @param handle
+ * @return implementation
+ */
+const Internal::Control& GetImplementation( const Dali::Toolkit::Control& handle );
+
 } // namespace Internal
 
 } // namespace Toolkit
 } // namespace Internal
 
 } // namespace Toolkit
index 5bbc4e7..18eaeeb 100644 (file)
@@ -36,8 +36,8 @@ Control::Control()
 {
 }
 
 {
 }
 
-Control::Control(const Control& uiControl)
-: CustomActor( uiControl ? static_cast< const Internal::Control& >( uiControl.GetImplementation() ).GetOwner() : NULL)
+Control::Control( const Control& uiControl )
+: CustomActor( uiControl  )
 {
 }
 
 {
 }
 
@@ -59,99 +59,84 @@ Control Control::DownCast( BaseHandle handle )
   return DownCast< Control, Internal::Control >(handle);
 }
 
   return DownCast< Control, Internal::Control >(handle);
 }
 
-Internal::Control& Control::GetImplementation()
-{
-  return static_cast<Internal::Control&>(CustomActor::GetImplementation());
-}
-
-const Internal::Control& Control::GetImplementation() const
-{
-  return static_cast<const Internal::Control&>(CustomActor::GetImplementation());
-}
-
 void Control::SetKeyInputFocus()
 {
 void Control::SetKeyInputFocus()
 {
-  GetImplementation().SetKeyInputFocus();
+  Internal::GetImplementation(*this).SetKeyInputFocus();
 }
 
 bool Control::HasKeyInputFocus()
 {
 }
 
 bool Control::HasKeyInputFocus()
 {
-  return GetImplementation().HasKeyInputFocus();
+  return Internal::GetImplementation(*this).HasKeyInputFocus();
 }
 
 void Control::ClearKeyInputFocus()
 {
 }
 
 void Control::ClearKeyInputFocus()
 {
-  GetImplementation().ClearKeyInputFocus();
+  Internal::GetImplementation(*this).ClearKeyInputFocus();
 }
 
 PinchGestureDetector Control::GetPinchGestureDetector() const
 {
 }
 
 PinchGestureDetector Control::GetPinchGestureDetector() const
 {
-  return GetImplementation().GetPinchGestureDetector();
+  return Internal::GetImplementation(*this).GetPinchGestureDetector();
 }
 
 PanGestureDetector Control::GetPanGestureDetector() const
 {
 }
 
 PanGestureDetector Control::GetPanGestureDetector() const
 {
-  return GetImplementation().GetPanGestureDetector();
+  return Internal::GetImplementation(*this).GetPanGestureDetector();
 }
 
 TapGestureDetector Control::GetTapGestureDetector() const
 {
 }
 
 TapGestureDetector Control::GetTapGestureDetector() const
 {
-  return GetImplementation().GetTapGestureDetector();
+  return Internal::GetImplementation(*this).GetTapGestureDetector();
 }
 
 LongPressGestureDetector Control::GetLongPressGestureDetector() const
 {
 }
 
 LongPressGestureDetector Control::GetLongPressGestureDetector() const
 {
-  return GetImplementation().GetLongPressGestureDetector();
+  return Internal::GetImplementation(*this).GetLongPressGestureDetector();
 }
 
 void Control::SetStyleName( const std::string& styleName )
 {
 }
 
 void Control::SetStyleName( const std::string& styleName )
 {
-  GetImplementation().SetStyleName( styleName );
+  Internal::GetImplementation(*this).SetStyleName( styleName );
 }
 
 const std::string& Control::GetStyleName() const
 {
 }
 
 const std::string& Control::GetStyleName() const
 {
-  return GetImplementation().GetStyleName();
+  return Internal::GetImplementation(*this).GetStyleName();
 }
 
 void Control::SetBackgroundColor( const Vector4& color )
 {
 }
 
 void Control::SetBackgroundColor( const Vector4& color )
 {
-  GetImplementation().SetBackgroundColor( color );
+  Internal::GetImplementation(*this).SetBackgroundColor( color );
 }
 
 Vector4 Control::GetBackgroundColor() const
 {
 }
 
 Vector4 Control::GetBackgroundColor() const
 {
-  return GetImplementation().GetBackgroundColor();
+  return Internal::GetImplementation(*this).GetBackgroundColor();
 }
 
 void Control::SetBackgroundImage( Image image )
 {
 }
 
 void Control::SetBackgroundImage( Image image )
 {
-  GetImplementation().SetBackgroundImage( image );
+  Internal::GetImplementation(*this).SetBackgroundImage( image );
 }
 
 void Control::ClearBackground()
 {
 }
 
 void Control::ClearBackground()
 {
-  GetImplementation().ClearBackground();
-}
-
-Actor Control::GetBackgroundActor() const
-{
-  return GetImplementation().GetBackgroundActor();
+  Internal::GetImplementation(*this).ClearBackground();
 }
 
 Control::KeyEventSignalType& Control::KeyEventSignal()
 {
 }
 
 Control::KeyEventSignalType& Control::KeyEventSignal()
 {
-  return GetImplementation().KeyEventSignal();
+  return Internal::GetImplementation(*this).KeyEventSignal();
 }
 
 Control::KeyInputFocusSignalType& Control::KeyInputFocusGainedSignal()
 {
 }
 
 Control::KeyInputFocusSignalType& Control::KeyInputFocusGainedSignal()
 {
-  return GetImplementation().KeyInputFocusGainedSignal();
+  return Internal::GetImplementation(*this).KeyInputFocusGainedSignal();
 }
 
 Control::KeyInputFocusSignalType& Control::KeyInputFocusLostSignal()
 {
 }
 
 Control::KeyInputFocusSignalType& Control::KeyInputFocusLostSignal()
 {
-  return GetImplementation().KeyInputFocusLostSignal();
+  return Internal::GetImplementation(*this).KeyInputFocusLostSignal();
 }
 
 Control::Control(Internal::Control& implementation)
 }
 
 Control::Control(Internal::Control& implementation)
index 7e4e693..7742bb7 100644 (file)
@@ -166,20 +166,6 @@ public:
    */
   static Control DownCast( BaseHandle handle );
 
    */
   static Control DownCast( BaseHandle handle );
 
-  /**
-   * @brief Retrieve the Control implementation.
-   *
-   * @return The implementation.
-   */
-  Internal::Control& GetImplementation();
-
-  /**
-   * @brief Retrieve the Control implementation.
-   *
-   * @return The implementation.
-   */
-  const Internal::Control& GetImplementation() const;
-
   // Key Input
 
   /**
   // Key Input
 
   /**
@@ -248,7 +234,7 @@ public:
    */
   LongPressGestureDetector GetLongPressGestureDetector() const;
 
    */
   LongPressGestureDetector GetLongPressGestureDetector() const;
 
-  // Background
+  // Styling
 
   /**
    * @brief Sets the name of the style to be applied to the control.
 
   /**
    * @brief Sets the name of the style to be applied to the control.
@@ -296,13 +282,6 @@ public:
    */
   void ClearBackground();
 
    */
   void ClearBackground();
 
-  /**
-   * @brief Retrieves the actor used as the background for this control.
-   *
-   * @return The actor that used as the background for this control.
-   */
-  Actor GetBackgroundActor() const;
-
   // Signals
 
   /**
   // Signals
 
   /**