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