2 * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
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 #ifndef WIDGET_BASE_HH_
18 #define WIDGET_BASE_HH_
20 #include <app_common.h>
25 #include <app_core_multi_window_base.hh>
28 #define EXPORT_API __attribute__((visibility("default")))
33 class EXPORT_API WidgetBase : public AppCoreMultiWindowBase {
36 virtual ~WidgetBase();
38 std::string GetViewerEndpoint();
39 void Run(int argc, char** argv) override;
41 int OnControl(tizen_base::Bundle b) override;
42 int OnCreate() override;
43 int OnTerminate() override;
44 int OnReceive(aul_type type, tizen_base::Bundle b) override;
45 void ExitContext(std::shared_ptr<Context> context) override;
48 void Dispose() override;
51 friend class WidgetContext;
53 std::unique_ptr<Impl> impl_;
56 class EXPORT_API WidgetContext : public AppCoreMultiWindowBase::Context {
58 enum class DestroyType {
63 WidgetContext(std::string context_id, std::string inst_id,
64 AppCoreMultiWindowBase* app);
65 virtual ~WidgetContext();
66 virtual bool OnCreate(const tizen_base::Bundle& contents, int w, int h) = 0;
67 virtual void OnDestroy(DestroyType reason,
68 const tizen_base::Bundle& contents) = 0;
69 virtual void OnPause();
70 virtual void OnResume();
71 virtual void OnResize(int w, int h);
72 virtual void OnUpdate(const tizen_base::Bundle& contents, bool force);
74 int SetContents(const tizen_base::Bundle& contents);
75 int WindowBind(std::string id, Ecore_Wl2_Window* wl_win);
78 using AppCoreMultiWindowBase::Context::WindowBind;
79 void OnCreate() override;
80 void OnTerminate() override;
83 friend class WidgetBase;
85 std::unique_ptr<Impl> impl_;
88 } // namespace tizen_cpp
90 #endif // WIDGET_BASE_HH_