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_LAST_MODIFICATION_DATE "lastModificationDate"
35 #define TIZEN_CALENDAR_EVENT_IS_DETACHED "isDetached"
37 typedef WrtDeviceApis::CommonsJavaScript::PrivateObject<CalendarEventPtr,
38 WrtDeviceApis::CommonsJavaScript::NoOwnership> CalendarEventPrivObject;
44 static const JSClassDefinition* getClassInfo();
46 static const JSClassRef getClassRef();
48 static CalendarEventPtr getPrivateObject(JSObjectRef object);
50 static void setPrivateObject(const CalendarEventPtr &event,
52 const JSObjectRef object);
54 static bool validate(JSContextRef ctx,
55 const JSObjectRef object,
56 JSValueRef* exception);
58 static JSObjectRef createJSCalendarEvent(JSContextRef context, CalendarEventPtr event);
62 * This member variable contains the values which has to be passed when
63 * the this class is embedded into JS Engine.
65 static JSClassDefinition m_classInfo;
68 * This structure describes a statically declared function property.
70 static JSStaticFunction m_function[];
73 * This member variable contains the initialization values for the
74 * properties of this class. The values are given according to the
75 * data structure JSPropertySpec.
77 static JSStaticValue m_property[];
79 static JSClassRef m_jsClassRef;
82 * The calendar object to be used for asynchronous platform function invocation.
84 static ICalendarPtr m_calendar;
87 * The callback invoked when an object is first created.
89 static void initialize(JSContextRef context,
93 * The callback invoked when an object is finalized.
95 static void finalize(JSObjectRef object);
98 * Constructor for the CalendarEvent interface.
100 static JSObjectRef constructor(JSContextRef context,
101 JSObjectRef constructor,
102 size_t argumentCount,
103 const JSValueRef arguments[],
104 JSValueRef* exception);
107 * Expand event instances from a recurring event
109 static JSValueRef expandRecurrence(JSContextRef context,
111 JSObjectRef thisObject,
112 size_t argumentCount,
113 const JSValueRef arguments[],
114 JSValueRef* exception);
117 * Getters and setters for properties
119 static JSValueRef getPropertyId(JSContextRef context,
121 JSStringRef propertyName,
122 JSValueRef* exception);
123 static JSValueRef getPropertyIsDetached(JSContextRef context,
125 JSStringRef propertyName,
126 JSValueRef* exception);
132 #endif /* _JS_CALENDAR_EVENT_H_ */