Modify window position data type
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / dali-toolkit-test-utils / toolkit-window.h
1 #ifndef TOOLKIT_WINDOW_H
2 #define TOOLKIT_WINDOW_H
3
4 /*
5  * Copyright (c) 2022 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  */
20
21 //EXTERNAL INCLUDES
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>
28 #include <string>
29
30 namespace Dali
31 {
32 class Actor;
33 class Layer;
34 class RenderSurfaceInterface;
35 class KeyEvent;
36 class TouchEvent;
37 class WheelEvent;
38
39 typedef Dali::Rect<int> PositionSize;
40
41 namespace Internal
42 {
43 namespace Adaptor
44 {
45 class Window;
46 }
47 } // namespace Internal
48
49 class Window;
50 typedef Signal<void(Window, bool)>       FocusChangeSignalType;
51 typedef Signal<void(Window, Uint16Pair)> ResizeSignalType;
52
53 class Window : public BaseHandle
54 {
55 public:
56   using WindowSize     = Uint16Pair;
57   using WindowPosition = Int32Pair;
58
59   using KeyEventSignalType   = Signal<void(const KeyEvent&)>;
60   using TouchEventSignalType = Signal<void(const TouchEvent&)>;
61   using ResizeSignalType     = Signal<void(Window, WindowSize)>;
62
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);
65
66   Window();
67   ~Window();
68   Window(const Window& handle);
69   Window& operator=(const Window& rhs);
70   Window(Window&& rhs);
71   Window& operator=(Window&& rhs);
72
73   Integration::Scene            GetScene();
74   Dali::RenderSurfaceInterface& GetRenderSurface();
75   void                          Add(Dali::Actor actor);
76   void                          Remove(Dali::Actor actor);
77   Dali::Layer                   GetRootLayer() const;
78   void                          SetBackgroundColor(const Vector4& color);
79   Vector4                       GetBackgroundColor() const;
80   void                          Raise();
81   void                          Hide();
82   bool                          IsVisible() const;
83   FocusChangeSignalType&        FocusChangeSignal();
84   KeyEventSignalType&           KeyEventSignal();
85   TouchEventSignalType&         TouchedSignal();
86   ResizeSignalType&             ResizeSignal();
87
88 public:
89   explicit Window(Internal::Adaptor::Window* window);
90 };
91
92 Internal::Adaptor::Window&       GetImplementation(Dali::Window& window);
93 const Internal::Adaptor::Window& GetImplementation(const Dali::Window& window);
94
95 namespace DevelWindow
96 {
97 typedef Signal<void()>                  EventProcessingFinishedSignalType;
98 typedef Signal<bool(const KeyEvent&)>   KeyEventGeneratedSignalType;
99 typedef Signal<void(const WheelEvent&)> WheelEventSignalType;
100 typedef Signal<bool(const WheelEvent&)> WheelEventGeneratedSignalType;
101 typedef Signal<void(Window, bool)>      VisibilityChangedSignalType;
102
103 Dali::Window Get(Actor actor);
104 Dali::Window DownCast(BaseHandle handle);
105 void         SetPositionSize(Window window, PositionSize positionSize);
106 int          GetPhysicalOrientation(Window window);
107 void         AddFrameRenderedCallback(Window window, std::unique_ptr<CallbackBase> callback, int32_t frameId);
108 void         AddFramePresentedCallback(Window window, std::unique_ptr<CallbackBase> callback, int32_t frameId);
109
110 EventProcessingFinishedSignalType& EventProcessingFinishedSignal(Window window);
111 KeyEventGeneratedSignalType&       KeyEventGeneratedSignal(Dali::Window window);
112 WheelEventSignalType&              WheelEventSignal(Window window);
113 WheelEventGeneratedSignalType&     WheelEventGeneratedSignal(Dali::Window window);
114 VisibilityChangedSignalType&       VisibilityChangedSignal(Window window);
115 } // namespace DevelWindow
116
117 } // namespace Dali
118
119 #endif // TOOLKIT_WINDOW_H