Purge underscored header file barriers
[platform/core/uifw/dali-toolkit.git] / plugins / dali-script-v8 / src / object / handle-wrapper.h
1 #ifndef DALI_V8PLUGIN_HANDLE_WRAPPER_H
2 #define DALI_V8PLUGIN_HANDLE_WRAPPER_H
3
4 /*
5  * Copyright (c) 2019 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22 #include <v8.h>
23 #include <dali/public-api/object/handle.h>
24
25 // INTERNAL INCLUDES
26 #include <shared/base-wrapped-object.h>
27 #include <signals/signal-manager.h>
28
29 namespace Dali
30 {
31
32 namespace V8Plugin
33 {
34
35 class BaseCallBack;
36
37 class HandleWrapper : public BaseWrappedObject
38 {
39 public:
40   HandleWrapper( BaseWrappedObject::Type type,
41                 Handle handle,
42                 GarbageCollectorInterface& gc );
43
44   virtual ~HandleWrapper();
45
46   /**
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).
52    */
53   static void PropertyGet( v8::Local<v8::String> propertyName,
54                                           const v8::PropertyCallbackInfo<v8::Value>& info);
55
56   /**
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
62    * object).
63    */
64   static void PropertySet( v8::Local<v8::String> propertyName,
65                     v8::Local<v8::Value> javaScriptValue,
66                     const v8::PropertyCallbackInfo<v8::Value>& info);
67
68   static HandleWrapper* Unwrap( v8::Isolate* isolate, v8::Handle< v8::Object> obj);
69
70   /**
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
74    */
75   static void AddInterceptsToTemplate( v8::Isolate* isolate, v8::Local<v8::ObjectTemplate>& objTemplate );
76
77   /**
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
81    */
82   static void RegisterAnimatableProperty( const v8::FunctionCallbackInfo< v8::Value >& args );
83
84   /**
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
88    */
89   static void RegisterCustomProperty( const v8::FunctionCallbackInfo< v8::Value >& args );
90
91   Handle GetHandle() { return mHandle; }
92   Handle mHandle;
93   ConnectionTracker mConnectionTracker;
94
95
96   virtual SignalManager* GetSignalManager() { return &mSignalManager;}
97
98 private:
99
100   SignalManager mSignalManager;
101
102 };
103
104 } // namespace V8Plugin
105
106 } // namespace Dali
107
108 #endif // DALI_V8PLUGIN_HANDLE_WRAPPER_H