Rendering API clean-up
[platform/core/uifw/dali-toolkit.git] / plugins / dali-script-v8 / src / actors / actor-api.cpp
index 1ae60ec..9459a46 100644 (file)
@@ -36,21 +36,14 @@ namespace V8Plugin
 
 namespace  // unanmed namespace
 {
+
 Actor GetActor( v8::Isolate* isolate, const v8::FunctionCallbackInfo<v8::Value>& args )
 {
   HandleWrapper* handleWrapper = HandleWrapper::Unwrap( isolate, args.This() );
   return Actor::DownCast( handleWrapper->mHandle );
 }
-} //unanmed namespace
-
 
-namespace TextLabelApi
-{
- Actor New( const v8::FunctionCallbackInfo< v8::Value >& args )
- {
-   return Dali::Toolkit::TextLabel::New();
- }
-}
+} //unanmed namespace
 
 /***************************************
  * ACTOR API FUNCTIONS
@@ -279,7 +272,7 @@ void ActorApi::GetChildCount( const v8::FunctionCallbackInfo<v8::Value>& args )
 }
 
 /**
- * Retrieve and child actor by index.
+ * Retrieve a child actor by index.
  *
  * @for Actor
  * @method getChildAt
@@ -488,7 +481,7 @@ void ActorApi::IsKeyboardFocusable( const v8::FunctionCallbackInfo<v8::Value>& a
  *
  * @for Actor
  * @method getActorType
- * @return {String} Actor, ImageActor, MeshActor, Layer, CameraActor ...
+ * @return {String} Actor, Layer, CameraActor ...
  */
 void ActorApi::GetActorType( const v8::FunctionCallbackInfo<v8::Value>& args )
 {
@@ -525,6 +518,31 @@ void ActorApi::GetNaturalSize( const v8::FunctionCallbackInfo<v8::Value>& args )
 }
 
 /**
+ * Return the value of negotiated dimension for the given dimension
+ *
+ * @for Actor
+ * @method getRelayoutSize
+ * @param {Integer} dimension The dimension of layout to retrieve (either dali.DIMENSION_WIDTH or dali.DIMENSION_HEIGHT)
+ * @return {Number} The value of the negotiated dimension
+ */
+void ActorApi::GetRelayoutSize( const v8::FunctionCallbackInfo<v8::Value>& args )
+{
+  v8::Isolate* isolate = args.GetIsolate();
+  v8::HandleScope handleScope( isolate );
+  Actor actor = GetActor( isolate, args );
+
+  bool found;
+  int dimension = V8Utils::GetIntegerParameter( PARAMETER_0, found, isolate, args, 0 );
+  if( !found )
+  {
+    DALI_SCRIPT_EXCEPTION( isolate, "missing dimension parameter");
+    return;
+  }
+
+  args.GetReturnValue().Set( v8::Number::New( isolate, actor.GetRelayoutSize( static_cast<Dimension::Type>(dimension) ) ) );
+}
+
+/**
  *  Calculate the width of the actor given a height
  *
  * The natural size is used for default calculation.
@@ -703,7 +721,7 @@ void ActorApi::ScaleBy( const v8::FunctionCallbackInfo<v8::Value>& args )
  * Add a renderer to this actor.
  * @example
  *
- *     var renderer = new dali.Renderer( geometry, material );
+ *     var renderer = new dali.Renderer( geometry, shader );
  *     actor.addRenderer( renderer );
  *
  * @for Actor