Add GlView
[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 class KeyEvent;
35 class TouchEvent;
36 class 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 typedef Signal< void (Window,Uint16Pair) > ResizeSignalType;
51
52 class Window : public BaseHandle
53 {
54 public:
55   using WindowSize     = Uint16Pair;
56
57   using KeyEventSignalType = Signal< void (const KeyEvent&) >;
58   using TouchEventSignalType = Signal< void (const TouchEvent&) >;
59   using ResizeSignalType      = Signal<void(Window, WindowSize)>;
60
61   static Window New(PositionSize windowPosition, const std::string& name, bool isTransparent = false);
62   static Window New(PositionSize windowPosition, const std::string& name, const std::string& className, bool isTransparent = false);
63
64   Window();
65   ~Window();
66   Window(const Window& handle);
67   Window& operator=(const Window& rhs);
68   Window( Window&& rhs );
69   Window& operator=( Window&& rhs );
70
71   Integration::Scene GetScene();
72   Dali::RenderSurfaceInterface& GetRenderSurface();
73   void Add( Dali::Actor actor );
74   void Remove( Dali::Actor actor );
75   Dali::Layer GetRootLayer() const;
76   void SetBackgroundColor( const Vector4& color );
77   Vector4 GetBackgroundColor() const;
78   void Raise();
79   void Hide();
80   bool IsVisible() const;
81   FocusChangeSignalType& FocusChangeSignal();
82   KeyEventSignalType& KeyEventSignal();
83   TouchEventSignalType& TouchedSignal();
84   ResizeSignalType& ResizeSignal();
85
86 public:
87   explicit Window( Internal::Adaptor::Window* window );
88 };
89
90 Internal::Adaptor::Window& GetImplementation(Dali::Window& window);
91 const Internal::Adaptor::Window& GetImplementation(const Dali::Window& window);
92
93 namespace DevelWindow
94 {
95 typedef Signal< void () > EventProcessingFinishedSignalType;
96 typedef Signal< bool (const KeyEvent&) > KeyEventGeneratedSignalType;
97 typedef Signal< void (const WheelEvent&) > WheelEventSignalType;
98 typedef Signal< void ( Window, bool ) > VisibilityChangedSignalType;
99
100 Dali::Window Get( Actor actor );
101 Dali::Window DownCast(  BaseHandle handle );
102 void SetPositionSize(Window window, PositionSize positionSize);
103 int GetPhysicalOrientation(Window window);
104 void AddFrameRenderedCallback( Window window, std::unique_ptr< CallbackBase > callback, int32_t frameId );
105 void AddFramePresentedCallback( Window window, std::unique_ptr< CallbackBase > callback, int32_t frameId );
106
107 EventProcessingFinishedSignalType& EventProcessingFinishedSignal( Window window );
108 KeyEventGeneratedSignalType& KeyEventGeneratedSignal( Dali::Window window );
109 WheelEventSignalType& WheelEventSignal( Window window );
110 VisibilityChangedSignalType& VisibilityChangedSignal( Window window );
111 }
112
113 } // namespace Dali
114
115 #endif // TOOLKIT_WINDOW_H