e0ce14378a0288f5eb3509a967a92cab3775a7e4
[platform/core/appfw/app-core.git] / src / multiwindow_base / appcore_multiwindow_base_class.c
1 /*
2  * Copyright (c) 2017 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 #include <stdio.h>
18 #include <stdarg.h>
19 #include <errno.h>
20 #include <string.h>
21 #include <stdlib.h>
22 #include <malloc.h>
23 #include <stdbool.h>
24
25 #include <Ecore_Wayland.h>
26 #include <glib-object.h>
27 #include <glib.h>
28 #include <gio/gio.h>
29
30 #include "appcore_base.h"
31 #include "appcore_multiwindow_base.h"
32 #include "appcore_multiwindow_base_private.h"
33
34 extern appcore_multiwindow_base_context _appcore_mw_context;
35
36 static void __on_create(appcore_multiwindow_base_instance_h context, void *data)
37 {
38         appcore_multiwindow_base_class_on_create(context);
39 }
40
41 static void __on_terminate(appcore_multiwindow_base_instance_h context, void *data)
42 {
43         appcore_multiwindow_base_class_on_terminate(context);
44 }
45
46 static void __on_pause(appcore_multiwindow_base_instance_h context, void *data)
47 {
48         appcore_multiwindow_base_class_on_pause(context);
49 }
50
51 static void __on_resume(appcore_multiwindow_base_instance_h context, void *data)
52 {
53         appcore_multiwindow_base_class_on_resume(context);
54 }
55
56 EXPORT_API appcore_multiwindow_base_class appcore_multiwindow_base_class_get_default(void)
57 {
58         appcore_multiwindow_base_class cls;
59
60         cls.create = __on_create;
61         cls.terminate = __on_terminate;
62         cls.pause = __on_pause;
63         cls.resume = __on_resume;
64
65         return cls;
66 }
67
68 EXPORT_API void appcore_multiwindow_base_class_add(appcore_multiwindow_base_class cls)
69 {
70         appcore_multiwindow_base_class *c;
71
72         if (!cls.id)
73                 return;
74
75         c = malloc(sizeof(appcore_multiwindow_base_class));
76
77         if (!c)
78                 return;
79
80         *c = cls;
81         c->id = strdup(cls.id);
82         _appcore_mw_context.classes = g_list_append(_appcore_mw_context.classes, c);
83 }
84
85 EXPORT_API void appcore_multiwindow_base_class_on_create(appcore_multiwindow_base_instance_h context)
86 {
87 }
88
89 EXPORT_API void appcore_multiwindow_base_class_on_terminate(appcore_multiwindow_base_instance_h context)
90 {
91 }
92
93 EXPORT_API void appcore_multiwindow_base_class_on_pause(appcore_multiwindow_base_instance_h context)
94 {
95 }
96
97 EXPORT_API void appcore_multiwindow_base_class_on_resume(appcore_multiwindow_base_instance_h context)
98 {
99 }
100
101