Update change log and spec for wrt-plugins-tizen_0.4.13
[framework/web/wrt-plugins-tizen.git] / src / Calendar / JSCalendarTask.h
1 //
2 // Tizen Web Device API
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
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.
16 //
17
18
19 #ifndef _JS_CALENDAR_TASK_H_
20 #define _JS_CALENDAR_TASK_H_
21
22 #include <JavaScriptCore/JavaScript.h>
23 #include "CalendarEvent.h"
24 #include <CommonsJavaScript/PrivateObject.h>
25
26 namespace DeviceAPI {
27 namespace Calendar {
28
29 #define TIZEN_INTERFACE_CALENDAR_TASK "CalendarTask"
30
31 #define TIZEN_CALENDAR_TASK_ID "id"
32 #define TIZEN_CALENDAR_TASK_DUE_DATE  "dueDate"
33 #define TIZEN_CALENDAR_TASK_COMPLETED_DATE  "completedDate"
34 #define TIZEN_CALENDAR_TASK_PROGRESS "progress"
35
36 typedef WrtDeviceApis::CommonsJavaScript::PrivateObject<CalendarEventPtr,
37         WrtDeviceApis::CommonsJavaScript::NoOwnership> CalendarTaskPrivObject;
38
39 class JSCalendarTask
40 {
41   public:
42
43     static const JSClassDefinition* getClassInfo();
44
45     static const JSClassRef getClassRef();
46
47     static CalendarEventPtr getPrivateObject(JSObjectRef object);
48
49     static void setPrivateObject(const CalendarEventPtr &event,
50             JSContextRef ctx,
51             const JSObjectRef object);
52
53         static JSObjectRef createJSCalendarTask(JSContextRef context, CalendarEventPtr task);
54
55   private:
56     /**
57      * This member variable contains the values which has to be passed when
58      * the this class is embedded into JS Engine.
59      */
60     static JSClassDefinition m_classInfo;
61
62     /**
63      * This structure describes a statically declared function property.
64      */
65     static JSStaticFunction m_function[];
66
67     /**
68      * This member variable contains the initialization values for the
69      * properties of this class. The values are given according to the
70      * data structure JSPropertySpec.
71      */
72     static JSStaticValue m_property[];
73
74     static JSClassRef m_jsClassRef;
75
76         /**
77          * The calendar object to be used for asynchronous platform function invocation.
78          */
79         static ICalendarPtr m_calendar;
80
81     /**
82      * The callback invoked when an object is first created.
83      */
84     static void initialize(JSContextRef context,
85             JSObjectRef object);
86
87     /**
88      * The callback invoked when an object is finalized.
89      */
90     static void finalize(JSObjectRef object);
91
92         /**
93          * Constructor for the CalendarTask interface.
94          */
95         static JSObjectRef constructor(JSContextRef context,
96     JSObjectRef constructor,
97     size_t argumentCount,
98     const JSValueRef arguments[],
99     JSValueRef* exception);
100
101     /**
102      * Getters and setters for properties
103      */
104     static JSValueRef getPropertyId(JSContextRef context,
105             JSObjectRef object,
106             JSStringRef propertyName,
107             JSValueRef* exception);
108 };
109
110 }
111 }
112
113 #endif /* _JS_CALENDAR_TASK_H_ */