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.
18 #ifndef _JS_TIZEN_CALENDAR_H_
19 #define _JS_TIZEN_CALENDAR_H_
23 #include <JavaScriptCore/JavaScript.h>
24 #include <CommonsJavaScript/PrivateObject.h>
25 #include <API/Calendar/ICalendar.h>
26 #include <CommonsJavaScript/JSCallbackManager.h>
32 #define TIZEN_CALENDAR_PROPERTY_NAME "name"
33 #define TIZEN_CALENDAR_PROPERTY_ACCOUNT_ID "accountId"
34 #define TIZEN_CALENDAR_PROPERTY_ID "id"
36 typedef WrtDeviceApis::CommonsJavaScript::PrivateObject<TizenApis::Api::Calendar::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 getPropertyAccountId(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 old wac2.0 stype filter.
157 static JSValueRef findWithWACFilter(JSContextRef context,
159 JSObjectRef thisObject,
160 size_t argumentCount,
161 const JSValueRef arguments[],
162 JSValueRef* exception);
165 * Search for calendar items using tizen generic filter.
167 static JSValueRef find(JSContextRef context,
169 JSObjectRef thisObject,
170 size_t argumentCount,
171 const JSValueRef arguments[],
172 JSValueRef* exception);
175 * Create an event from string
177 static JSValueRef convertFromString(JSContextRef context,
179 JSObjectRef thisObject,
180 size_t argumentCount,
181 const JSValueRef arguments[],
182 JSValueRef* exception);
185 * Export a string from event
187 static JSValueRef convertToString(JSContextRef context,
189 JSObjectRef thisObject,
190 size_t argumentCount,
191 const JSValueRef arguments[],
192 JSValueRef* exception);
197 static JSValueRef addChangeListener(JSContextRef context,
199 JSObjectRef thisObject,
200 size_t argumentCount,
201 const JSValueRef arguments[],
202 JSValueRef* exception);
207 static JSValueRef removeChangeListener(JSContextRef context,
209 JSObjectRef thisObject,
210 size_t argumentCount,
211 const JSValueRef arguments[],
212 JSValueRef* exception);
215 * Expand event instances from a recurring event
217 static JSValueRef expandEventRecurrence(JSContextRef context,
219 JSObjectRef thisObject,
220 size_t argumentCount,
221 const JSValueRef arguments[],
222 JSValueRef* exception);
225 * Returns calendar stored as private object
227 static Api::Calendar::ICalendarPtr getCalendar(JSContextRef ctx,
228 const JSObjectRef object,
229 JSValueRef* exception);
236 #endif /* _JS_TIZEN_CALENDAR_H_ */