END_TEST;
}
-int UtcDaliControlGetImplementation(void)
+int UtcDaliControlGetImplementationN(void)
{
ToolkitTestApplication application;
-
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);
}
tet_result(TET_PASS);
}
}
+ END_TEST;
+}
+
+int UtcDaliControlGetImplementationConstN(void)
+{
+ ToolkitTestApplication application;
+ DummyControl 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);
}
tet_result(TET_PASS);
}
}
+ END_TEST;
+}
- control = DummyControl::New();
+int UtcDaliControlGetImplementationP(void)
+{
+ ToolkitTestApplication application;
+ DummyControl control = DummyControl::New();
// 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);
}
tet_result(TET_FAIL);
}
}
+ END_TEST;
+}
+int UtcDaliControlGetImplementationConstP(void)
+{
+ ToolkitTestApplication application;
+ DummyControl control = DummyControl::New();
// 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);
}
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 );
{
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 );
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_CHECK( control.GetBackgroundActor() );
DALI_TEST_EQUALS( control.GetBackgroundColor(), Color::RED, TEST_LOCATION );
END_TEST;
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_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_CHECK( !control.GetBackgroundActor() );
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;
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_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 );
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 );
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() );
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;
+}
if(control)
{
// Notify the control that it is activated
- control.GetImplementation().Activate();
+ GetImplementation( control ).Activate();
}
// Send notification for the activation of focused actor
if(control)
{
// Notify the control that it is activated
- ret = control.GetImplementation().OnAccessibilityValueChange(true);
+ ret = GetImplementation( control ).OnAccessibilityValueChange(true);
}
}
}
if(control)
{
// Notify the control that it is activated
- ret = control.GetImplementation().OnAccessibilityValueChange(false);
+ ret = GetImplementation( control ).OnAccessibilityValueChange(false);
}
}
}
Dali::Toolkit::Control control = Dali::Toolkit::Control::DownCast(GetCurrentFocusActor());
if(control)
{
- handled = control.GetImplementation().OnAccessibilityTouch(touchEvent);
+ handled = GetImplementation( control ).OnAccessibilityTouch(touchEvent);
}
return handled;
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
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
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 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);
if(control)
{
// Notify the control that it is activated
- control.GetImplementation().Activate();
+ GetImplementation( control ).Activate();
}
// Send notification for the activation of focused actor
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.
- control.GetImplementation().OnKeyInputFocusGained();
+ GetImplementation( control ).OnKeyInputFocusGained();
// Emit the signal to inform focus change to the application.
if ( !mKeyInputFocusChangedSignal.Empty() )
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( previouslyFocusedControl )
{
// Tell the control that it has gained focus.
- previouslyFocusedControl.GetImplementation().OnKeyInputFocusGained();
+ GetImplementation( previouslyFocusedControl ).OnKeyInputFocusGained();
}
}
else
if( control )
{
// Notify the control about the key event
- consumed = control.GetImplementation().EmitKeyEventSignal( event );
+ consumed = GetImplementation( control ).EmitKeyEventSignal( event );
}
}
}
mLongPressGestureDetector(),
mFlags( Control::ControlBehaviour( ACTOR_BEHAVIOUR_NONE ) ),
mIsKeyboardNavigationSupported( false ),
- mIsKeyboardFocusGroup( false ),
- mInitialized( false )
+ mIsKeyboardFocusGroup( false )
{
}
if ( control )
{
- Control& controlImpl( control.GetImplementation() );
+ Control& controlImpl( GetImplementation( control ) );
switch ( index )
{
if ( control )
{
- Control& controlImpl( control.GetImplementation() );
+ Control& controlImpl( GetImplementation( control ) );
switch ( index )
{
{
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();
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;
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() )
}
}
-Actor Control::GetBackgroundActor() const
-{
- if ( mImpl->mBackground )
- {
- return mImpl->mBackground->actor;
- }
-
- return Actor();
-}
-
void Control::SetKeyboardNavigationSupport(bool isSupported)
{
mImpl->mIsKeyboardNavigationSupported = isSupported;
void Control::Activate()
{
// Inform deriving classes
- OnActivated();
+ OnAccessibilityActivated();
+}
+
+void Control::OnAccessibilityActivated()
+{
}
bool Control::OnAccessibilityPan(PanGesture gesture)
if( control )
{
// if cast succeeds there is an implementation so no need to check
- control.GetImplementation().OnActivated();
+ GetImplementation( control ).OnAccessibilityActivated();
}
}
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 ) )
void Control::Initialize()
{
- // Calling deriving classes
- OnInitialize();
-
if( mImpl->mFlags & REQUIRES_STYLE_CHANGE_SIGNALS )
{
Toolkit::StyleManager styleManager = Toolkit::StyleManager::Get();
SetKeyboardNavigationSupport( true );
}
- mImpl->mInitialized = true;
+ // Calling deriving classes
+ OnInitialize();
}
void Control::EnableGestureDetection(Gesture::Type type)
{
}
-void Control::OnActivated()
+void Control::OnControlStageConnection()
+{
+}
+
+void Control::OnControlStageDisconnection()
+{
+}
+
+void Control::OnControlChildAdd( Actor& child )
+{
+}
+
+void Control::OnControlChildRemove( Actor& child )
{
}
{
}
-void Control::OnControlStageConnection()
-{
-}
-
-void Control::OnControlStageDisconnection()
-{
-}
-
-void Control::OnControlChildAdd( Actor& child )
-{
-}
-
-void Control::OnControlChildRemove( Actor& child )
-{
-}
-
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() );
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)
{
- // @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)
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 )
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 Toolkit
{
-
class StyleManager;
-namespace Internal DALI_INTERNAL
-{
-class KeyInputFocusManager;
-}
-
namespace Internal
{
+class FocusManager;
+class KeyboardFocusManager;
+class KeyInputFocusManager;
/**
* @brief This is the internal base class for all controls.
*/
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
/**
*/
LongPressGestureDetector GetLongPressGestureDetector() const;
- // Background
+ // Styling
/**
* @copydoc Dali::Toolkit::Control::SetStyleName
*/
const std::string& GetStyleName() const;
+ // Background
+
/**
* @copydoc Dali::Toolkit::Control::SetBackgroundColor
*/
*/
void ClearBackground();
- /**
- * @copydoc Dali::Toolkit::Control::GetBackgroundActor
- */
- Actor GetBackgroundActor() const;
-
// Keyboard Navigation
/**
*/
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
/**
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.
*/
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
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
*/
- Control(ControlBehaviour behaviourFlags);
+ Control( ControlBehaviour behaviourFlags );
/**
* @brief Second phase initialization.
* @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.
* @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.
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.
*/
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
*
* @return The extension if available, NULL otherwise
*/
- virtual Extension* GetExtension()
+ virtual Extension* GetControlExtension()
{
return NULL;
}
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
{
}
-Control::Control(const Control& uiControl)
-: CustomActor( uiControl ? static_cast< const Internal::Control& >( uiControl.GetImplementation() ).GetOwner() : NULL)
+Control::Control( const Control& uiControl )
+: CustomActor( uiControl )
{
}
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()
{
- GetImplementation().SetKeyInputFocus();
+ Internal::GetImplementation(*this).SetKeyInputFocus();
}
bool Control::HasKeyInputFocus()
{
- return GetImplementation().HasKeyInputFocus();
+ return Internal::GetImplementation(*this).HasKeyInputFocus();
}
void Control::ClearKeyInputFocus()
{
- GetImplementation().ClearKeyInputFocus();
+ Internal::GetImplementation(*this).ClearKeyInputFocus();
}
PinchGestureDetector Control::GetPinchGestureDetector() const
{
- return GetImplementation().GetPinchGestureDetector();
+ return Internal::GetImplementation(*this).GetPinchGestureDetector();
}
PanGestureDetector Control::GetPanGestureDetector() const
{
- return GetImplementation().GetPanGestureDetector();
+ return Internal::GetImplementation(*this).GetPanGestureDetector();
}
TapGestureDetector Control::GetTapGestureDetector() const
{
- return GetImplementation().GetTapGestureDetector();
+ return Internal::GetImplementation(*this).GetTapGestureDetector();
}
LongPressGestureDetector Control::GetLongPressGestureDetector() const
{
- return GetImplementation().GetLongPressGestureDetector();
+ return Internal::GetImplementation(*this).GetLongPressGestureDetector();
}
void Control::SetStyleName( const std::string& styleName )
{
- GetImplementation().SetStyleName( styleName );
+ Internal::GetImplementation(*this).SetStyleName( styleName );
}
const std::string& Control::GetStyleName() const
{
- return GetImplementation().GetStyleName();
+ return Internal::GetImplementation(*this).GetStyleName();
}
void Control::SetBackgroundColor( const Vector4& color )
{
- GetImplementation().SetBackgroundColor( color );
+ Internal::GetImplementation(*this).SetBackgroundColor( color );
}
Vector4 Control::GetBackgroundColor() const
{
- return GetImplementation().GetBackgroundColor();
+ return Internal::GetImplementation(*this).GetBackgroundColor();
}
void Control::SetBackgroundImage( Image image )
{
- GetImplementation().SetBackgroundImage( image );
+ Internal::GetImplementation(*this).SetBackgroundImage( image );
}
void Control::ClearBackground()
{
- GetImplementation().ClearBackground();
-}
-
-Actor Control::GetBackgroundActor() const
-{
- return GetImplementation().GetBackgroundActor();
+ Internal::GetImplementation(*this).ClearBackground();
}
Control::KeyEventSignalType& Control::KeyEventSignal()
{
- return GetImplementation().KeyEventSignal();
+ return Internal::GetImplementation(*this).KeyEventSignal();
}
Control::KeyInputFocusSignalType& Control::KeyInputFocusGainedSignal()
{
- return GetImplementation().KeyInputFocusGainedSignal();
+ return Internal::GetImplementation(*this).KeyInputFocusGainedSignal();
}
Control::KeyInputFocusSignalType& Control::KeyInputFocusLostSignal()
{
- return GetImplementation().KeyInputFocusLostSignal();
+ return Internal::GetImplementation(*this).KeyInputFocusLostSignal();
}
Control::Control(Internal::Control& implementation)
*/
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
/**
*/
LongPressGestureDetector GetLongPressGestureDetector() const;
- // Background
+ // Styling
/**
* @brief Sets the name of the style to be applied to the control.
*/
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
/**