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_CALENDAR_ITEM_PROPERTIES_H_
19 #define _JS_CALENDAR_ITEM_PROPERTIES_H_
21 #include <JavaScriptCore/JavaScript.h>
22 #include <API/Calendar/CalendarEvent.h>
23 #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"
45 // CalendarTaskProperties
46 #define TIZEN_CALENDAR_TASK_DUE_DATE "dueDate"
47 #define TIZEN_CALENDAR_TASK_COMPLETED_DATE "completedDate"
48 #define TIZEN_CALENDAR_TASK_PROGRESS "progress"
50 // CalendarEventProperties
51 #define TIZEN_CALENDAR_EVENT_END_DATE "endDate"
52 #define TIZEN_CALENDAR_EVENT_AVAILABILITY "availability"
53 #define TIZEN_CALENDAR_EVENT_RECURRENCE_RULE "recurrenceRule"
55 typedef WrtDeviceApis::CommonsJavaScript::PrivateObject<TizenApis::Api::Calendar::CalendarEventPtr,
56 WrtDeviceApis::CommonsJavaScript::NoOwnership> CalendarItemPropertiesPrivObject;
58 class JSCalendarItemProperties
62 static const JSClassDefinition* getClassInfo();
64 static const JSClassRef getClassRef();
66 static TizenApis::Api::Calendar::CalendarEventPtr getPrivateObject(JSObjectRef object);
68 static void setPrivateObject(const TizenApis::Api::Calendar::CalendarEventPtr &event,
70 const JSObjectRef object);
72 static JSObjectRef createJSCalendarItemProperties(JSContextRef context, TizenApis::Api::Calendar::CalendarEventPtr geo);
74 static bool validate(JSContextRef ctx,
75 const JSObjectRef object,
76 JSValueRef* exception);
80 * This member variable contains the values which has to be passed when
81 * the this class is embedded into JS Engine.
83 static JSClassDefinition m_classInfo;
86 * This structure describes a statically declared function property.
88 static JSStaticFunction m_function[];
91 * This member variable contains the initialization values for the
92 * properties of this class. The values are given according to the
93 * data structure JSPropertySpec.
95 static JSStaticValue m_property[];
97 static JSClassRef m_jsClassRef;
100 * The callback invoked when an object is first created.
102 static void initialize(JSContextRef context,
106 * The callback invoked when an object is finalized.
108 static void finalize(JSObjectRef object);
111 * Export a string from item
113 static JSValueRef convertToString(JSContextRef context,
115 JSObjectRef thisObject,
116 size_t argumentCount,
117 const JSValueRef arguments[],
118 JSValueRef* exception);
121 * Copy item object contents except id
123 static JSValueRef clone(JSContextRef context,
125 JSObjectRef thisObject,
126 size_t argumentCount,
127 const JSValueRef arguments[],
128 JSValueRef* exception);
131 * Getters and setters for properties
133 static JSValueRef getPropertyDescription(JSContextRef context,
135 JSStringRef propertyName,
136 JSValueRef* exception);
137 static bool setPropertyDescription(JSContextRef context,
139 JSStringRef propertyName,
141 JSValueRef* exception);
142 static JSValueRef getPropertySummary(JSContextRef context,
144 JSStringRef propertyName,
145 JSValueRef* exception);
146 static bool setPropertySummary(JSContextRef context,
148 JSStringRef propertyName,
150 JSValueRef* exception);
151 static JSValueRef getPropertyStartTime(JSContextRef context,
153 JSStringRef propertyName,
154 JSValueRef* exception);
155 static bool setPropertyStartTime(JSContextRef context,
157 JSStringRef propertyName,
159 JSValueRef* exception);
160 static JSValueRef getPropertyLocation(JSContextRef context,
162 JSStringRef propertyName,
163 JSValueRef* exception);
164 static bool setPropertyLocation(JSContextRef context,
166 JSStringRef propertyName,
168 JSValueRef* exception);
169 static JSValueRef getPropertyGeolocation(JSContextRef context,
171 JSStringRef propertyName,
172 JSValueRef* exception);
173 static bool setPropertyGeolocation(JSContextRef context,
175 JSStringRef propertyName,
177 JSValueRef* exception);
178 static JSValueRef getPropertyOrganizer(JSContextRef context,
180 JSStringRef propertyName,
181 JSValueRef* exception);
182 static bool setPropertyOrganizer(JSContextRef context,
184 JSStringRef propertyName,
186 JSValueRef* exception);
187 static JSValueRef getPropertyVisibility(JSContextRef context,
189 JSStringRef propertyName,
190 JSValueRef* exception);
191 static bool setPropertyVisibility(JSContextRef context,
193 JSStringRef propertyName,
195 JSValueRef* exception);
196 static JSValueRef getPropertyStatus(JSContextRef context,
198 JSStringRef propertyName,
199 JSValueRef* exception);
200 static bool setPropertyStatus(JSContextRef context,
202 JSStringRef propertyName,
204 JSValueRef* exception);
205 static JSValueRef getPropertyAlarms(JSContextRef context,
207 JSStringRef propertyName,
208 JSValueRef* exception);
209 static bool setPropertyAlarms(JSContextRef context,
211 JSStringRef propertyName,
213 JSValueRef* exception);
214 static JSValueRef getPropertyCategories(JSContextRef context,
216 JSStringRef propertyName,
217 JSValueRef* exception);
218 static bool setPropertyCategories(JSContextRef context,
220 JSStringRef propertyName,
222 JSValueRef* exception);
223 static JSValueRef getPropertyIsAllDay(JSContextRef context,
225 JSStringRef propertyName,
226 JSValueRef* exception);
227 static bool setPropertyIsAllDay(JSContextRef context,
229 JSStringRef propertyName,
231 JSValueRef* exception);
232 static JSValueRef getPropertyDuration(JSContextRef context,
234 JSStringRef propertyName,
235 JSValueRef* exception);
236 static bool setPropertyDuration(JSContextRef context,
238 JSStringRef propertyName,
240 JSValueRef* exception);
241 static JSValueRef getPropertyAttendees(JSContextRef context,
243 JSStringRef propertyName,
244 JSValueRef* exception);
245 static bool setPropertyAttendees(JSContextRef context,
247 JSStringRef propertyName,
249 JSValueRef* exception);
250 static JSValueRef getPropertyAvailability(JSContextRef context,
252 JSStringRef propertyName,
253 JSValueRef* exception);
254 static bool setPropertyAvailability(JSContextRef context,
256 JSStringRef propertyName,
258 JSValueRef* exception);
259 static JSValueRef getPropertyRecurrenceRule(JSContextRef context,
261 JSStringRef propertyName,
262 JSValueRef* exception);
263 static bool setPropertyRecurrenceRule(JSContextRef context,
265 JSStringRef propertyName,
267 JSValueRef* exception);
268 static JSValueRef getPropertyDueDate(JSContextRef context,
270 JSStringRef propertyName,
271 JSValueRef* exception);
272 static bool setPropertyDueDate(JSContextRef context,
274 JSStringRef propertyName,
276 JSValueRef* exception);
277 static JSValueRef getPropertyCompletedDate(JSContextRef context,
279 JSStringRef propertyName,
280 JSValueRef* exception);
281 static bool setPropertyCompletedDate(JSContextRef context,
283 JSStringRef propertyName,
285 JSValueRef* exception);
286 static JSValueRef getPropertyProgress(JSContextRef context,
288 JSStringRef propertyName,
289 JSValueRef* exception);
290 static bool setPropertyProgress(JSContextRef context,
292 JSStringRef propertyName,
294 JSValueRef* exception);
295 static JSValueRef getPropertyPriority(JSContextRef context,
297 JSStringRef propertyName,
298 JSValueRef* exception);
299 static bool setPropertyPriority(JSContextRef context,
301 JSStringRef propertyName,
303 JSValueRef* exception);
304 static JSValueRef getPropertyEndDate(JSContextRef context,
306 JSStringRef propertyName,
307 JSValueRef* exception);
308 static bool setPropertyEndDate(JSContextRef context,
310 JSStringRef propertyName,
312 JSValueRef* exception);