1 #ifndef TOOLKIT_WINDOW_H
2 #define TOOLKIT_WINDOW_H
5 * Copyright (c) 2020 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
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>
33 class RenderSurfaceInterface;
38 typedef Dali::Rect<int> PositionSize;
49 typedef Signal< void (Window,bool) > FocusChangeSignalType;
51 class Window : public BaseHandle
54 using KeyEventSignalType = Signal< void (const KeyEvent&) >;
55 using TouchSignalType = Signal< void (const TouchEvent&) >;
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);
62 Window(const Window& handle);
63 Window& operator=(const Window& rhs);
64 Window( Window&& rhs );
65 Window& operator=( Window&& rhs );
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;
76 FocusChangeSignalType& FocusChangeSignal();
77 KeyEventSignalType& KeyEventSignal();
78 TouchSignalType& TouchSignal();
81 explicit Window( Internal::Adaptor::Window* window );
84 Internal::Adaptor::Window& GetImplementation(Dali::Window& window);
85 const Internal::Adaptor::Window& GetImplementation(const Dali::Window& window);
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;
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 );
99 EventProcessingFinishedSignalType& EventProcessingFinishedSignal( Window window );
100 KeyEventGeneratedSignalType& KeyEventGeneratedSignal( Dali::Window window );
101 WheelEventSignalType& WheelEventSignal( Window window );
102 VisibilityChangedSignalType& VisibilityChangedSignal( Window window );
107 #endif // TOOLKIT_WINDOW_H