Beta merge 2
[profile/ivi/wrt-plugins-tizen.git] / src / standards / Tizen / Calendar / JSCalendarAlarm.h
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17
18 #ifndef _JS_CALENDAR_ALARM_H_
19 #define _JS_CALENDAR_ALARM_H_
20
21 #include <JavaScriptCore/JavaScript.h>
22 #include <CommonsJavaScript/PrivateObject.h>
23 #include <API/Calendar/EventAlarm.h>
24
25 namespace TizenApis {
26 namespace Tizen1_0 {
27 namespace Calendar {
28
29 #define TIZEN_INTERFACE_CALENDAR_ALARM "CalendarAlarm"
30
31 #define TIZEN_CALENDAR_ALARM_ABSOLUTE_DATE "absoluteDate"
32 #define TIZEN_CALENDAR_ALARM_BEFORE "before"
33 #define TIZEN_CALENDAR_ALARM_METHOD "method"
34 #define TIZEN_CALENDAR_ALARM_DESCRIPTION "description"
35
36 typedef WrtDeviceApis::CommonsJavaScript::PrivateObject<TizenApis::Api::Calendar::EventAlarmPtr,
37             WrtDeviceApis::CommonsJavaScript::NoOwnership> EventAlarmPrivateObject;
38
39 class JSCalendarAlarm
40 {
41   public:
42
43     static const JSClassDefinition* getClassInfo();
44
45     static JSClassRef getClassRef();
46
47     static JSObjectRef createJSCalendarAlarm(JSContextRef context, TizenApis::Api::Calendar::EventAlarmPtr alarm);
48
49     static TizenApis::Api::Calendar::EventAlarmPtr getPrivateObject(JSObjectRef object);
50
51     static void setPrivateObject(const TizenApis::Api::Calendar::EventAlarmPtr &alarm,
52             JSContextRef ctx,
53             const JSObjectRef object);
54
55   private:
56
57     /**
58      * The callback invoked when an object is first created.
59      */
60     static void initialize(JSContextRef context, JSObjectRef object);
61
62     /**
63      * The callback invoked when an object is finalized.
64      */
65     static void finalize(JSObjectRef object);
66
67         /**
68          * Constructor for the CalendarAlarm interface.
69          */
70         static JSObjectRef constructor(JSContextRef context,
71                     JSObjectRef constructor,
72                     size_t argumentCount,
73                     const JSValueRef arguments[],
74                     JSValueRef* exception);
75
76     static JSValueRef getProperty(JSContextRef context,
77             JSObjectRef object,
78             JSStringRef propertyName,
79             JSValueRef* exception);
80
81     static bool setProperty(JSContextRef context,
82             JSObjectRef object,
83             JSStringRef propertyName,
84             JSValueRef value,
85             JSValueRef* exception);
86
87     static JSClassRef m_jsClassRef;
88
89     /**
90      * This structure describes a statically declared function property.
91      */
92     static JSStaticFunction m_function[];
93
94     /**
95      * This structure contains properties and callbacks that define a type of object.
96      */
97     static JSClassDefinition m_classInfo;
98
99     /**
100      * This member variable contains the initialization values for the static properties of this class.
101      * The values are given according to the data structure JSPropertySpec
102      */
103     static JSStaticValue m_property[];
104 };
105 }
106 }
107 }
108
109 #endif /* _JS_CALENDAR_ALARM_H_ */