1 #ifndef __DALI_V8PLUGIN_ACTOR_WRAPPER_H__
2 #define __DALI_V8PLUGIN_ACTOR_WRAPPER_H__
5 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
23 #include <dali/public-api/actors/actor.h>
26 #include <object/handle-wrapper.h>
38 class ActorWrapper : public HandleWrapper
44 * Actor type used an index
61 * @param actor DALi actor
62 * @param gc garbage collection interface
64 ActorWrapper( Actor actor,
65 GarbageCollectorInterface& gc );
70 virtual ~ActorWrapper()
75 * @brief Creates a new Actor wrapped inside a Javascript Object.
76 * @note: the actor type ie 'ImageActor' is expected to be the name of the callee function.
77 * @param[in] args v8 function call arguments interpreted
79 static void NewActor( const v8::FunctionCallbackInfo< v8::Value >& args);
82 * @brief Wraps an actor of a given type
84 static v8::Handle<v8::Object> WrapActor(v8::Isolate* isolate, Dali::Actor actor,ActorType actorType);
87 * @brief Wraps an actor, the type is looked up from the actor
89 static v8::Handle<v8::Object> WrapActor(v8::Isolate* isolate, Dali::Actor actor );
91 // The Actor ObjectTemplates.
92 static v8::Persistent<v8::ObjectTemplate> mActorTemplate;
93 static v8::Persistent<v8::ObjectTemplate> mImageActorTemplate;
94 static v8::Persistent<v8::ObjectTemplate> mTextActorTemplate;
95 static v8::Persistent<v8::ObjectTemplate> mMeshActorTemplate;
96 static v8::Persistent<v8::ObjectTemplate> mCameraActorTemplate;
97 static v8::Persistent<v8::ObjectTemplate> mLayerActorTemplate;
98 static v8::Persistent<v8::ObjectTemplate> mTextViewTemplate;
101 * @return the wrapped actor
106 * @return they actor type
108 static ActorWrapper::ActorType GetActorType( const std::string& name );
113 * Helper to make the actor template
116 static v8::Handle<v8::ObjectTemplate> MakeDaliActorTemplate( v8::Isolate* isolate, ActorType actorType );
119 * Helper, get an actor template given an actor type
121 static v8::Local<v8::ObjectTemplate> GetActorTemplate( v8::Isolate* isolate, ActorType type );
127 } // namespace V8Plugin