Updates after changes to Property::Map
[platform/core/uifw/dali-toolkit.git] / base / dali-toolkit / internal / builder / builder-impl.cpp
index 6deedb5..ab62c75 100644 (file)
@@ -20,6 +20,7 @@
 
 // EXTERNAL INCLUDES
 #include <sys/stat.h>
+#include <boost/function.hpp>
 #include <sstream>
 
 // INTERNAL INCLUDES
@@ -49,8 +50,8 @@ extern bool SetPropertyFromNode( const TreeNode& node, Property::Value& value );
 extern bool SetPropertyFromNode( const TreeNode& node, Property::Value& value, const Replacement& replacements );
 extern bool SetPropertyFromNode( const TreeNode& node, Property::Type type, Property::Value& value );
 extern bool SetPropertyFromNode( const TreeNode& node, Property::Type type, Property::Value& value, const Replacement& replacements );
-extern Actor SetupSignalAction(ConnectionTracker* tracker, const TreeNode &root, const TreeNode &child, Actor actor);
-extern Actor SetupPropertyNotification(ConnectionTracker* tracker, const TreeNode &root, const TreeNode &child, Actor actor);
+extern Actor SetupSignalAction(ConnectionTracker* tracker, const TreeNode &root, const TreeNode &child, Actor actor, boost::function<void (void)> quitAction);
+extern Actor SetupPropertyNotification(ConnectionTracker* tracker, const TreeNode &root, const TreeNode &child, Actor actor, boost::function<void (void)> quitAction);
 extern Actor SetupActor( const TreeNode& node, Actor& actor, const Replacement& constant );
 
 #if defined(DEBUG_ENABLED)
@@ -86,6 +87,7 @@ std::string ToString(const Rect<int>& value)
   return ss.str();
 }
 
+#if defined(DEBUG_ENABLED)
 
 std::string PropertyValueToString( const Property::Value& value )
 {
@@ -165,7 +167,7 @@ std::string PropertyValueToString( const Property::Value& value )
     }
     case Property::MAP:
     {
-      ret = std::string("Map Size=") + ToString( value.Get<Property::Map>().size() );
+      ret = std::string("Map Size=") + ToString( value.Get<Property::Map>().Count() );
       break;
     }
     case Property::TYPE_COUNT:
@@ -177,6 +179,7 @@ std::string PropertyValueToString( const Property::Value& value )
 
   return ret;
 }
+#endif // DEBUG_ENABLED
 
 /*
  * Recursively collects all stylesin a node (An array of style names).
@@ -208,6 +211,23 @@ void CollectAllStyles( const TreeNode& stylesCollection, const TreeNode& style,
   }
 }
 
+struct QuitAction
+{
+public:
+  QuitAction( Builder& builder )
+  : mBuilder( builder )
+  {
+  }
+
+  void operator()(void)
+  {
+    mBuilder.EmitQuitSignal();
+  }
+
+private:
+  Builder& mBuilder;
+};
+
 } // namespace anon
 
 /*
@@ -335,9 +355,9 @@ void Builder::ApplyProperties( const TreeNode& root, const TreeNode& node,
       SetupActor( node, actor, constant );
 
       // add signals
-      SetupSignalAction( mSlotDelegate.GetConnectionTracker(), root, node, actor );
-
-      SetupPropertyNotification( mSlotDelegate.GetConnectionTracker(), root, node, actor );
+      QuitAction quitAction( *this );
+      SetupSignalAction( mSlotDelegate.GetConnectionTracker(), root, node, actor, quitAction );
+      SetupPropertyNotification( mSlotDelegate.GetConnectionTracker(), root, node, actor, quitAction );
    }
   }
   else
@@ -507,9 +527,7 @@ BaseHandle Builder::DoCreate( const TreeNode& root, const TreeNode& node,
         }
       }
 
-      ApplyProperties( root, node, handle, replacements );
-
-      if( actor)
+      if( actor )
       {
         // add children of all the styles
         if( OptionalChild actors = IsChild( node, KEYNAME_ACTORS ) )
@@ -529,7 +547,10 @@ BaseHandle Builder::DoCreate( const TreeNode& root, const TreeNode& node,
           parent.Add( actor );
         }
       }
-
+      else
+      {
+        ApplyProperties( root, node, handle, replacements );
+      }
     }
     else
     {
@@ -725,6 +746,16 @@ FrameBufferImage Builder::GetFrameBufferImage( const std::string &name, const Re
   return ret;
 }
 
+Toolkit::Builder::Signal& Builder::QuitSignal()
+{
+  return mQuitSignal;
+}
+
+void Builder::EmitQuitSignal()
+{
+  mQuitSignal.Emit();
+}
+
 void Builder::AddActors( Actor toActor )
 {
   // 'stage' is the default/by convention section to add from
@@ -981,7 +1012,6 @@ bool Builder::ApplyStyle( const std::string& styleName, Handle& handle, const Re
   }
   else
   {
-    DALI_SCRIPT_WARNING("No styles section to create style '%s'\n", styleName.c_str());
     return false;
   }
 }