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_EVENT_H_
20 #define _JS_CALENDAR_EVENT_H_
22 #include <JavaScriptCore/JavaScript.h>
23 #include "CalendarEvent.h"
24 #include "ICalendar.h"
25 #include "CalendarFactory.h"
26 #include "JSCalendarItemProperties.h"
27 #include <CommonsJavaScript/PrivateObject.h>
33 #define TIZEN_INTERFACE_CALENDAR_EVENT "CalendarEvent"
35 #define TIZEN_CALENDAR_EVENT_ID "id"
36 #define TIZEN_CALENDAR_EVENT_IS_DETACHED "isDetached"
37 #define TIZEN_CALENDAR_EVENT_END_DATE "endDate"
38 #define TIZEN_CALENDAR_EVENT_AVAILABILITY "availability"
39 #define TIZEN_CALENDAR_EVENT_RECURRENCE_RULE "recurrenceRule"
41 typedef CalendarItemPropertiesPrivObject CalendarEventPrivObject;
47 static const JSClassDefinition* getClassInfo();
49 static const JSClassRef getClassRef();
51 static CalendarEventPtr getPrivateObject(JSObjectRef object);
53 static void setPrivateObject(const CalendarEventPtr &event,
55 const JSObjectRef object);
57 static JSObjectRef createJSCalendarEvent(JSContextRef context, CalendarEventPtr event, const DeviceAPI::Common::SecurityAccessor *securityAccessor);
59 static JSObjectRef constructor(JSContextRef context,
60 JSObjectRef constructor,
62 const JSValueRef arguments[],
63 JSValueRef* exception);
67 * This member variable contains the values which has to be passed when
68 * the this class is embedded into JS Engine.
70 static JSClassDefinition m_classInfo;
73 * This structure describes a statically declared function property.
75 static JSStaticFunction m_function[];
78 * This member variable contains the initialization values for the
79 * properties of this class. The values are given according to the
80 * data structure JSPropertySpec.
82 static JSStaticValue m_property[];
84 static JSClassRef m_jsClassRef;
87 * The calendar object to be used for asynchronous platform function invocation.
89 static ICalendarPtr m_calendar;
92 * The callback invoked when an object is first created.
94 static void initialize(JSContextRef context,
98 * The callback invoked when an object is finalized.
100 static void finalize(JSObjectRef object);
103 * Expand event instances from a recurring event
105 static JSValueRef expandRecurrence(JSContextRef context,
107 JSObjectRef thisObject,
108 size_t argumentCount,
109 const JSValueRef arguments[],
110 JSValueRef* exception);
113 * Getters and setters for properties
115 static JSValueRef getPropertyId(JSContextRef context,
117 JSStringRef propertyName,
118 JSValueRef* exception);
119 static JSValueRef getPropertyIsDetached(JSContextRef context,
121 JSStringRef propertyName,
122 JSValueRef* exception);
123 static JSValueRef getPropertyAvailability(JSContextRef context,
125 JSStringRef propertyName,
126 JSValueRef* exception);
127 static bool setPropertyAvailability(JSContextRef context,
129 JSStringRef propertyName,
131 JSValueRef* exception);
132 static JSValueRef getPropertyRecurrenceRule(JSContextRef context,
134 JSStringRef propertyName,
135 JSValueRef* exception);
136 static bool setPropertyRecurrenceRule(JSContextRef context,
138 JSStringRef propertyName,
140 JSValueRef* exception);
146 #endif /* _JS_CALENDAR_EVENT_H_ */