1 #ifndef TOOLKIT_WINDOW_H
2 #define TOOLKIT_WINDOW_H
5 * Copyright (c) 2024 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali/integration-api/scene.h>
23 #include <dali/public-api/math/int-pair.h>
24 #include <dali/public-api/math/rect.h>
25 #include <dali/public-api/math/uint-16-pair.h>
26 #include <dali/public-api/object/base-handle.h>
27 #include <dali/public-api/signals/dali-signal.h>
34 class RenderSurfaceInterface;
39 typedef Dali::Rect<int> PositionSize;
47 } // namespace Internal
50 typedef Signal<void(Window, bool)> FocusChangeSignalType;
51 typedef Signal<void(Window, Uint16Pair)> ResizeSignalType;
53 class Window : public BaseHandle
56 using WindowSize = Uint16Pair;
57 using WindowPosition = Int32Pair;
59 using KeyEventSignalType = Signal<void(const KeyEvent&)>;
60 using TouchEventSignalType = Signal<void(const TouchEvent&)>;
61 using ResizeSignalType = Signal<void(Window, WindowSize)>;
63 static Window New(PositionSize windowPosition, const std::string& name, bool isTransparent = false);
64 static Window New(PositionSize windowPosition, const std::string& name, const std::string& className, bool isTransparent = false);
68 Window(const Window& handle);
69 Window& operator=(const Window& rhs);
71 Window& operator=(Window&& rhs);
72 static Window DownCast(BaseHandle handle);
74 Integration::Scene GetScene();
75 Dali::RenderSurfaceInterface& GetRenderSurface();
76 void Add(Dali::Actor actor);
77 void Remove(Dali::Actor actor);
78 Dali::Layer GetRootLayer() const;
79 void SetBackgroundColor(const Vector4& color);
80 Vector4 GetBackgroundColor() const;
84 bool IsVisible() const;
85 FocusChangeSignalType& FocusChangeSignal();
86 KeyEventSignalType& KeyEventSignal();
87 TouchEventSignalType& TouchedSignal();
88 ResizeSignalType& ResizeSignal();
89 Dali::RenderTaskList GetRenderTaskList();
92 explicit Window(Internal::Adaptor::Window* window);
95 Internal::Adaptor::Window& GetImplementation(Dali::Window& window);
96 const Internal::Adaptor::Window& GetImplementation(const Dali::Window& window);
100 typedef Signal<void()> EventProcessingFinishedSignalType;
101 typedef Signal<bool(const KeyEvent&)> KeyEventGeneratedSignalType;
102 typedef Signal<void(const WheelEvent&)> WheelEventSignalType;
103 typedef Signal<bool(const WheelEvent&)> WheelEventGeneratedSignalType;
104 typedef Signal<void(Window, bool)> VisibilityChangedSignalType;
106 Dali::Window Get(Actor actor);
107 void SetPositionSize(Window window, PositionSize positionSize);
108 int GetPhysicalOrientation(Window window);
109 void AddFrameRenderedCallback(Window window, std::unique_ptr<CallbackBase> callback, int32_t frameId);
110 void AddFramePresentedCallback(Window window, std::unique_ptr<CallbackBase> callback, int32_t frameId);
112 EventProcessingFinishedSignalType& EventProcessingFinishedSignal(Window window);
113 KeyEventGeneratedSignalType& KeyEventGeneratedSignal(Dali::Window window);
114 WheelEventSignalType& WheelEventSignal(Window window);
115 WheelEventGeneratedSignalType& WheelEventGeneratedSignal(Dali::Window window);
116 VisibilityChangedSignalType& VisibilityChangedSignal(Window window);
117 } // namespace DevelWindow
121 #endif // TOOLKIT_WINDOW_H