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>
33 #define TIZEN_CALENDAR_PROPERTY_NAME "name"
34 //#define TIZEN_CALENDAR_PROPERTY_ACCOUNT_SERVICE_ID "accountServiceId"
35 #define TIZEN_CALENDAR_PROPERTY_ID "id"
37 typedef WrtDeviceApis::CommonsJavaScript::PrivateObject<ICalendarPtr,
38 WrtDeviceApis::CommonsJavaScript::NoOwnership> CalendarPrivObjectBase;
40 class CalendarPrivObject :
41 public CalendarPrivObjectBase,
42 public DeviceAPI::Common::SecurityAccessor
45 CalendarPrivObject(JSContextRef context, ICalendarPtr calendar) :
46 CalendarPrivObjectBase(context, calendar),
47 DeviceAPI::Common::SecurityAccessor()
51 virtual ~CalendarPrivObject()
60 static const JSClassDefinition* getClassInfo();
62 static const JSClassRef getClassRef();
66 * This member variable contains the values which has to be passed
67 * when the this class is embedded into JS Engine.
69 static JSClassDefinition m_classInfo;
72 * This structure describes a statically declared function property.
74 static JSStaticFunction m_function[];
77 * This member variable contains the initialization values for the
78 * properties of this class. The values are given according to
79 * the data structure JSPropertySpec
81 static JSStaticValue m_property[];
83 static JSClassRef m_jsClassRef;
86 * The callback invoked when an object is first created.
88 static void initialize(JSContextRef context,
92 * The callback invoked when an object is finalized.
94 static void finalize(JSObjectRef object);
96 static JSValueRef getPropertyName(JSContextRef context,
98 JSStringRef propertyName,
99 JSValueRef* exception);
101 static JSValueRef getPropertyAccountServiceId(JSContextRef context,
103 JSStringRef propertyName,
104 JSValueRef* exception);
106 static JSValueRef getPropertyId(JSContextRef context,
108 JSStringRef propertyName,
109 JSValueRef* exception);
112 * Add a calendar item.
114 static JSValueRef add(JSContextRef context,
116 JSObjectRef thisObject,
117 size_t argumentCount,
118 const JSValueRef arguments[],
119 JSValueRef* exception);
122 * Add calendar items.
124 static JSValueRef addBatch(JSContextRef context,
126 JSObjectRef thisObject,
127 size_t argumentCount,
128 const JSValueRef arguments[],
129 JSValueRef* exception);
134 static JSValueRef update(JSContextRef context,
136 JSObjectRef thisObject,
137 size_t argumentCount,
138 const JSValueRef arguments[],
139 JSValueRef* exception);
144 static JSValueRef updateBatch(JSContextRef context,
146 JSObjectRef thisObject,
147 size_t argumentCount,
148 const JSValueRef arguments[],
149 JSValueRef* exception);
152 * Remove a calendar item.
154 static JSValueRef remove(JSContextRef context,
156 JSObjectRef thisObject,
157 size_t argumentCount,
158 const JSValueRef arguments[],
159 JSValueRef* exception);
162 * Remove calendar items.
164 static JSValueRef removeBatch(JSContextRef context,
166 JSObjectRef thisObject,
167 size_t argumentCount,
168 const JSValueRef arguments[],
169 JSValueRef* exception);
172 * Search for calendar items using tizen generic filter.
174 static JSValueRef find(JSContextRef context,
176 JSObjectRef thisObject,
177 size_t argumentCount,
178 const JSValueRef arguments[],
179 JSValueRef* exception);
184 static JSValueRef addChangeListener(JSContextRef context,
186 JSObjectRef thisObject,
187 size_t argumentCount,
188 const JSValueRef arguments[],
189 JSValueRef* exception);
194 static JSValueRef removeChangeListener(JSContextRef context,
196 JSObjectRef thisObject,
197 size_t argumentCount,
198 const JSValueRef arguments[],
199 JSValueRef* exception);
202 * Get an item from id
204 static JSValueRef get(JSContextRef context,
206 JSObjectRef thisObject,
207 size_t argumentCount,
208 const JSValueRef arguments[],
209 JSValueRef* exception);
212 * Returns calendar stored as private object
214 static ICalendarPtr getCalendar(JSContextRef ctx,
215 const JSObjectRef object,
216 JSValueRef* exception);
222 #endif /* _JS_TIZEN_CALENDAR_H_ */