2 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #include "app-core-ui-cpp/app_core_ui_delegator_private.hh"
21 AppCoreUiDelegator::AppCoreUiDelegator(app_core_ui_base_ops ops,
23 : ops_(ops), base_(base) {
26 int AppCoreUiDelegator::OnReceive(aul_type type, tizen_base::Bundle b) {
27 if (ops_.base.receive)
28 return ops_.base.receive(type, b.GetHandle(), base_);
32 int AppCoreUiDelegator::OnCreate() {
34 return ops_.base.create(base_);
38 int AppCoreUiDelegator::OnControl(tizen_base::Bundle b) {
39 if (ops_.base.control)
40 return ops_.base.control(b.GetHandle(), base_);
44 int AppCoreUiDelegator::OnTerminate() {
45 if (ops_.base.terminate)
46 return ops_.base.terminate(base_);
50 int AppCoreUiDelegator::OnSetI18n() {
51 if (ops_.base.set_i18n)
52 return ops_.base.set_i18n(base_);
56 int AppCoreUiDelegator::OnSetEvent(IEvent::Type event) {
57 if (ops_.base.set_event)
58 ops_.base.set_event(static_cast<app_core_ui_base_event_e>(event), base_);
62 int AppCoreUiDelegator::OnUnsetEvent(IEvent::Type event) {
63 if (ops_.base.unset_event)
64 ops_.base.unset_event(static_cast<app_core_ui_base_event_e>(event), base_);
68 int AppCoreUiDelegator::OnTrimMemory() {
69 if (ops_.base.trim_memory)
70 ops_.base.trim_memory(base_);
74 void AppCoreUiDelegator::OnLoopInit(int argc, char** argv) {
76 ops_.base.init(argc, argv, base_);
79 void AppCoreUiDelegator::OnLoopFinish() {
81 ops_.base.finish(base_);
84 void AppCoreUiDelegator::OnLoopRun() {
89 void AppCoreUiDelegator::OnLoopExit() {
91 ops_.base.exit(base_);
94 int AppCoreUiDelegator::OnPause() {
96 return ops_.pause(base_);
100 int AppCoreUiDelegator::OnResume() {
102 return ops_.resume(base_);
106 void AppCoreUiDelegator::OnShow(int type, void* event) {
107 if (ops_.window.show)
108 ops_.window.show(type, event, base_);
111 void AppCoreUiDelegator::OnHide(int type, void* event) {
112 if (ops_.window.hide)
113 ops_.window.hide(type, event, base_);
116 void AppCoreUiDelegator::OnLower(int type, void* event) {
117 if (ops_.window.lower)
118 ops_.window.lower(type, event, base_);
121 void AppCoreUiDelegator::OnVisibility(int type, void* event) {
122 if (ops_.window.visibility)
123 ops_.window.visibility(type, event, base_);
126 void AppCoreUiDelegator::OnPreVisibility(int type, void* event) {
127 if (ops_.window.pre_visibility)
128 ops_.window.pre_visibility(type, event, base_);
131 void AppCoreUiDelegator::OnAuxMessage(int type, void* event) {
132 if (ops_.window.aux_message)
133 ops_.window.aux_message(type, event, base_);
136 } // namespace tizen_cpp