1 #ifndef __DALI_V8PLUGIN_HANDLE_WRAPPER_H__
2 #define __DALI_V8PLUGIN_HANDLE_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/object/handle.h>
26 #include <shared/base-wrapped-object.h>
27 #include <signals/signal-manager.h>
37 class HandleWrapper : public BaseWrappedObject
40 HandleWrapper( BaseWrappedObject::Type type,
42 GarbageCollectorInterface& gc );
44 virtual ~HandleWrapper();
47 * @brief get the value for a property for JavaScript object than contains a Dali Handle.
48 * E.g. Get( "x", JavaScript object that wraps a Dali Handle )
49 * @param[in] propertyName property name
50 * @param[in] info reference to PropertyCallbackInfo structure (contains the Javascript
51 * object and the return value).
53 static void PropertyGet( v8::Local<v8::String> propertyName,
54 const v8::PropertyCallbackInfo<v8::Value>& info);
57 * @brief Set the value for a property for JavaScript object than contains a Dali Handle.
58 * E.g. Set( "x", 103, JavaScript object that wraps a Dali Handle)
59 * @param[in] propertyName property name
60 * @param[in] javaScriptValue javascript value to set, this is typically a number
61 * @param[in] info reference to PropertyCallbackInfo structure (contains the Javascript
64 static void PropertySet( v8::Local<v8::String> propertyName,
65 v8::Local<v8::Value> javaScriptValue,
66 const v8::PropertyCallbackInfo<v8::Value>& info);
68 static HandleWrapper* Unwrap( v8::Isolate* isolate, v8::Handle< v8::Object> obj);
71 * Should be called by an class that inherits from HandleWrapper to add
72 * property get / set functionality to the javascript object
73 * along with Signal connect / disconnect
75 static void AddInterceptsToTemplate( v8::Isolate* isolate, v8::Local<v8::ObjectTemplate>& objTemplate );
78 * @brief Register an animatable property for a JavaScript object that
79 * contains a Dali Handle.
80 * @param[in] args v8 function call arguments interpreted
82 static void RegisterAnimatableProperty( const v8::FunctionCallbackInfo< v8::Value >& args );
85 * @brief Register a custom property for a JavaScript object that
86 * contains a Dali Handle.
87 * @param[in] args v8 function call arguments interpreted
89 static void RegisterCustomProperty( const v8::FunctionCallbackInfo< v8::Value >& args );
91 Handle GetHandle() { return mHandle; }
93 ConnectionTracker mConnectionTracker;
96 virtual SignalManager* GetSignalManager() { return &mSignalManager;}
100 SignalManager mSignalManager;
105 } // namespace V8Plugin