[Tizen] Connect KeyEventGeneratedSignal for Get KeyEvent
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / dali-toolkit-test-utils / toolkit-window.cpp
1 /*
2  * Copyright (c) 2019 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 // EXTERNAL INCLUDES
19 #include <dali/public-api/actors/actor.h>
20 #include <dali/public-api/actors/layer.h>
21 #include <dali/public-api/common/stage.h>
22 #include <dali/public-api/object/base-object.h>
23 #include <dali/devel-api/common/stage-devel.h>
24
25 // INTERNAL INCLUDES
26 #include "toolkit-window.h"
27
28 namespace Dali
29 {
30
31 class Window;
32
33 /********************************************************************************
34  * Stub for Dali::Internal::Adaptor::Window
35  ********************************************************************************/
36
37 namespace Internal
38 {
39 namespace Adaptor
40 {
41
42 class Window : public Dali::BaseObject
43 {
44 public:
45
46   Window()
47   {
48   }
49
50   virtual ~Window()
51   {
52   }
53
54   static Window* New(const PositionSize& positionSize, const std::string& name, const std::string& className, bool isTransparent)
55   {
56     return new Window();
57   }
58
59   static Dali::Window Get( Dali::Actor actor )
60   {
61     return Dali::Window();
62   }
63 };
64
65 } // Adaptor
66 } // Internal
67
68 Window::Window()
69 {
70 }
71
72 Window::~Window()
73 {
74 }
75
76 Dali::Window Window::New( PositionSize windowPosition, const std::string& name, bool isTransparent )
77 {
78   Internal::Adaptor::Window* window = Internal::Adaptor::Window::New( windowPosition, name, "", isTransparent );
79   return Window( window );
80 }
81
82 Dali::Window Window::New(PositionSize windowPosition, const std::string& name, const std::string& className, bool isTransparent )
83 {
84   Internal::Adaptor::Window* window = Internal::Adaptor::Window::New( windowPosition, name, className, isTransparent );
85   return Window( window );
86 }
87
88 Dali::Layer Window::GetRootLayer() const
89 {
90   return Dali::Stage::GetCurrent().GetRootLayer();
91 }
92
93 Window::Window( Internal::Adaptor::Window* window )
94 : BaseHandle( window )
95 {
96 }
97
98 namespace DevelWindow
99 {
100
101 Window Get( Actor actor )
102 {
103   return Internal::Adaptor::Window::Get( actor );
104 }
105
106 KeyEventSignalType& KeyEventSignal( Window window )
107 {
108   return Dali::Stage::GetCurrent().KeyEventSignal();
109 }
110
111 KeyEventGeneratedSignalType& KeyEventGeneratedSignal( Window window )
112 {
113   return DevelStage::KeyEventGeneratedSignal( Dali::Stage::GetCurrent() );
114 }
115
116 TouchSignalType& TouchSignal( Window window )
117 {
118   return Dali::Stage::GetCurrent().TouchSignal();
119 }
120
121 } // namespace DevelWindow
122
123 } // Dali