Merge "Removed feedback controller Boost dependency" into devel/master
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / public-api / controls / control-impl.cpp
index 271a5ce..c0780c4 100644 (file)
@@ -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,7 +584,7 @@ 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)
+    // use insert to guarantee its the first child (so that OVERLAY_2D mode works)
     Self().Insert( 0, actor );
     mImpl->mAddRemoveBackgroundChild = false;
   }
@@ -615,7 +619,7 @@ 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)
+   // use insert to guarantee its the first child (so that OVERLAY_2D mode works)
    Self().Insert( 0, actor );
    mImpl->mAddRemoveBackgroundChild = false;
 }
@@ -864,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 ).ApplyThemeStyleAtInit( Toolkit::Control( GetOwner() ) );
+    }
   }
 
   if( mImpl->mFlags & REQUIRES_KEYBOARD_NAVIGATION_SUPPORT )
@@ -893,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() ) );
   }
@@ -949,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<controlRendererCount; ++i )