000923acb52d2357cedc126edfe98949df245833
[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
65   Integration::Scene GetScene();
66   Dali::RenderSurfaceInterface& GetRenderSurface();
67   void Add( Dali::Actor actor );
68   void Remove( Dali::Actor actor );
69   Dali::Layer GetRootLayer() const;
70   void SetBackgroundColor( const Vector4& color );
71   Vector4 GetBackgroundColor() const;
72   void Raise();
73   void Hide();
74   FocusChangeSignalType& FocusChangeSignal();
75   KeyEventSignalType& KeyEventSignal();
76   TouchSignalType& TouchSignal();
77
78 public:
79   explicit Window( Internal::Adaptor::Window* window );
80 };
81
82 Internal::Adaptor::Window& GetImplementation(Dali::Window& window);
83 const Internal::Adaptor::Window& GetImplementation(const Dali::Window& window);
84
85 namespace DevelWindow
86 {
87 typedef Signal< void () > EventProcessingFinishedSignalType;
88 typedef Signal< bool (const KeyEvent&) > KeyEventGeneratedSignalType;
89 typedef Signal< void (const WheelEvent&) > WheelEventSignalType;
90 typedef Signal< void ( Window, bool ) > VisibilityChangedSignalType;
91
92 Dali::Window Get( Actor actor );
93 Dali::Window DownCast(  BaseHandle handle );
94 void AddFrameRenderedCallback( Window window, std::unique_ptr< CallbackBase > callback, int32_t frameId );
95 void AddFramePresentedCallback( Window window, std::unique_ptr< CallbackBase > callback, int32_t frameId );
96
97 EventProcessingFinishedSignalType& EventProcessingFinishedSignal( Window window );
98 KeyEventGeneratedSignalType& KeyEventGeneratedSignal( Dali::Window window );
99 WheelEventSignalType& WheelEventSignal( Window window );
100 VisibilityChangedSignalType& VisibilityChangedSignal( Window window );
101 }
102
103 } // namespace Dali
104
105 #endif // TOOLKIT_WINDOW_H