2 // Tizen Web Device API
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 #ifndef _JS_TIZEN_CALENDAR_H_
20 #define _JS_TIZEN_CALENDAR_H_
24 #include <JavaScriptCore/JavaScript.h>
25 #include <CommonsJavaScript/PrivateObject.h>
26 #include "ICalendar.h"
27 #include <CommonsJavaScript/JSCallbackManager.h>
32 #define TIZEN_CALENDAR_PROPERTY_NAME "name"
33 //#define TIZEN_CALENDAR_PROPERTY_ACCOUNT_SERVICE_ID "accountServiceId"
34 #define TIZEN_CALENDAR_PROPERTY_ID "id"
36 typedef WrtDeviceApis::CommonsJavaScript::PrivateObject<ICalendarPtr,
37 WrtDeviceApis::CommonsJavaScript::NoOwnership> CalendarPrivObject;
43 static const JSClassDefinition* getClassInfo();
45 static const JSClassRef getClassRef();
49 * This member variable contains the values which has to be passed
50 * when the this class is embedded into JS Engine.
52 static JSClassDefinition m_classInfo;
55 * This structure describes a statically declared function property.
57 static JSStaticFunction m_function[];
60 * This member variable contains the initialization values for the
61 * properties of this class. The values are given according to
62 * the data structure JSPropertySpec
64 static JSStaticValue m_property[];
66 static JSClassRef m_jsClassRef;
69 * The callback invoked when an object is first created.
71 static void initialize(JSContextRef context,
75 * The callback invoked when an object is finalized.
77 static void finalize(JSObjectRef object);
79 static JSValueRef getPropertyName(JSContextRef context,
81 JSStringRef propertyName,
82 JSValueRef* exception);
84 static JSValueRef getPropertyAccountServiceId(JSContextRef context,
86 JSStringRef propertyName,
87 JSValueRef* exception);
89 static JSValueRef getPropertyId(JSContextRef context,
91 JSStringRef propertyName,
92 JSValueRef* exception);
95 * Add a calendar item.
97 static JSValueRef add(JSContextRef context,
99 JSObjectRef thisObject,
100 size_t argumentCount,
101 const JSValueRef arguments[],
102 JSValueRef* exception);
105 * Add calendar items.
107 static JSValueRef addBatch(JSContextRef context,
109 JSObjectRef thisObject,
110 size_t argumentCount,
111 const JSValueRef arguments[],
112 JSValueRef* exception);
117 static JSValueRef update(JSContextRef context,
119 JSObjectRef thisObject,
120 size_t argumentCount,
121 const JSValueRef arguments[],
122 JSValueRef* exception);
127 static JSValueRef updateBatch(JSContextRef context,
129 JSObjectRef thisObject,
130 size_t argumentCount,
131 const JSValueRef arguments[],
132 JSValueRef* exception);
135 * Remove a calendar item.
137 static JSValueRef remove(JSContextRef context,
139 JSObjectRef thisObject,
140 size_t argumentCount,
141 const JSValueRef arguments[],
142 JSValueRef* exception);
145 * Remove calendar items.
147 static JSValueRef removeBatch(JSContextRef context,
149 JSObjectRef thisObject,
150 size_t argumentCount,
151 const JSValueRef arguments[],
152 JSValueRef* exception);
155 * Search for calendar items using tizen generic filter.
157 static JSValueRef find(JSContextRef context,
159 JSObjectRef thisObject,
160 size_t argumentCount,
161 const JSValueRef arguments[],
162 JSValueRef* exception);
167 static JSValueRef addChangeListener(JSContextRef context,
169 JSObjectRef thisObject,
170 size_t argumentCount,
171 const JSValueRef arguments[],
172 JSValueRef* exception);
177 static JSValueRef removeChangeListener(JSContextRef context,
179 JSObjectRef thisObject,
180 size_t argumentCount,
181 const JSValueRef arguments[],
182 JSValueRef* exception);
185 * Get an item from id
187 static JSValueRef get(JSContextRef context,
189 JSObjectRef thisObject,
190 size_t argumentCount,
191 const JSValueRef arguments[],
192 JSValueRef* exception);
195 * Returns calendar stored as private object
197 static ICalendarPtr getCalendar(JSContextRef ctx,
198 const JSObjectRef object,
199 JSValueRef* exception);
205 #endif /* _JS_TIZEN_CALENDAR_H_ */