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 <CommonsJavaScript/PrivateObject.h>
31 #define TIZEN_INTERFACE_CALENDAR_EVENT "CalendarEvent"
33 #define TIZEN_CALENDAR_EVENT_ID "id"
34 #define TIZEN_CALENDAR_EVENT_IS_DETACHED "isDetached"
35 #define TIZEN_CALENDAR_EVENT_END_DATE "endDate"
36 #define TIZEN_CALENDAR_EVENT_AVAILABILITY "availability"
37 #define TIZEN_CALENDAR_EVENT_RECURRENCE_RULE "recurrenceRule"
39 typedef WrtDeviceApis::CommonsJavaScript::PrivateObject<CalendarEventPtr,
40 WrtDeviceApis::CommonsJavaScript::NoOwnership> CalendarEventPrivObject;
46 static const JSClassDefinition* getClassInfo();
48 static const JSClassRef getClassRef();
50 static CalendarEventPtr getPrivateObject(JSObjectRef object);
52 static void setPrivateObject(const CalendarEventPtr &event,
54 const JSObjectRef object);
56 static JSObjectRef createJSCalendarEvent(JSContextRef context, CalendarEventPtr event);
58 static JSObjectRef constructor(JSContextRef context,
59 JSObjectRef constructor,
61 const JSValueRef arguments[],
62 JSValueRef* exception);
66 * This member variable contains the values which has to be passed when
67 * 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 the
79 * data structure JSPropertySpec.
81 static JSStaticValue m_property[];
83 static JSClassRef m_jsClassRef;
86 * The calendar object to be used for asynchronous platform function invocation.
88 static ICalendarPtr m_calendar;
91 * The callback invoked when an object is first created.
93 static void initialize(JSContextRef context,
97 * The callback invoked when an object is finalized.
99 static void finalize(JSObjectRef object);
102 * Expand event instances from a recurring event
104 static JSValueRef expandRecurrence(JSContextRef context,
106 JSObjectRef thisObject,
107 size_t argumentCount,
108 const JSValueRef arguments[],
109 JSValueRef* exception);
112 * Getters and setters for properties
114 static JSValueRef getPropertyId(JSContextRef context,
116 JSStringRef propertyName,
117 JSValueRef* exception);
118 static JSValueRef getPropertyIsDetached(JSContextRef context,
120 JSStringRef propertyName,
121 JSValueRef* exception);
122 static JSValueRef getPropertyRecurrenceRule(JSContextRef context,
124 JSStringRef propertyName,
125 JSValueRef* exception);
126 static bool setPropertyRecurrenceRule(JSContextRef context,
128 JSStringRef propertyName,
130 JSValueRef* exception);
136 #endif /* _JS_CALENDAR_EVENT_H_ */