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>
30 namespace WrtPlugins {
38 * This method initializes this in the JS Engine.
40 static const JSClassRef getClassRef();
43 * Gets object's class description.
45 static const JSClassDefinition* getClassInfo();
49 * The callback invoked when an object is first created.
51 static void initialize(JSContextRef context,
55 * The callback invoked when an object is finalized.
57 static void finalize(JSObjectRef object);
60 * This structure describes a statically declared value property.
62 static JSStaticValue m_property[];
65 * This structure contains properties and callbacks that define a type of object.
67 static JSClassDefinition m_classInfo;
69 static JSClassRef m_jsClassRef;
71 // getters for properties
72 static JSValueRef getAuthor(JSContextRef context,
74 JSStringRef propertyName,
75 JSValueRef* exception);
76 static JSValueRef getAuthorEmail(JSContextRef context,
78 JSStringRef propertyName,
79 JSValueRef* exception);
80 static JSValueRef getAuthorHref(JSContextRef context,
82 JSStringRef propertyName,
83 JSValueRef* exception);
84 static JSValueRef getDescription(JSContextRef context,
86 JSStringRef propertyName,
87 JSValueRef* exception);
88 static JSValueRef getId(JSContextRef context,
90 JSStringRef propertyName,
91 JSValueRef* exception);
92 static JSValueRef getName(JSContextRef context,
94 JSStringRef propertyName,
95 JSValueRef* exception);
96 static JSValueRef getShortName(JSContextRef context,
98 JSStringRef propertyName,
99 JSValueRef* exception);
100 static JSValueRef getVersion(JSContextRef context,
102 JSStringRef propertyName,
103 JSValueRef* exception);
104 static JSValueRef getHeight(JSContextRef context,
106 JSStringRef propertyName,
107 JSValueRef* exception);
108 static JSValueRef getWidth(JSContextRef context,
110 JSStringRef propertyName,
111 JSValueRef* exception);
113 static bool hasProperty(JSContextRef context,
115 JSStringRef propertyName);
117 static JSValueRef getProperty(JSContextRef context,
119 JSStringRef propertyName,
120 JSValueRef* exception);
122 static bool setProperty(JSContextRef context,
124 JSStringRef propertyName,
126 JSValueRef* exception);
131 #endif /* _WRT_PLUGIN_JS_WIDGET_INTERFACE_H_ */