2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 * @author Grzegorz Krawczyk (g.krawczyk@samsung.com)
24 #ifndef _WRT_PLUGIN_JS_WIDGET_H_
25 #define _WRT_PLUGIN_JS_WIDGET_H_
27 #include <JavaScriptCore/JavaScript.h>
28 #include <CommonsJavaScript/PrivateObject.h>
29 #include <wrt_plugin_export.h>
31 namespace WrtPlugins {
37 * This method initializes this in the JS Engine.
39 static JSClassRef getClassRef();
42 * Gets object's class description.
44 static const JSClassDefinition* getClassInfo();
46 static JSObjectRef callAsConstructor(JSContextRef context,
47 JSObjectRef constructor,
49 const JSValueRef arguments[],
50 JSValueRef* exception);
54 * The callback invoked when an object is first created.
56 static void initialize(JSContextRef context,
60 * The callback invoked when an object is finalized.
62 static void finalize(JSObjectRef object);
65 * This structure describes a statically declared value property.
67 static JSStaticValue m_property[];
70 * This structure contains properties and callbacks that define a type of
73 static JSClassDefinition m_classInfo;
75 static JSClassRef m_jsClassRef;
77 // getters for properties
78 static JSValueRef getAuthor(JSContextRef context,
80 JSStringRef propertyName,
81 JSValueRef* exception);
82 static JSValueRef getAuthorEmail(JSContextRef context,
84 JSStringRef propertyName,
85 JSValueRef* exception);
86 static JSValueRef getAuthorHref(JSContextRef context,
88 JSStringRef propertyName,
89 JSValueRef* exception);
90 static JSValueRef getDescription(JSContextRef context,
92 JSStringRef propertyName,
93 JSValueRef* exception);
94 static JSValueRef getId(JSContextRef context,
96 JSStringRef propertyName,
97 JSValueRef* exception);
98 static JSValueRef getName(JSContextRef context,
100 JSStringRef propertyName,
101 JSValueRef* exception);
102 static JSValueRef getShortName(JSContextRef context,
104 JSStringRef propertyName,
105 JSValueRef* exception);
106 static JSValueRef getVersion(JSContextRef context,
108 JSStringRef propertyName,
109 JSValueRef* exception);
110 static JSValueRef getHeight(JSContextRef context,
112 JSStringRef propertyName,
113 JSValueRef* exception);
114 static JSValueRef getWidth(JSContextRef context,
116 JSStringRef propertyName,
117 JSValueRef* exception);
119 static bool hasProperty(JSContextRef context,
121 JSStringRef propertyName);
123 static JSValueRef getProperty(JSContextRef context,
125 JSStringRef propertyName,
126 JSValueRef* exception);
128 static bool setProperty(JSContextRef context,
130 JSStringRef propertyName,
132 JSValueRef* exception);
137 #endif /* _WRT_PLUGIN_JS_WIDGET_INTERFACE_H_ */