1 #ifndef DALI_INTERNAL_WINDOW_SYSTEM_COMMON_WINDOW_SYSTEM_H
2 #define DALI_INTERNAL_WINDOW_SYSTEM_COMMON_WINDOW_SYSTEM_H
5 * Copyright (c) 2022 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.
21 #include <dali/public-api/object/any.h>
29 namespace WindowSystem
32 * @brief Initialize a window system
37 * @brief Shutdown a window system
42 * @brief Get the screen size
44 void GetScreenSize(int& width, int& height);
47 * @copydoc Dali::Keyboard::SetRepeatInfo()
49 bool SetKeyboardRepeatInfo(float rate, float delay);
52 * @copydoc Dali::Keyboard::GetRepeatInfo()
54 bool GetKeyboardRepeatInfo(float& rate, float& delay);
56 } // namespace WindowSystem
59 * Base class for window system. The minimal set of events and properties that should be received/set on the window
61 class WindowSystemBase
65 * Event types that can be received from the window manager for a given window
87 * Base ptr for events - implementation can downcast to platform specific event structure
94 * Callback function signature. Platform implementation can call generic handler on a given window
96 using EventHandlerCallback = bool (*)(void* data, Event eventType, EventBase* event);
99 * Struct to define an event handler in a window implementation
103 EventHandlerCallback callback; ///< User callback.
104 void* data; ///< user data
105 Event event; ///< Event the handler is listening to
106 int handlerId; ///< Id of the handler
110 * @return Get the current display of this application
112 virtual Dali::Any GetDisplay() = 0;
115 * Add an event handler to the window system
116 * @param event The window system event to listen for
117 * @param callback A callback to handle the event
118 * @param data User data to pass to the callback
119 * @return A handler object that may be passed to DeleteEventHandler.
121 * When the callback is executed, if it returns true, then the invoker will stop calling
122 * other event handlers that have registered with that event type. If it returns false,
123 * then it will continue with other registered handlers.
125 virtual EventHandler* AddEventHandler(Event event, EventHandlerCallback callback, void* data) = 0;
128 * Delete an event handler from the window system.
129 * @param eventHandler The event handler to delete.
131 virtual void DeleteEventHandler(EventHandler* eventHandler) = 0;
134 * Get the screen size for this window system.
136 * @param[out] width The width of the screen
137 * @param[out] height The height of the screen
139 virtual void GetScreenSize(int& width, int& height) = 0;
142 } // namespace Adaptor
143 } // namespace Internal
146 #endif // DALI_INTERNAL_WINDOW_SYSTEM_COMMON_WINDOW_SYSTEM_H