X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Fpublic-api%2Fcontrols%2Fcontrol-impl.cpp;h=a3460055754e29587ac35cec77c4c23932bd3226;hp=bbc98b46ea88ef5682899ebf70826875ea0256a8;hb=038597cefeb2d2d3632f8940af450ef44c0c32dc;hpb=d9c164e4530e354cd14dc4a1a658070ba55e99b8 diff --git a/dali-toolkit/public-api/controls/control-impl.cpp b/dali-toolkit/public-api/controls/control-impl.cpp index bbc98b4..a346005 100644 --- a/dali-toolkit/public-api/controls/control-impl.cpp +++ b/dali-toolkit/public-api/controls/control-impl.cpp @@ -64,12 +64,12 @@ BaseHandle Create() * @param[in] attributes The attributes with which to perfrom this action. * @return true if action has been accepted by this control */ -const char* ACTION_CONTROL_ACTIVATED = "control-activated"; +const char* ACTION_ACCESSIBILITY_ACTIVATED = "accessibility-activated"; static bool DoAction( BaseObject* object, const std::string& actionName, const Property::Map& attributes ) { bool ret = false; - if( object && ( 0 == strcmp( actionName.c_str(), ACTION_CONTROL_ACTIVATED ) ) ) + if( object && ( 0 == strcmp( actionName.c_str(), ACTION_ACCESSIBILITY_ACTIVATED ) ) ) { Toolkit::Control control = Toolkit::Control::DownCast( BaseHandle( object ) ); if( control ) @@ -158,7 +158,7 @@ SignalConnectorType registerSignal5( typeRegistration, SIGNAL_PANNED, &DoConnect SignalConnectorType registerSignal6( typeRegistration, SIGNAL_PINCHED, &DoConnectSignal ); SignalConnectorType registerSignal7( typeRegistration, SIGNAL_LONG_PRESSED, &DoConnectSignal ); -TypeAction registerAction( typeRegistration, ACTION_CONTROL_ACTIVATED, &DoAction ); +TypeAction registerAction( typeRegistration, ACTION_ACCESSIBILITY_ACTIVATED, &DoAction ); DALI_TYPE_REGISTRATION_END() @@ -239,7 +239,7 @@ Actor CreateBackground( Actor parent, const Vector4& color, Image image = Image( //Create the index buffer Property::Map indexFormat; - indexFormat["indices"] = Property::UNSIGNED_INTEGER; + indexFormat["indices"] = Property::INTEGER; PropertyBuffer indexBuffer = PropertyBuffer::New( indexFormat, 6u ); indexBuffer.SetData(gQuadIndex); @@ -253,7 +253,7 @@ Actor CreateBackground( Actor parent, const Vector4& color, Image image = Image( //Create the renderer Renderer renderer = Renderer::New( mesh, material ); - renderer.SetDepthIndex( BACKGROUND_DEPTH_INDEX ); + renderer.SetDepthIndex( parent.GetHierarchyDepth() + BACKGROUND_DEPTH_INDEX ); //Create the actor Actor meshActor = Actor::New(); @@ -278,6 +278,7 @@ Actor CreateBackground( Actor parent, const Vector4& color, Image image = Image( imageActor.SetPositionInheritanceMode( USE_PARENT_POSITION_PLUS_LOCAL_POSITION ); imageActor.SetColorMode( USE_OWN_MULTIPLY_PARENT_COLOR ); imageActor.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); + imageActor.SetSortModifier( parent.GetHierarchyDepth() + BACKGROUND_DEPTH_INDEX ); return imageActor; } @@ -547,9 +548,12 @@ void Control::SetStyleName( const std::string& styleName ) { mImpl->mStyleName = styleName; - // Apply new style + // Apply new style, if stylemanager is available Toolkit::StyleManager styleManager = Toolkit::StyleManager::Get(); - GetImpl( styleManager ).ApplyThemeStyle( Toolkit::Control( GetOwner() ) ); + if( styleManager ) + { + GetImpl( styleManager ).ApplyThemeStyle( Toolkit::Control( GetOwner() ) ); + } } } @@ -580,8 +584,8 @@ void Control::SetBackgroundColor( const Vector4& color ) Actor actor = CreateBackground(Self(), color ); background.actor = actor; mImpl->mAddRemoveBackgroundChild = true; - // use insert to guarantee its the first child (so that OVERLAY mode works) - Self().Insert( 0, actor ); + // The actor does not need to be inserted to guarantee order. + Self().Add( actor ); mImpl->mAddRemoveBackgroundChild = false; } @@ -615,8 +619,8 @@ void Control::SetBackgroundImage( Image image ) // Set the background actor before adding so that we do not inform derived classes background.actor = actor; mImpl->mAddRemoveBackgroundChild = true; - // use insert to guarantee its the first child (so that OVERLAY mode works) - Self().Insert( 0, actor ); + // The actor does not need to be inserted to guarantee order. + Self().Add( actor ); mImpl->mAddRemoveBackgroundChild = false; } @@ -767,11 +771,22 @@ void Control::AccessibilityActivate() OnAccessibilityActivated(); } +void Control::KeyboardEnter() +{ + // Inform deriving classes + OnKeyboardEnter(); +} + bool Control::OnAccessibilityActivated() { return false; // Accessibility activation is not handled by default } +bool Control::OnKeyboardEnter() +{ + return false; // Keyboard enter is not handled by default +} + bool Control::OnAccessibilityPan(PanGesture gesture) { return false; // Accessibility pan gesture is not handled by default @@ -853,12 +868,15 @@ void Control::Initialize() if( mImpl->mFlags & REQUIRES_STYLE_CHANGE_SIGNALS ) { Toolkit::StyleManager styleManager = Toolkit::StyleManager::Get(); + // if stylemanager is available + if( styleManager ) + { + // Register for style changes + styleManager.StyleChangeSignal().Connect( this, &Control::OnStyleChange ); - // Register for style changes - styleManager.StyleChangeSignal().Connect( this, &Control::OnStyleChange ); - - // Apply the current style - GetImpl( styleManager ).ApplyThemeStyle( Toolkit::Control( GetOwner() ) ); + // Apply the current style + GetImpl( styleManager ).ApplyThemeStyle( Toolkit::Control( GetOwner() ) ); + } } if( mImpl->mFlags & REQUIRES_KEYBOARD_NAVIGATION_SUPPORT ) @@ -882,7 +900,7 @@ void Control::OnControlChildRemove( Actor& child ) void Control::OnStyleChange( Toolkit::StyleManager styleManager, StyleChange::Type change ) { // By default the control is only interested in theme (not font) changes - if( change == StyleChange::THEME_CHANGE ) + if( styleManager && change == StyleChange::THEME_CHANGE ) { GetImpl( styleManager ).ApplyThemeStyle( Toolkit::Control( GetOwner() ) ); } @@ -938,7 +956,7 @@ void Control::EmitKeyInputFocusSignal( bool focusGained ) } } -void Control::OnStageConnection( unsigned int depth ) +void Control::OnStageConnection( int depth ) { unsigned int controlRendererCount = Self().GetRendererCount(); for( unsigned int i(0); i