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_CALENDAR_ITEM_PROPERTIES_H_
20 #define _JS_CALENDAR_ITEM_PROPERTIES_H_
22 #include <JavaScriptCore/JavaScript.h>
23 #include "CalendarEvent.h"
24 #include <CommonsJavaScript/PrivateObject.h>
29 // Common CalendarItemProperties
30 #define TIZEN_CALENDAR_ITEM_DESCRIPTION "description"
31 #define TIZEN_CALENDAR_ITEM_SUMMARY "summary"
32 #define TIZEN_CALENDAR_ITEM_IS_ALL_DAY "isAllDay"
33 #define TIZEN_CALENDAR_ITEM_START_DATE "startDate"
34 #define TIZEN_CALENDAR_ITEM_DURATION "duration"
35 #define TIZEN_CALENDAR_ITEM_LOCATION "location"
36 #define TIZEN_CALENDAR_ITEM_GEOLOCATION "geolocation"
37 #define TIZEN_CALENDAR_ITEM_ORGANIZER "organizer"
38 #define TIZEN_CALENDAR_ITEM_VISIBILITY "visibility"
39 #define TIZEN_CALENDAR_ITEM_STATUS "status"
40 #define TIZEN_CALENDAR_ITEM_PRIORITY "priority"
41 #define TIZEN_CALENDAR_ITEM_ALARMS "alarms"
42 #define TIZEN_CALENDAR_ITEM_CATEGORIES "categories"
43 #define TIZEN_CALENDAR_ITEM_ATTENDEES "attendees"
44 #define TIZEN_CALENDAR_ITEM_CALENDAR_ID "calendarId"
46 // CalendarTaskProperties
47 #define TIZEN_CALENDAR_TASK_DUE_DATE "dueDate"
48 #define TIZEN_CALENDAR_TASK_COMPLETED_DATE "completedDate"
49 #define TIZEN_CALENDAR_TASK_PROGRESS "progress"
51 // CalendarEventProperties
52 #define TIZEN_CALENDAR_EVENT_END_DATE "endDate"
53 #define TIZEN_CALENDAR_EVENT_AVAILABILITY "availability"
54 #define TIZEN_CALENDAR_EVENT_RECURRENCE_RULE "recurrenceRule"
56 typedef WrtDeviceApis::CommonsJavaScript::PrivateObject<CalendarEventPtr,
57 WrtDeviceApis::CommonsJavaScript::NoOwnership> CalendarItemPropertiesPrivObject;
59 class JSCalendarItemProperties
63 static const JSClassDefinition* getClassInfo();
65 static const JSClassRef getClassRef();
67 static CalendarEventPtr getPrivateObject(JSObjectRef object);
69 static void setPrivateObject(const CalendarEventPtr &event,
71 const JSObjectRef object);
73 static JSObjectRef createJSCalendarItemProperties(JSContextRef context, CalendarEventPtr geo);
75 static bool validate(JSContextRef ctx,
76 const JSObjectRef object,
77 JSValueRef* exception);
81 * This member variable contains the values which has to be passed when
82 * the this class is embedded into JS Engine.
84 static JSClassDefinition m_classInfo;
87 * This structure describes a statically declared function property.
89 static JSStaticFunction m_function[];
92 * This member variable contains the initialization values for the
93 * properties of this class. The values are given according to the
94 * data structure JSPropertySpec.
96 static JSStaticValue m_property[];
98 static JSClassRef m_jsClassRef;
101 * The callback invoked when an object is first created.
103 static void initialize(JSContextRef context,
107 * The callback invoked when an object is finalized.
109 static void finalize(JSObjectRef object);
112 * Export a string from item
114 static JSValueRef convertToString(JSContextRef context,
116 JSObjectRef thisObject,
117 size_t argumentCount,
118 const JSValueRef arguments[],
119 JSValueRef* exception);
122 * Copy item object contents except id
124 static JSValueRef clone(JSContextRef context,
126 JSObjectRef thisObject,
127 size_t argumentCount,
128 const JSValueRef arguments[],
129 JSValueRef* exception);
132 * Getters and setters for properties
134 static JSValueRef getPropertyDescription(JSContextRef context,
136 JSStringRef propertyName,
137 JSValueRef* exception);
138 static bool setPropertyDescription(JSContextRef context,
140 JSStringRef propertyName,
142 JSValueRef* exception);
143 static JSValueRef getPropertySummary(JSContextRef context,
145 JSStringRef propertyName,
146 JSValueRef* exception);
147 static bool setPropertySummary(JSContextRef context,
149 JSStringRef propertyName,
151 JSValueRef* exception);
152 static JSValueRef getPropertyStartTime(JSContextRef context,
154 JSStringRef propertyName,
155 JSValueRef* exception);
156 static bool setPropertyStartTime(JSContextRef context,
158 JSStringRef propertyName,
160 JSValueRef* exception);
161 static JSValueRef getPropertyLocation(JSContextRef context,
163 JSStringRef propertyName,
164 JSValueRef* exception);
165 static bool setPropertyLocation(JSContextRef context,
167 JSStringRef propertyName,
169 JSValueRef* exception);
170 static JSValueRef getPropertyGeolocation(JSContextRef context,
172 JSStringRef propertyName,
173 JSValueRef* exception);
174 static bool setPropertyGeolocation(JSContextRef context,
176 JSStringRef propertyName,
178 JSValueRef* exception);
179 static JSValueRef getPropertyOrganizer(JSContextRef context,
181 JSStringRef propertyName,
182 JSValueRef* exception);
183 static bool setPropertyOrganizer(JSContextRef context,
185 JSStringRef propertyName,
187 JSValueRef* exception);
188 static JSValueRef getPropertyVisibility(JSContextRef context,
190 JSStringRef propertyName,
191 JSValueRef* exception);
192 static bool setPropertyVisibility(JSContextRef context,
194 JSStringRef propertyName,
196 JSValueRef* exception);
197 static JSValueRef getPropertyStatus(JSContextRef context,
199 JSStringRef propertyName,
200 JSValueRef* exception);
201 static bool setPropertyStatus(JSContextRef context,
203 JSStringRef propertyName,
205 JSValueRef* exception);
206 static JSValueRef getPropertyAlarms(JSContextRef context,
208 JSStringRef propertyName,
209 JSValueRef* exception);
210 static bool setPropertyAlarms(JSContextRef context,
212 JSStringRef propertyName,
214 JSValueRef* exception);
215 static JSValueRef getPropertyCategories(JSContextRef context,
217 JSStringRef propertyName,
218 JSValueRef* exception);
219 static bool setPropertyCategories(JSContextRef context,
221 JSStringRef propertyName,
223 JSValueRef* exception);
224 static JSValueRef getPropertyIsAllDay(JSContextRef context,
226 JSStringRef propertyName,
227 JSValueRef* exception);
228 static bool setPropertyIsAllDay(JSContextRef context,
230 JSStringRef propertyName,
232 JSValueRef* exception);
233 static JSValueRef getPropertyDuration(JSContextRef context,
235 JSStringRef propertyName,
236 JSValueRef* exception);
237 static bool setPropertyDuration(JSContextRef context,
239 JSStringRef propertyName,
241 JSValueRef* exception);
242 static JSValueRef getPropertyAttendees(JSContextRef context,
244 JSStringRef propertyName,
245 JSValueRef* exception);
246 static bool setPropertyAttendees(JSContextRef context,
248 JSStringRef propertyName,
250 JSValueRef* exception);
251 static JSValueRef getPropertyAvailability(JSContextRef context,
253 JSStringRef propertyName,
254 JSValueRef* exception);
255 static bool setPropertyAvailability(JSContextRef context,
257 JSStringRef propertyName,
259 JSValueRef* exception);
260 static JSValueRef getPropertyRecurrenceRule(JSContextRef context,
262 JSStringRef propertyName,
263 JSValueRef* exception);
264 static bool setPropertyRecurrenceRule(JSContextRef context,
266 JSStringRef propertyName,
268 JSValueRef* exception);
269 static JSValueRef getPropertyDueDate(JSContextRef context,
271 JSStringRef propertyName,
272 JSValueRef* exception);
273 static bool setPropertyDueDate(JSContextRef context,
275 JSStringRef propertyName,
277 JSValueRef* exception);
278 static JSValueRef getPropertyCompletedDate(JSContextRef context,
280 JSStringRef propertyName,
281 JSValueRef* exception);
282 static bool setPropertyCompletedDate(JSContextRef context,
284 JSStringRef propertyName,
286 JSValueRef* exception);
287 static JSValueRef getPropertyProgress(JSContextRef context,
289 JSStringRef propertyName,
290 JSValueRef* exception);
291 static bool setPropertyProgress(JSContextRef context,
293 JSStringRef propertyName,
295 JSValueRef* exception);
296 static JSValueRef getPropertyPriority(JSContextRef context,
298 JSStringRef propertyName,
299 JSValueRef* exception);
300 static bool setPropertyPriority(JSContextRef context,
302 JSStringRef propertyName,
304 JSValueRef* exception);
305 static JSValueRef getPropertyEndDate(JSContextRef context,
307 JSStringRef propertyName,
308 JSValueRef* exception);
309 static bool setPropertyEndDate(JSContextRef context,
311 JSStringRef propertyName,
313 JSValueRef* exception);
314 static JSValueRef getPropertyLastModificationDate(JSContextRef context,
316 JSStringRef propertyName,
317 JSValueRef* exception);
318 static JSValueRef getPropertyCalendarId(JSContextRef context,
320 JSStringRef propertyName,
321 JSValueRef* exception);