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;
50 typedef Signal< void (Window,Uint16Pair) > ResizeSignalType;
52 class Window : public BaseHandle
55 using WindowSize = Uint16Pair;
57 using KeyEventSignalType = Signal< void (const KeyEvent&) >;
58 using TouchEventSignalType = Signal< void (const TouchEvent&) >;
59 using ResizeSignalType = Signal<void(Window, WindowSize)>;
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);
66 Window(const Window& handle);
67 Window& operator=(const Window& rhs);
68 Window( Window&& rhs );
69 Window& operator=( Window&& rhs );
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;
80 FocusChangeSignalType& FocusChangeSignal();
81 KeyEventSignalType& KeyEventSignal();
82 TouchEventSignalType& TouchedSignal();
83 ResizeSignalType& ResizeSignal();
86 explicit Window( Internal::Adaptor::Window* window );
89 Internal::Adaptor::Window& GetImplementation(Dali::Window& window);
90 const Internal::Adaptor::Window& GetImplementation(const Dali::Window& window);
94 typedef Signal< void () > EventProcessingFinishedSignalType;
95 typedef Signal< bool (const KeyEvent&) > KeyEventGeneratedSignalType;
96 typedef Signal< void (const WheelEvent&) > WheelEventSignalType;
97 typedef Signal< void ( Window, bool ) > VisibilityChangedSignalType;
99 Dali::Window Get( Actor actor );
100 Dali::Window DownCast( BaseHandle handle );
101 void SetPositionSize(Window window, PositionSize positionSize);
102 int GetPhysicalOrientation(Window window);
103 void AddFrameRenderedCallback( Window window, std::unique_ptr< CallbackBase > callback, int32_t frameId );
104 void AddFramePresentedCallback( Window window, std::unique_ptr< CallbackBase > callback, int32_t frameId );
106 EventProcessingFinishedSignalType& EventProcessingFinishedSignal( Window window );
107 KeyEventGeneratedSignalType& KeyEventGeneratedSignal( Dali::Window window );
108 WheelEventSignalType& WheelEventSignal( Window window );
109 VisibilityChangedSignalType& VisibilityChangedSignal( Window window );
114 #endif // TOOLKIT_WINDOW_H