Add move semantics to toolkit Window
[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) 2020 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 <string>
23 #include <dali/public-api/math/rect.h>
24 #include <dali/public-api/object/base-handle.h>
25 #include <dali/public-api/signals/dali-signal.h>
26 #include <dali/integration-api/scene.h>
27
28 namespace Dali
29 {
30
31 class Actor;
32 class Layer;
33 class RenderSurfaceInterface;
34 struct KeyEvent;
35 class TouchData;
36 struct WheelEvent;
37
38 typedef Dali::Rect<int> PositionSize;
39
40 namespace Internal
41 {
42 namespace Adaptor
43 {
44 class Window;
45 }
46 }
47
48 class Window;
49 typedef Signal< void (Window,bool) > FocusChangeSignalType;
50
51 class Window : public BaseHandle
52 {
53 public:
54   using KeyEventSignalType = Signal< void (const KeyEvent&) >;
55   using TouchSignalType = Signal< void (const TouchData&) >;
56
57   static Window New(PositionSize windowPosition, const std::string& name, bool isTransparent = false);
58   static Window New(PositionSize windowPosition, const std::string& name, const std::string& className, bool isTransparent = false);
59
60   Window();
61   ~Window();
62   Window(const Window& handle);
63   Window& operator=(const Window& rhs);
64   Window( Window&& rhs );
65   Window& operator=( Window&& rhs );
66
67   Integration::Scene GetScene();
68   Dali::RenderSurfaceInterface& GetRenderSurface();
69   void Add( Dali::Actor actor );
70   void Remove( Dali::Actor actor );
71   Dali::Layer GetRootLayer() const;
72   void SetBackgroundColor( const Vector4& color );
73   Vector4 GetBackgroundColor() const;
74   void Raise();
75   void Hide();
76   FocusChangeSignalType& FocusChangeSignal();
77   KeyEventSignalType& KeyEventSignal();
78   TouchSignalType& TouchSignal();
79
80 public:
81   explicit Window( Internal::Adaptor::Window* window );
82 };
83
84 Internal::Adaptor::Window& GetImplementation(Dali::Window& window);
85 const Internal::Adaptor::Window& GetImplementation(const Dali::Window& window);
86
87 namespace DevelWindow
88 {
89 typedef Signal< void () > EventProcessingFinishedSignalType;
90 typedef Signal< bool (const KeyEvent&) > KeyEventGeneratedSignalType;
91 typedef Signal< void (const WheelEvent&) > WheelEventSignalType;
92 typedef Signal< void ( Window, bool ) > VisibilityChangedSignalType;
93
94 Dali::Window Get( Actor actor );
95 Dali::Window DownCast(  BaseHandle handle );
96 void AddFrameRenderedCallback( Window window, std::unique_ptr< CallbackBase > callback, int32_t frameId );
97 void AddFramePresentedCallback( Window window, std::unique_ptr< CallbackBase > callback, int32_t frameId );
98
99 EventProcessingFinishedSignalType& EventProcessingFinishedSignal( Window window );
100 KeyEventGeneratedSignalType& KeyEventGeneratedSignal( Dali::Window window );
101 WheelEventSignalType& WheelEventSignal( Window window );
102 VisibilityChangedSignalType& VisibilityChangedSignal( Window window );
103 }
104
105 } // namespace Dali
106
107 #endif // TOOLKIT_WINDOW_H