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 typedef WrtDeviceApis::CommonsJavaScript::PrivateObject<TizenApis::Api::Calendar::ICalendarPtr,
33 WrtDeviceApis::CommonsJavaScript::NoOwnership> CalendarPrivObject;
39 static const JSClassDefinition* getClassInfo();
41 static const JSClassRef getClassRef();
45 * This member variable contains the values which has to be passed
46 * when the this class is embedded into JS Engine.
48 static JSClassDefinition m_classInfo;
51 * This structure describes a statically declared function property.
53 static JSStaticFunction m_function[];
56 * This member variable contains the initialization values for the
57 * properties of this class. The values are given according to
58 * the data structure JSPropertySpec
60 static JSStaticValue m_property[];
62 static JSClassRef m_jsClassRef;
65 * The callback invoked when an object is first created.
67 static void initialize(JSContextRef context,
71 * The callback invoked when an object is finalized.
73 static void finalize(JSObjectRef object);
75 static JSValueRef getPropertyName(JSContextRef context,
77 JSStringRef propertyName,
78 JSValueRef* exception);
80 static JSValueRef getPropertyAccountId(JSContextRef context,
82 JSStringRef propertyName,
83 JSValueRef* exception);
86 * Add a calendar item.
88 static JSValueRef add(JSContextRef context,
90 JSObjectRef thisObject,
92 const JSValueRef arguments[],
93 JSValueRef* exception);
98 static JSValueRef addBatch(JSContextRef context,
100 JSObjectRef thisObject,
101 size_t argumentCount,
102 const JSValueRef arguments[],
103 JSValueRef* exception);
108 static JSValueRef update(JSContextRef context,
110 JSObjectRef thisObject,
111 size_t argumentCount,
112 const JSValueRef arguments[],
113 JSValueRef* exception);
118 static JSValueRef updateBatch(JSContextRef context,
120 JSObjectRef thisObject,
121 size_t argumentCount,
122 const JSValueRef arguments[],
123 JSValueRef* exception);
126 * Remove a calendar item.
128 static JSValueRef remove(JSContextRef context,
130 JSObjectRef thisObject,
131 size_t argumentCount,
132 const JSValueRef arguments[],
133 JSValueRef* exception);
136 * Remove calendar items.
138 static JSValueRef removeBatch(JSContextRef context,
140 JSObjectRef thisObject,
141 size_t argumentCount,
142 const JSValueRef arguments[],
143 JSValueRef* exception);
146 * Search for calendar events.
148 static JSValueRef find(JSContextRef context,
150 JSObjectRef thisObject,
151 size_t argumentCount,
152 const JSValueRef arguments[],
153 JSValueRef* exception);
156 * Search for calendar events.
158 static JSValueRef findEventsGeneric(JSContextRef context,
160 JSObjectRef thisObject,
161 size_t argumentCount,
162 const JSValueRef arguments[],
163 JSValueRef* exception);
166 * Create an event from string
168 static JSValueRef convertFromString(JSContextRef context,
170 JSObjectRef thisObject,
171 size_t argumentCount,
172 const JSValueRef arguments[],
173 JSValueRef* exception);
176 * Export a string from event
178 static JSValueRef convertToString(JSContextRef context,
180 JSObjectRef thisObject,
181 size_t argumentCount,
182 const JSValueRef arguments[],
183 JSValueRef* exception);
188 static JSValueRef addChangeListener(JSContextRef context,
190 JSObjectRef thisObject,
191 size_t argumentCount,
192 const JSValueRef arguments[],
193 JSValueRef* exception);
198 static JSValueRef removeChangeListener(JSContextRef context,
200 JSObjectRef thisObject,
201 size_t argumentCount,
202 const JSValueRef arguments[],
203 JSValueRef* exception);
206 * Expand event instances from a recurring event
208 static JSValueRef expandEventRecurrence(JSContextRef context,
210 JSObjectRef thisObject,
211 size_t argumentCount,
212 const JSValueRef arguments[],
213 JSValueRef* exception);
216 * Returns calendar stored as private object
218 static Api::Calendar::ICalendarPtr getCalendar(JSContextRef ctx,
219 const JSObjectRef object,
220 JSValueRef* exception);
227 #endif /* _JS_TIZEN_CALENDAR_H_ */