1 #ifndef DALI_INTERNAL_WINDOW_SYSTEM_COMMON_WINDOW_SYSTEM_H
2 #define DALI_INTERNAL_WINDOW_SYSTEM_COMMON_WINDOW_SYSTEM_H
5 * Copyright (c) 2023 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.
22 #include <dali/public-api/object/any.h>
31 namespace WindowSystem
34 * @brief Initialize a window system
39 * @brief Shutdown a window system
44 * @brief Get the screen size
46 void GetScreenSize(int32_t& width, int32_t& height);
49 * @brief Update the screen size
50 * @note The screen size may be updated while application is running. So update the stored size.
52 void UpdateScreenSize();
55 * @copydoc Dali::Keyboard::SetRepeatInfo()
57 bool SetKeyboardRepeatInfo(float rate, float delay);
60 * @copydoc Dali::Keyboard::GetRepeatInfo()
62 bool GetKeyboardRepeatInfo(float& rate, float& delay);
64 } // namespace WindowSystem
67 * Base class for window system. The minimal set of events and properties that should be received/set on the window
69 class WindowSystemBase
73 * Event types that can be received from the window manager for a given window
96 * Base ptr for events - implementation can downcast to platform specific event structure
103 * Callback function signature. Platform implementation can call generic handler on a given window
105 using EventHandlerCallback = bool (*)(void* data, Event eventType, EventBase* event);
108 * Struct to define an event handler in a window implementation
112 EventHandlerCallback callback; ///< User callback.
113 void* data; ///< user data
114 Event event; ///< Event the handler is listening to
115 int handlerId; ///< Id of the handler
119 * @return Get the current display of this application
121 virtual Dali::Any GetDisplay() = 0;
124 * Add an event handler to the window system
125 * @param event The window system event to listen for
126 * @param callback A callback to handle the event
127 * @param data User data to pass to the callback
128 * @return A handler object that may be passed to DeleteEventHandler.
130 * When the callback is executed, if it returns true, then the invoker will stop calling
131 * other event handlers that have registered with that event type. If it returns false,
132 * then it will continue with other registered handlers.
134 virtual EventHandler* AddEventHandler(Event event, EventHandlerCallback callback, void* data) = 0;
137 * Delete an event handler from the window system.
138 * @param eventHandler The event handler to delete.
140 virtual void DeleteEventHandler(EventHandler* eventHandler) = 0;
143 * Get the screen size for this window system.
145 * @param[out] width The width of the screen
146 * @param[out] height The height of the screen
148 virtual void GetScreenSize(int32_t& width, int32_t& height) = 0;
151 } // namespace Adaptor
152 } // namespace Internal
155 #endif // DALI_INTERNAL_WINDOW_SYSTEM_COMMON_WINDOW_SYSTEM_H