Modify AppCoreUiThreadBase class
[platform/core/appfw/app-core.git] / tizen-cpp / app-core-ui-cpp / appcore_ui_base.h
1 /*
2  * Copyright (c) 2021 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 #ifndef TIZEN_CPP_APP_CORE_UI_BASE_H_
18 #define TIZEN_CPP_APP_CORE_UI_BASE_H_
19
20 #include <libintl.h>
21 #include <bundle.h>
22 #include <aul.h>
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27
28 enum appcore_base_event {
29         APPCORE_BASE_EVENT_START,
30         APPCORE_BASE_EVENT_LOW_MEMORY,
31         APPCORE_BASE_EVENT_LOW_BATTERY,
32         APPCORE_BASE_EVENT_LANG_CHANGE,
33         APPCORE_BASE_EVENT_DEVICE_ORIENTATION_CHANGED,
34         APPCORE_BASE_EVENT_REGION_CHANGE,
35         APPCORE_BASE_EVENT_SUSPENDED_STATE_CHANGE,
36         APPCORE_BASE_EVENT_UPDATE_REQUESTED,
37         APPCORE_BASE_EVENT_MAX,
38 };
39
40 typedef struct _appcore_base_ops {
41         int (*create) (void *data);
42         int (*terminate) (void *data);
43         int (*control) (bundle *b, void *data);
44         int (*receive)(aul_type type, bundle *b, void *data);
45         int (*set_i18n)(void *data);
46         void (*init)(int argc, char **argv, void *data);
47         void (*finish)(void* data);
48         void (*run)(void *data);
49         void (*exit)(void *data);
50         void (*set_event)(enum appcore_base_event event, void *data);
51         void (*unset_event)(enum appcore_base_event event, void *data);
52         void (*trim_memory)(void *data);
53 } appcore_base_ops;
54
55 typedef struct _appcore_ui_base_window_ops {
56         void (*show)(int type, void *event, void *data);
57         void (*hide)(int type, void *event, void *data);
58         void (*lower)(int type, void *event, void *data);
59         void (*visibility)(int type, void *event, void *data);
60         void (*pre_visibility)(int type, void *event, void *data);
61         void (*aux_message)(int type, void *event, void *data);
62 } appcore_ui_base_window_ops;
63
64 typedef struct _appcore_ui_base_ops {
65         int (*pause) (void *data);
66         int (*resume) (void *data);
67         appcore_base_ops base;
68         appcore_ui_base_window_ops window;
69 } appcore_ui_base_ops;
70
71 enum appcore_ui_base_hint {
72         APPCORE_UI_BASE_HINT_WINDOW_GROUP_CONTROL = 0x1,
73         APPCORE_UI_BASE_HINT_WINDOW_STACK_CONTROL = 0x2,
74         APPCORE_UI_BASE_HINT_BG_LAUNCH_CONTROL = 0x4,
75         APPCORE_UI_BASE_HINT_HW_ACC_CONTROL = 0x8,
76         APPCORE_UI_BASE_HINT_WINDOW_AUTO_CONTROL = 0x10,
77         APPCORE_UI_BASE_HINT_LEGACY_CONTROL = 0x20,
78         APPCORE_UI_BASE_HINT_WINDOW_ID_CONTROL = 0x40,
79 };
80
81 int appcore_ui_base_on_receive(aul_type type, bundle *b);
82 int appcore_ui_base_on_create(void);
83 int appcore_ui_base_on_terminate(void);
84 int appcore_ui_base_on_pause(void);
85 int appcore_ui_base_on_resume(void);
86 int appcore_ui_base_on_control(bundle *b);
87 int appcore_ui_base_on_trim_memory(void);
88 void appcore_ui_base_window_on_show(int type, void *event);
89 void appcore_ui_base_window_on_hide(int type, void *event);
90 void appcore_ui_base_window_on_lower(int type, void *event);
91 void appcore_ui_base_window_on_visibility(int type, void *event);
92 void appcore_ui_base_window_on_pre_visibility(int type, void *event);
93 void appcore_ui_base_window_on_aux_message(int type, void *event);
94 int appcore_ui_base_on_set_i18n(void);
95 void appcore_ui_base_on_set_event(enum appcore_base_event event);
96 void appcore_ui_base_on_unset_event(enum appcore_base_event event);
97 int appcore_ui_base_init(appcore_ui_base_ops ops, int argc, char **argv,
98                 void *data, unsigned int hint);
99 void appcore_ui_base_fini(void);
100 appcore_ui_base_ops appcore_ui_base_get_default_ops(void);
101 void appcore_ui_base_pause(void);
102 void appcore_ui_base_resume(void);
103 bool appcore_ui_base_is_resumed(void);
104 void appcore_ui_base_exit(void);
105 int appcore_ui_base_group_add();
106 void appcore_ui_base_group_remove();
107 unsigned int appcore_ui_base_get_main_window(void);
108 unsigned int appcore_ui_base_get_main_surface(void);
109 int appcore_ui_base_get_hint(void);
110 bool appcore_ui_base_get_bg_state(void);
111 void appcore_ui_base_set_bg_state(bool bg_state);
112 void appcore_ui_base_set_system_resource_reclaiming(bool enable);
113
114 #ifdef __cplusplus
115 }
116 #endif
117
118 #endif  // TIZEN_CPP_APP_CORE_UI_BASE_H_