310665bb49db9998c7df8b35056a9cbef5bd41d8
[platform/core/appfw/app-core.git] / tizen-cpp / app-core-ui-cpp / app_core_ui_base.hh
1 /*
2  * Copyright (c) 2021 Samsung Electronics Co., Ltd.
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_CPP_APP_CORE_UI_BASE_HH_
18 #define TIZEN_CPP_APP_CORE_UI_CPP_APP_CORE_UI_BASE_HH_
19
20 #include <memory>
21
22 #include <app_core_base.hh>
23 #include <app_core_task_base.hh>
24 #include <interface_app_core_ui.hh>
25 #include <interface_window.hh>
26
27 #undef EXPORT_API
28 #define EXPORT_API __attribute__((visibility("default")))
29
30 namespace tizen_cpp {
31
32 class EXPORT_API AppCoreUiBase : public AppCoreBase,
33                                  public IAppCoreUi,
34                                  public IWindow {
35  public:
36   constexpr static int HINT_WINDOW_GROUP_CONTROL = 0x1;
37   constexpr static int HINT_WINDOW_STACK_CONTROL = 0x2;
38   constexpr static int HINT_BG_LAUNCH_CONTROL = 0x4;
39   constexpr static int HINT_HW_ACC_CONTROL = 0x8;
40   constexpr static int HINT_WINDOW_AUTO_CONTROL = 0x10;
41   constexpr static int HINT_LEGACY_CONTROL = 0x20;
42   constexpr static int HINT_WINDOW_ID_CONTROL = 0x40;
43   constexpr static int HINT_DUAL_THREAD = 0x80;
44
45   AppCoreUiBase(unsigned int hint);
46   virtual ~AppCoreUiBase();
47
48   int OnPause() override;
49   int OnResume() override;
50   int OnReceive(aul_type type, tizen_base::Bundle b) override;
51   int OnCreate() override;
52   int OnTerminate() override;
53   int OnTrimMemory() override;
54   void OnShow(int type, void* event) override;
55   void OnHide(int type, void* event) override;
56   void OnLower(int type, void* event) override;
57   void OnVisibility(int type, void* event) override;
58   void OnPreVisibility(int type, void* event) override;
59   void OnAuxMessage(int type, void* event) override;
60   void Pause();
61   void Resume();
62   bool IsResumed();
63   int GroupAdd();
64   void GroupRemove();
65   unsigned int GetMainWindow();
66   unsigned int GetMainSurface();
67   int GetHint();
68   bool GetBgState();
69   void SetBgState(bool bg_state);
70   void SetSystemResourceReclaiming(bool enable);
71   void Run(int argc, char** argv) override;
72   void Dispose() override;
73   virtual std::unique_ptr<AppCoreTaskBase> CreateTask();
74   void Exit() override;
75
76  protected:
77   void SetCoreUiDelegator(IAppCoreUi* delegator);
78   void SetWindowDelegator(IWindow* delegator);
79
80  private:
81   void DoRun(int argc, char** argv);
82   void DoExit();
83
84  private:
85   class Impl;
86   std::unique_ptr<Impl> impl_;
87 };
88
89 }  // namespace tizen_cpp
90
91 #endif  // TIZEN_CPP_APP_CORE_UI_CPP_APP_CORE_UI_BASE_HH_