diff options
Diffstat (limited to 'mobile_src/Calendar/JSCalendarEvent.h')
-rwxr-xr-x | mobile_src/Calendar/JSCalendarEvent.h | 146 |
1 files changed, 146 insertions, 0 deletions
diff --git a/mobile_src/Calendar/JSCalendarEvent.h b/mobile_src/Calendar/JSCalendarEvent.h new file mode 100755 index 0000000..1f224bf --- /dev/null +++ b/mobile_src/Calendar/JSCalendarEvent.h @@ -0,0 +1,146 @@ +// +// Tizen Web Device API +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + + +#ifndef _JS_CALENDAR_EVENT_H_ +#define _JS_CALENDAR_EVENT_H_ + +#include <JavaScriptCore/JavaScript.h> +#include "CalendarEvent.h" +#include "ICalendar.h" +#include "CalendarFactory.h" +#include "JSCalendarItemProperties.h" +#include <CommonsJavaScript/PrivateObject.h> +#include <Security.h> + +namespace DeviceAPI { +namespace Calendar { + +#define TIZEN_INTERFACE_CALENDAR_EVENT "CalendarEvent" + +#define TIZEN_CALENDAR_EVENT_ID "id" +#define TIZEN_CALENDAR_EVENT_IS_DETACHED "isDetached" +#define TIZEN_CALENDAR_EVENT_END_DATE "endDate" +#define TIZEN_CALENDAR_EVENT_AVAILABILITY "availability" +#define TIZEN_CALENDAR_EVENT_RECURRENCE_RULE "recurrenceRule" + +typedef CalendarItemPropertiesPrivObject CalendarEventPrivObject; + +class JSCalendarEvent +{ + public: + + static const JSClassDefinition* getClassInfo(); + + static const JSClassRef getClassRef(); + + static CalendarEventPtr getPrivateObject(JSObjectRef object); + + static void setPrivateObject(const CalendarEventPtr &event, + JSContextRef ctx, + const JSObjectRef object); + + static JSObjectRef createJSCalendarEvent(JSContextRef context, CalendarEventPtr event, const DeviceAPI::Common::SecurityAccessor *securityAccessor); + + static JSObjectRef constructor(JSContextRef context, + JSObjectRef constructor, + size_t argumentCount, + const JSValueRef arguments[], + JSValueRef* exception); + + private: + /** + * This member variable contains the values which has to be passed when + * the this class is embedded into JS Engine. + */ + static JSClassDefinition m_classInfo; + + /** + * This structure describes a statically declared function property. + */ + static JSStaticFunction m_function[]; + + /** + * This member variable contains the initialization values for the + * properties of this class. The values are given according to the + * data structure JSPropertySpec. + */ + static JSStaticValue m_property[]; + + static JSClassRef m_jsClassRef; + + /** + * The calendar object to be used for asynchronous platform function invocation. + */ + static ICalendarPtr m_calendar; + + /** + * The callback invoked when an object is first created. + */ + static void initialize(JSContextRef context, + JSObjectRef object); + + /** + * The callback invoked when an object is finalized. + */ + static void finalize(JSObjectRef object); + + /** + * Expand event instances from a recurring event + */ + static JSValueRef expandRecurrence(JSContextRef context, + JSObjectRef object, + JSObjectRef thisObject, + size_t argumentCount, + const JSValueRef arguments[], + JSValueRef* exception); + + /** + * Getters and setters for properties + */ + static JSValueRef getPropertyId(JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception); + static JSValueRef getPropertyIsDetached(JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception); + static JSValueRef getPropertyAvailability(JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception); + static bool setPropertyAvailability(JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef value, + JSValueRef* exception); + static JSValueRef getPropertyRecurrenceRule(JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception); + static bool setPropertyRecurrenceRule(JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef value, + JSValueRef* exception); +}; + +} +} + +#endif /* _JS_CALENDAR_EVENT_H_ */ |