| 
									
										
										
										
											2023-01-05 13:25:55 +01:00
										 |  |  | /**************************************************************************/ | 
					
						
							|  |  |  | /*  display_server.h                                                      */ | 
					
						
							|  |  |  | /**************************************************************************/ | 
					
						
							|  |  |  | /*                         This file is part of:                          */ | 
					
						
							|  |  |  | /*                             GODOT ENGINE                               */ | 
					
						
							|  |  |  | /*                        https://godotengine.org                         */ | 
					
						
							|  |  |  | /**************************************************************************/ | 
					
						
							|  |  |  | /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ | 
					
						
							|  |  |  | /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur.                  */ | 
					
						
							|  |  |  | /*                                                                        */ | 
					
						
							|  |  |  | /* Permission is hereby granted, free of charge, to any person obtaining  */ | 
					
						
							|  |  |  | /* a copy of this software and associated documentation files (the        */ | 
					
						
							|  |  |  | /* "Software"), to deal in the Software without restriction, including    */ | 
					
						
							|  |  |  | /* without limitation the rights to use, copy, modify, merge, publish,    */ | 
					
						
							|  |  |  | /* distribute, sublicense, and/or sell copies of the Software, and to     */ | 
					
						
							|  |  |  | /* permit persons to whom the Software is furnished to do so, subject to  */ | 
					
						
							|  |  |  | /* the following conditions:                                              */ | 
					
						
							|  |  |  | /*                                                                        */ | 
					
						
							|  |  |  | /* The above copyright notice and this permission notice shall be         */ | 
					
						
							|  |  |  | /* included in all copies or substantial portions of the Software.        */ | 
					
						
							|  |  |  | /*                                                                        */ | 
					
						
							|  |  |  | /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,        */ | 
					
						
							|  |  |  | /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF     */ | 
					
						
							|  |  |  | /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ | 
					
						
							|  |  |  | /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY   */ | 
					
						
							|  |  |  | /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,   */ | 
					
						
							|  |  |  | /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE      */ | 
					
						
							|  |  |  | /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                 */ | 
					
						
							|  |  |  | /**************************************************************************/ | 
					
						
							| 
									
										
										
										
											2020-03-01 19:14:37 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | #ifndef DISPLAY_SERVER_H
 | 
					
						
							|  |  |  | #define DISPLAY_SERVER_H
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-28 15:19:37 +02:00
										 |  |  | #include "core/input/input.h"
 | 
					
						
							| 
									
										
										
										
											2020-11-07 19:33:38 -03:00
										 |  |  | #include "core/io/resource.h"
 | 
					
						
							| 
									
										
										
										
											2020-03-01 19:14:37 -03:00
										 |  |  | #include "core/os/os.h"
 | 
					
						
							| 
									
										
										
										
											2020-11-07 19:33:38 -03:00
										 |  |  | #include "core/variant/callable.h"
 | 
					
						
							| 
									
										
										
										
											2020-03-01 19:14:37 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-26 10:18:08 +02:00
										 |  |  | #include "display/native_menu.h"
 | 
					
						
							| 
									
										
										
										
											2024-01-19 19:41:01 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-03-07 18:02:54 +02:00
										 |  |  | class Texture2D; | 
					
						
							| 
									
										
										
										
											2024-02-28 18:38:15 +01:00
										 |  |  | class Image; | 
					
						
							| 
									
										
										
										
											2020-03-07 18:02:54 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-03-01 19:14:37 -03:00
										 |  |  | class DisplayServer : public Object { | 
					
						
							|  |  |  | 	GDCLASS(DisplayServer, Object) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	static DisplayServer *singleton; | 
					
						
							| 
									
										
										
										
											2020-03-09 12:56:48 -03:00
										 |  |  | 	static bool hidpi_allowed; | 
					
						
							| 
									
										
										
										
											2020-03-03 10:36:29 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-01-19 19:41:01 +02:00
										 |  |  | #ifndef DISABLE_DEPRECATED
 | 
					
						
							|  |  |  | 	mutable HashMap<String, RID> menu_names; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	RID _get_rid_from_name(NativeMenu *p_nmenu, const String &p_menu_root) const; | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-07-15 16:58:21 -05:00
										 |  |  | 	LocalVector<ObjectID> additional_outputs; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-03-03 10:36:29 -03:00
										 |  |  | public: | 
					
						
							|  |  |  | 	_FORCE_INLINE_ static DisplayServer *get_singleton() { | 
					
						
							|  |  |  | 		return singleton; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2020-03-07 18:02:54 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-03-03 10:36:29 -03:00
										 |  |  | 	enum WindowMode { | 
					
						
							|  |  |  | 		WINDOW_MODE_WINDOWED, | 
					
						
							|  |  |  | 		WINDOW_MODE_MINIMIZED, | 
					
						
							|  |  |  | 		WINDOW_MODE_MAXIMIZED, | 
					
						
							| 
									
										
										
										
											2022-01-28 11:19:53 +02:00
										 |  |  | 		WINDOW_MODE_FULLSCREEN, | 
					
						
							|  |  |  | 		WINDOW_MODE_EXCLUSIVE_FULLSCREEN, | 
					
						
							| 
									
										
										
										
											2020-03-03 10:36:29 -03:00
										 |  |  | 	}; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-07-12 03:35:51 +02:00
										 |  |  | 	// Keep the VSyncMode enum values in sync with the `display/window/vsync/vsync_mode`
 | 
					
						
							|  |  |  | 	// project setting hint.
 | 
					
						
							| 
									
										
										
										
											2021-06-19 17:44:59 +02:00
										 |  |  | 	enum VSyncMode { | 
					
						
							|  |  |  | 		VSYNC_DISABLED, | 
					
						
							|  |  |  | 		VSYNC_ENABLED, | 
					
						
							|  |  |  | 		VSYNC_ADAPTIVE, | 
					
						
							|  |  |  | 		VSYNC_MAILBOX | 
					
						
							|  |  |  | 	}; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-14 12:41:04 +02:00
										 |  |  | 	enum HandleType { | 
					
						
							|  |  |  | 		DISPLAY_HANDLE, | 
					
						
							|  |  |  | 		WINDOW_HANDLE, | 
					
						
							|  |  |  | 		WINDOW_VIEW, | 
					
						
							| 
									
										
										
										
											2022-10-22 20:29:15 -05:00
										 |  |  | 		OPENGL_CONTEXT, | 
					
						
							| 
									
										
										
										
											2022-01-14 12:41:04 +02:00
										 |  |  | 	}; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-05-22 09:06:04 -03:00
										 |  |  | 	enum Context { | 
					
						
							|  |  |  | 		CONTEXT_EDITOR, | 
					
						
							|  |  |  | 		CONTEXT_PROJECTMAN, | 
					
						
							|  |  |  | 		CONTEXT_ENGINE, | 
					
						
							|  |  |  | 	}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	typedef DisplayServer *(*CreateFunction)(const String &, WindowMode, VSyncMode, uint32_t, const Point2i *, const Size2i &, int p_screen, Context, Error &r_error); | 
					
						
							| 
									
										
										
										
											2020-03-27 10:48:30 +01:00
										 |  |  | 	typedef Vector<String> (*GetRenderingDriversFunction)(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-03-03 10:36:29 -03:00
										 |  |  | private: | 
					
						
							| 
									
										
										
										
											2020-04-28 15:19:37 +02:00
										 |  |  | 	static void _input_set_mouse_mode(Input::MouseMode p_mode); | 
					
						
							|  |  |  | 	static Input::MouseMode _input_get_mouse_mode(); | 
					
						
							| 
									
										
										
										
											2020-03-03 10:36:29 -03:00
										 |  |  | 	static void _input_warp(const Vector2 &p_to_pos); | 
					
						
							| 
									
										
										
										
											2020-04-28 15:19:37 +02:00
										 |  |  | 	static Input::CursorShape _input_get_current_cursor_shape(); | 
					
						
							| 
									
										
										
										
											2022-05-03 01:43:50 +02:00
										 |  |  | 	static void _input_set_custom_mouse_cursor_func(const Ref<Resource> &, Input::CursorShape, const Vector2 &p_hostspot); | 
					
						
							| 
									
										
										
										
											2020-03-01 19:14:37 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | protected: | 
					
						
							|  |  |  | 	static void _bind_methods(); | 
					
						
							| 
									
										
										
										
											2020-03-27 10:48:30 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-06-02 22:05:21 +02:00
										 |  |  | 	static Ref<Image> _get_cursor_image_from_resource(const Ref<Resource> &p_cursor, const Vector2 &p_hotspot); | 
					
						
							| 
									
										
										
										
											2024-02-28 18:38:15 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-03-03 10:36:29 -03:00
										 |  |  | 	enum { | 
					
						
							|  |  |  | 		MAX_SERVERS = 64 | 
					
						
							|  |  |  | 	}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	struct DisplayServerCreate { | 
					
						
							|  |  |  | 		const char *name; | 
					
						
							|  |  |  | 		CreateFunction create_function; | 
					
						
							| 
									
										
										
										
											2020-03-27 10:48:30 +01:00
										 |  |  | 		GetRenderingDriversFunction get_rendering_drivers_function; | 
					
						
							| 
									
										
										
										
											2020-03-03 10:36:29 -03:00
										 |  |  | 	}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	static DisplayServerCreate server_create_functions[MAX_SERVERS]; | 
					
						
							|  |  |  | 	static int server_create_count; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-02-09 13:19:03 -03:00
										 |  |  | 	friend class RendererViewport; | 
					
						
							| 
									
										
										
										
											2020-03-01 19:14:37 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  | 	enum Feature { | 
					
						
							| 
									
										
										
										
											2024-01-19 19:41:01 +02:00
										 |  |  | #ifndef DISABLE_DEPRECATED
 | 
					
						
							| 
									
										
										
										
											2020-03-01 19:14:37 -03:00
										 |  |  | 		FEATURE_GLOBAL_MENU, | 
					
						
							| 
									
										
										
										
											2024-01-19 19:41:01 +02:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2020-03-01 19:14:37 -03:00
										 |  |  | 		FEATURE_SUBWINDOWS, | 
					
						
							|  |  |  | 		FEATURE_TOUCHSCREEN, | 
					
						
							|  |  |  | 		FEATURE_MOUSE, | 
					
						
							|  |  |  | 		FEATURE_MOUSE_WARP, | 
					
						
							|  |  |  | 		FEATURE_CLIPBOARD, | 
					
						
							|  |  |  | 		FEATURE_VIRTUAL_KEYBOARD, | 
					
						
							|  |  |  | 		FEATURE_CURSOR_SHAPE, | 
					
						
							|  |  |  | 		FEATURE_CUSTOM_CURSOR_SHAPE, | 
					
						
							|  |  |  | 		FEATURE_NATIVE_DIALOG, | 
					
						
							|  |  |  | 		FEATURE_IME, | 
					
						
							|  |  |  | 		FEATURE_WINDOW_TRANSPARENCY, | 
					
						
							|  |  |  | 		FEATURE_HIDPI, | 
					
						
							|  |  |  | 		FEATURE_ICON, | 
					
						
							|  |  |  | 		FEATURE_NATIVE_ICON, | 
					
						
							|  |  |  | 		FEATURE_ORIENTATION, | 
					
						
							| 
									
										
										
										
											2020-03-03 10:36:29 -03:00
										 |  |  | 		FEATURE_SWAP_BUFFERS, | 
					
						
							|  |  |  | 		FEATURE_KEEP_SCREEN_ON, | 
					
						
							| 
									
										
										
										
											2021-10-20 21:25:09 +02:00
										 |  |  | 		FEATURE_CLIPBOARD_PRIMARY, | 
					
						
							| 
									
										
										
										
											2021-11-04 14:33:37 +02:00
										 |  |  | 		FEATURE_TEXT_TO_SPEECH, | 
					
						
							| 
									
										
										
										
											2022-08-23 13:40:48 +03:00
										 |  |  | 		FEATURE_EXTEND_TO_TITLE, | 
					
						
							| 
									
										
										
										
											2023-02-27 20:36:13 +02:00
										 |  |  | 		FEATURE_SCREEN_CAPTURE, | 
					
						
							| 
									
										
										
										
											2023-08-03 12:45:56 +03:00
										 |  |  | 		FEATURE_STATUS_INDICATOR, | 
					
						
							| 
									
										
										
										
											2023-10-22 14:29:56 +03:00
										 |  |  | 		FEATURE_NATIVE_HELP, | 
					
						
							| 
									
										
										
										
											2024-03-26 15:18:06 +02:00
										 |  |  | 		FEATURE_NATIVE_DIALOG_INPUT, | 
					
						
							|  |  |  | 		FEATURE_NATIVE_DIALOG_FILE, | 
					
						
							| 
									
										
										
										
											2020-03-01 19:14:37 -03:00
										 |  |  | 	}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	virtual bool has_feature(Feature p_feature) const = 0; | 
					
						
							|  |  |  | 	virtual String get_name() const = 0; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-10-22 14:29:56 +03:00
										 |  |  | 	virtual void help_set_search_callbacks(const Callable &p_search_callback = Callable(), const Callable &p_action_callback = Callable()); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-01-19 19:41:01 +02:00
										 |  |  | #ifndef DISABLE_DEPRECATED
 | 
					
						
							| 
									
										
										
										
											2023-07-11 11:17:35 +03:00
										 |  |  | 	virtual void global_menu_set_popup_callbacks(const String &p_menu_root, const Callable &p_open_callback = Callable(), const Callable &p_close_callback = Callable()); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-01 12:28:16 +03:00
										 |  |  | 	virtual int global_menu_add_submenu_item(const String &p_menu_root, const String &p_label, const String &p_submenu, int p_index = -1); | 
					
						
							| 
									
										
										
										
											2022-08-31 11:11:52 +03:00
										 |  |  | 	virtual int global_menu_add_item(const String &p_menu_root, const String &p_label, const Callable &p_callback = Callable(), const Callable &p_key_callback = Callable(), const Variant &p_tag = Variant(), Key p_accel = Key::NONE, int p_index = -1); | 
					
						
							|  |  |  | 	virtual int global_menu_add_check_item(const String &p_menu_root, const String &p_label, const Callable &p_callback = Callable(), const Callable &p_key_callback = Callable(), const Variant &p_tag = Variant(), Key p_accel = Key::NONE, int p_index = -1); | 
					
						
							|  |  |  | 	virtual int global_menu_add_icon_item(const String &p_menu_root, const Ref<Texture2D> &p_icon, const String &p_label, const Callable &p_callback = Callable(), const Callable &p_key_callback = Callable(), const Variant &p_tag = Variant(), Key p_accel = Key::NONE, int p_index = -1); | 
					
						
							|  |  |  | 	virtual int global_menu_add_icon_check_item(const String &p_menu_root, const Ref<Texture2D> &p_icon, const String &p_label, const Callable &p_callback = Callable(), const Callable &p_key_callback = Callable(), const Variant &p_tag = Variant(), Key p_accel = Key::NONE, int p_index = -1); | 
					
						
							|  |  |  | 	virtual int global_menu_add_radio_check_item(const String &p_menu_root, const String &p_label, const Callable &p_callback = Callable(), const Callable &p_key_callback = Callable(), const Variant &p_tag = Variant(), Key p_accel = Key::NONE, int p_index = -1); | 
					
						
							|  |  |  | 	virtual int global_menu_add_icon_radio_check_item(const String &p_menu_root, const Ref<Texture2D> &p_icon, const String &p_label, const Callable &p_callback = Callable(), const Callable &p_key_callback = Callable(), const Variant &p_tag = Variant(), Key p_accel = Key::NONE, int p_index = -1); | 
					
						
							|  |  |  | 	virtual int global_menu_add_multistate_item(const String &p_menu_root, const String &p_label, int p_max_states, int p_default_state, const Callable &p_callback = Callable(), const Callable &p_key_callback = Callable(), const Variant &p_tag = Variant(), Key p_accel = Key::NONE, int p_index = -1); | 
					
						
							| 
									
										
										
										
											2022-08-01 12:28:16 +03:00
										 |  |  | 	virtual int global_menu_add_separator(const String &p_menu_root, int p_index = -1); | 
					
						
							| 
									
										
										
										
											2022-03-22 11:26:36 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	virtual int global_menu_get_item_index_from_text(const String &p_menu_root, const String &p_text) const; | 
					
						
							|  |  |  | 	virtual int global_menu_get_item_index_from_tag(const String &p_menu_root, const Variant &p_tag) const; | 
					
						
							| 
									
										
										
										
											2020-03-07 18:02:54 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	virtual bool global_menu_is_item_checked(const String &p_menu_root, int p_idx) const; | 
					
						
							|  |  |  | 	virtual bool global_menu_is_item_checkable(const String &p_menu_root, int p_idx) const; | 
					
						
							| 
									
										
										
										
											2022-03-22 11:26:36 +02:00
										 |  |  | 	virtual bool global_menu_is_item_radio_checkable(const String &p_menu_root, int p_idx) const; | 
					
						
							|  |  |  | 	virtual Callable global_menu_get_item_callback(const String &p_menu_root, int p_idx) const; | 
					
						
							| 
									
										
										
										
											2022-08-31 11:11:52 +03:00
										 |  |  | 	virtual Callable global_menu_get_item_key_callback(const String &p_menu_root, int p_idx) const; | 
					
						
							| 
									
										
										
										
											2022-03-22 11:26:36 +02:00
										 |  |  | 	virtual Variant global_menu_get_item_tag(const String &p_menu_root, int p_idx) const; | 
					
						
							|  |  |  | 	virtual String global_menu_get_item_text(const String &p_menu_root, int p_idx) const; | 
					
						
							|  |  |  | 	virtual String global_menu_get_item_submenu(const String &p_menu_root, int p_idx) const; | 
					
						
							|  |  |  | 	virtual Key global_menu_get_item_accelerator(const String &p_menu_root, int p_idx) const; | 
					
						
							|  |  |  | 	virtual bool global_menu_is_item_disabled(const String &p_menu_root, int p_idx) const; | 
					
						
							| 
									
										
										
										
											2023-07-11 11:17:35 +03:00
										 |  |  | 	virtual bool global_menu_is_item_hidden(const String &p_menu_root, int p_idx) const; | 
					
						
							| 
									
										
										
										
											2022-03-22 11:26:36 +02:00
										 |  |  | 	virtual String global_menu_get_item_tooltip(const String &p_menu_root, int p_idx) const; | 
					
						
							|  |  |  | 	virtual int global_menu_get_item_state(const String &p_menu_root, int p_idx) const; | 
					
						
							|  |  |  | 	virtual int global_menu_get_item_max_states(const String &p_menu_root, int p_idx) const; | 
					
						
							|  |  |  | 	virtual Ref<Texture2D> global_menu_get_item_icon(const String &p_menu_root, int p_idx) const; | 
					
						
							| 
									
										
										
										
											2022-08-01 12:28:16 +03:00
										 |  |  | 	virtual int global_menu_get_item_indentation_level(const String &p_menu_root, int p_idx) const; | 
					
						
							| 
									
										
										
										
											2020-03-07 18:02:54 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	virtual void global_menu_set_item_checked(const String &p_menu_root, int p_idx, bool p_checked); | 
					
						
							|  |  |  | 	virtual void global_menu_set_item_checkable(const String &p_menu_root, int p_idx, bool p_checkable); | 
					
						
							| 
									
										
										
										
											2022-03-22 11:26:36 +02:00
										 |  |  | 	virtual void global_menu_set_item_radio_checkable(const String &p_menu_root, int p_idx, bool p_checkable); | 
					
						
							| 
									
										
										
										
											2020-03-07 18:02:54 +02:00
										 |  |  | 	virtual void global_menu_set_item_callback(const String &p_menu_root, int p_idx, const Callable &p_callback); | 
					
						
							| 
									
										
										
										
											2022-08-31 11:11:52 +03:00
										 |  |  | 	virtual void global_menu_set_item_key_callback(const String &p_menu_root, int p_idx, const Callable &p_key_callback); | 
					
						
							| 
									
										
										
										
											2023-07-11 11:17:35 +03:00
										 |  |  | 	virtual void global_menu_set_item_hover_callbacks(const String &p_menu_root, int p_idx, const Callable &p_callback); | 
					
						
							| 
									
										
										
										
											2020-03-07 18:02:54 +02:00
										 |  |  | 	virtual void global_menu_set_item_tag(const String &p_menu_root, int p_idx, const Variant &p_tag); | 
					
						
							|  |  |  | 	virtual void global_menu_set_item_text(const String &p_menu_root, int p_idx, const String &p_text); | 
					
						
							|  |  |  | 	virtual void global_menu_set_item_submenu(const String &p_menu_root, int p_idx, const String &p_submenu); | 
					
						
							| 
									
										
										
										
											2022-03-22 11:26:36 +02:00
										 |  |  | 	virtual void global_menu_set_item_accelerator(const String &p_menu_root, int p_idx, Key p_keycode); | 
					
						
							|  |  |  | 	virtual void global_menu_set_item_disabled(const String &p_menu_root, int p_idx, bool p_disabled); | 
					
						
							| 
									
										
										
										
											2023-07-11 11:17:35 +03:00
										 |  |  | 	virtual void global_menu_set_item_hidden(const String &p_menu_root, int p_idx, bool p_hidden); | 
					
						
							| 
									
										
										
										
											2022-03-22 11:26:36 +02:00
										 |  |  | 	virtual void global_menu_set_item_tooltip(const String &p_menu_root, int p_idx, const String &p_tooltip); | 
					
						
							|  |  |  | 	virtual void global_menu_set_item_state(const String &p_menu_root, int p_idx, int p_state); | 
					
						
							|  |  |  | 	virtual void global_menu_set_item_max_states(const String &p_menu_root, int p_idx, int p_max_states); | 
					
						
							|  |  |  | 	virtual void global_menu_set_item_icon(const String &p_menu_root, int p_idx, const Ref<Texture2D> &p_icon); | 
					
						
							| 
									
										
										
										
											2022-08-01 12:28:16 +03:00
										 |  |  | 	virtual void global_menu_set_item_indentation_level(const String &p_menu_root, int p_idx, int p_level); | 
					
						
							| 
									
										
										
										
											2020-03-07 18:02:54 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	virtual int global_menu_get_item_count(const String &p_menu_root) const; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	virtual void global_menu_remove_item(const String &p_menu_root, int p_idx); | 
					
						
							|  |  |  | 	virtual void global_menu_clear(const String &p_menu_root); | 
					
						
							| 
									
										
										
										
											2020-03-01 19:14:37 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-10-15 20:52:56 +03:00
										 |  |  | 	virtual Dictionary global_menu_get_system_menu_roots() const; | 
					
						
							| 
									
										
										
										
											2024-01-19 19:41:01 +02:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2023-10-15 20:52:56 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-11-04 14:33:37 +02:00
										 |  |  | 	struct TTSUtterance { | 
					
						
							|  |  |  | 		String text; | 
					
						
							|  |  |  | 		String voice; | 
					
						
							|  |  |  | 		int volume = 50; | 
					
						
							|  |  |  | 		float pitch = 1.f; | 
					
						
							|  |  |  | 		float rate = 1.f; | 
					
						
							|  |  |  | 		int id = 0; | 
					
						
							|  |  |  | 	}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	enum TTSUtteranceEvent { | 
					
						
							|  |  |  | 		TTS_UTTERANCE_STARTED, | 
					
						
							|  |  |  | 		TTS_UTTERANCE_ENDED, | 
					
						
							|  |  |  | 		TTS_UTTERANCE_CANCELED, | 
					
						
							|  |  |  | 		TTS_UTTERANCE_BOUNDARY, | 
					
						
							|  |  |  | 		TTS_UTTERANCE_MAX, | 
					
						
							|  |  |  | 	}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							|  |  |  | 	Callable utterance_callback[TTS_UTTERANCE_MAX]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  | 	virtual bool tts_is_speaking() const; | 
					
						
							|  |  |  | 	virtual bool tts_is_paused() const; | 
					
						
							| 
									
										
										
										
											2022-08-05 03:41:48 +02:00
										 |  |  | 	virtual TypedArray<Dictionary> tts_get_voices() const; | 
					
						
							| 
									
										
										
										
											2021-11-04 14:33:37 +02:00
										 |  |  | 	virtual PackedStringArray tts_get_voices_for_language(const String &p_language) const; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	virtual void tts_speak(const String &p_text, const String &p_voice, int p_volume = 50, float p_pitch = 1.f, float p_rate = 1.f, int p_utterance_id = 0, bool p_interrupt = false); | 
					
						
							|  |  |  | 	virtual void tts_pause(); | 
					
						
							|  |  |  | 	virtual void tts_resume(); | 
					
						
							|  |  |  | 	virtual void tts_stop(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	virtual void tts_set_utterance_callback(TTSUtteranceEvent p_event, const Callable &p_callable); | 
					
						
							|  |  |  | 	virtual void tts_post_utterance_event(TTSUtteranceEvent p_event, int p_id, int p_pos = 0); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-06-02 22:05:21 +02:00
										 |  |  | 	virtual bool is_dark_mode_supported() const { return false; } | 
					
						
							|  |  |  | 	virtual bool is_dark_mode() const { return false; } | 
					
						
							| 
									
										
										
										
											2024-01-19 20:46:26 +02:00
										 |  |  | 	virtual Color get_accent_color() const { return Color(0, 0, 0, 0); } | 
					
						
							|  |  |  | 	virtual Color get_base_color() const { return Color(0, 0, 0, 0); } | 
					
						
							|  |  |  | 	virtual void set_system_theme_change_callback(const Callable &p_callable) {} | 
					
						
							| 
									
										
										
										
											2022-08-29 11:24:48 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-01-11 19:14:43 +01:00
										 |  |  | private: | 
					
						
							|  |  |  | 	static bool window_early_clear_override_enabled; | 
					
						
							|  |  |  | 	static Color window_early_clear_override_color; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | protected: | 
					
						
							|  |  |  | 	static bool _get_window_early_clear_override(Color &r_color); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  | 	static void set_early_window_clear_color_override(bool p_enabled, Color p_color = Color(0, 0, 0, 0)); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-03-01 19:14:37 -03:00
										 |  |  | 	enum MouseMode { | 
					
						
							|  |  |  | 		MOUSE_MODE_VISIBLE, | 
					
						
							|  |  |  | 		MOUSE_MODE_HIDDEN, | 
					
						
							|  |  |  | 		MOUSE_MODE_CAPTURED, | 
					
						
							| 
									
										
										
										
											2021-03-30 18:35:08 -04:00
										 |  |  | 		MOUSE_MODE_CONFINED, | 
					
						
							|  |  |  | 		MOUSE_MODE_CONFINED_HIDDEN, | 
					
						
							| 
									
										
										
										
											2020-03-01 19:14:37 -03:00
										 |  |  | 	}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	virtual void mouse_set_mode(MouseMode p_mode); | 
					
						
							|  |  |  | 	virtual MouseMode mouse_get_mode() const; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-27 11:17:36 +02:00
										 |  |  | 	virtual void warp_mouse(const Point2i &p_position); | 
					
						
							| 
									
										
										
										
											2020-03-01 19:14:37 -03:00
										 |  |  | 	virtual Point2i mouse_get_position() const; | 
					
						
							| 
									
										
										
										
											2023-01-08 00:55:54 +01:00
										 |  |  | 	virtual BitField<MouseButtonMask> mouse_get_button_state() const; | 
					
						
							| 
									
										
										
										
											2020-03-01 19:14:37 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	virtual void clipboard_set(const String &p_text); | 
					
						
							|  |  |  | 	virtual String clipboard_get() const; | 
					
						
							| 
									
										
										
										
											2022-08-02 14:05:37 +02:00
										 |  |  | 	virtual Ref<Image> clipboard_get_image() const; | 
					
						
							| 
									
										
										
										
											2022-01-19 21:04:52 +08:00
										 |  |  | 	virtual bool clipboard_has() const; | 
					
						
							| 
									
										
										
										
											2022-08-02 14:05:37 +02:00
										 |  |  | 	virtual bool clipboard_has_image() const; | 
					
						
							| 
									
										
										
										
											2021-10-12 09:43:50 +02:00
										 |  |  | 	virtual void clipboard_set_primary(const String &p_text); | 
					
						
							|  |  |  | 	virtual String clipboard_get_primary() const; | 
					
						
							| 
									
										
										
										
											2020-03-01 19:14:37 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-05 03:41:48 +02:00
										 |  |  | 	virtual TypedArray<Rect2> get_display_cutouts() const { return TypedArray<Rect2>(); } | 
					
						
							| 
									
										
										
										
											2022-04-26 11:40:57 +02:00
										 |  |  | 	virtual Rect2i get_display_safe_area() const { return screen_get_usable_rect(); } | 
					
						
							| 
									
										
										
										
											2022-04-24 21:12:22 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-03-01 19:14:37 -03:00
										 |  |  | 	enum { | 
					
						
							| 
									
										
										
										
											2023-03-21 13:08:46 +02:00
										 |  |  | 		SCREEN_WITH_MOUSE_FOCUS = -4, | 
					
						
							|  |  |  | 		SCREEN_WITH_KEYBOARD_FOCUS = -3, | 
					
						
							| 
									
										
										
										
											2023-01-05 00:00:02 +02:00
										 |  |  | 		SCREEN_PRIMARY = -2, | 
					
						
							|  |  |  | 		SCREEN_OF_MAIN_WINDOW = -1, // Note: for the main window, determine screen from position.
 | 
					
						
							| 
									
										
										
										
											2020-03-01 19:14:37 -03:00
										 |  |  | 	}; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-10 13:31:32 -06:00
										 |  |  | 	const float SCREEN_REFRESH_RATE_FALLBACK = -1.0; // Returned by screen_get_refresh_rate if the method fails.
 | 
					
						
							| 
									
										
										
										
											2022-01-27 13:46:57 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-21 13:08:46 +02:00
										 |  |  | 	int _get_screen_index(int p_screen) const { | 
					
						
							|  |  |  | 		switch (p_screen) { | 
					
						
							|  |  |  | 			case SCREEN_WITH_MOUSE_FOCUS: { | 
					
						
							|  |  |  | 				const Rect2i rect = Rect2i(mouse_get_position(), Vector2i(1, 1)); | 
					
						
							|  |  |  | 				return get_screen_from_rect(rect); | 
					
						
							|  |  |  | 			} break; | 
					
						
							|  |  |  | 			case SCREEN_WITH_KEYBOARD_FOCUS: { | 
					
						
							|  |  |  | 				return get_keyboard_focus_screen(); | 
					
						
							|  |  |  | 			} break; | 
					
						
							|  |  |  | 			case SCREEN_PRIMARY: { | 
					
						
							|  |  |  | 				return get_primary_screen(); | 
					
						
							|  |  |  | 			} break; | 
					
						
							|  |  |  | 			case SCREEN_OF_MAIN_WINDOW: { | 
					
						
							|  |  |  | 				return window_get_current_screen(MAIN_WINDOW_ID); | 
					
						
							|  |  |  | 			} break; | 
					
						
							|  |  |  | 			default: { | 
					
						
							|  |  |  | 				return p_screen; | 
					
						
							|  |  |  | 			} break; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-03-01 19:14:37 -03:00
										 |  |  | 	virtual int get_screen_count() const = 0; | 
					
						
							| 
									
										
										
										
											2023-01-05 00:00:02 +02:00
										 |  |  | 	virtual int get_primary_screen() const = 0; | 
					
						
							| 
									
										
										
										
											2023-03-21 13:08:46 +02:00
										 |  |  | 	virtual int get_keyboard_focus_screen() const { return get_primary_screen(); } | 
					
						
							| 
									
										
										
										
											2023-01-05 00:00:02 +02:00
										 |  |  | 	virtual int get_screen_from_rect(const Rect2 &p_rect) const; | 
					
						
							| 
									
										
										
										
											2020-03-01 19:14:37 -03:00
										 |  |  | 	virtual Point2i screen_get_position(int p_screen = SCREEN_OF_MAIN_WINDOW) const = 0; | 
					
						
							|  |  |  | 	virtual Size2i screen_get_size(int p_screen = SCREEN_OF_MAIN_WINDOW) const = 0; | 
					
						
							| 
									
										
										
										
											2020-03-19 23:32:09 -03:00
										 |  |  | 	virtual Rect2i screen_get_usable_rect(int p_screen = SCREEN_OF_MAIN_WINDOW) const = 0; | 
					
						
							| 
									
										
										
										
											2020-03-01 19:14:37 -03:00
										 |  |  | 	virtual int screen_get_dpi(int p_screen = SCREEN_OF_MAIN_WINDOW) const = 0; | 
					
						
							| 
									
										
										
										
											2020-03-07 18:02:54 +02:00
										 |  |  | 	virtual float screen_get_scale(int p_screen = SCREEN_OF_MAIN_WINDOW) const; | 
					
						
							| 
									
										
										
										
											2020-07-03 13:06:03 +03:00
										 |  |  | 	virtual float screen_get_max_scale() const { | 
					
						
							|  |  |  | 		float scale = 1.f; | 
					
						
							|  |  |  | 		int screen_count = get_screen_count(); | 
					
						
							|  |  |  | 		for (int i = 0; i < screen_count; i++) { | 
					
						
							|  |  |  | 			scale = fmax(scale, screen_get_scale(i)); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		return scale; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2022-01-27 13:46:57 -06:00
										 |  |  | 	virtual float screen_get_refresh_rate(int p_screen = SCREEN_OF_MAIN_WINDOW) const = 0; | 
					
						
							| 
									
										
										
										
											2024-06-02 22:05:21 +02:00
										 |  |  | 	virtual Color screen_get_pixel(const Point2i &p_position) const { return Color(); } | 
					
						
							|  |  |  | 	virtual Ref<Image> screen_get_image(int p_screen = SCREEN_OF_MAIN_WINDOW) const { return Ref<Image>(); } | 
					
						
							| 
									
										
										
										
											2022-10-17 00:59:51 +02:00
										 |  |  | 	virtual bool is_touchscreen_available() const; | 
					
						
							| 
									
										
										
										
											2021-05-21 21:29:24 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	// Keep the ScreenOrientation enum values in sync with the `display/window/handheld/orientation`
 | 
					
						
							|  |  |  | 	// project setting hint.
 | 
					
						
							| 
									
										
										
										
											2020-03-01 19:14:37 -03:00
										 |  |  | 	enum ScreenOrientation { | 
					
						
							|  |  |  | 		SCREEN_LANDSCAPE, | 
					
						
							|  |  |  | 		SCREEN_PORTRAIT, | 
					
						
							|  |  |  | 		SCREEN_REVERSE_LANDSCAPE, | 
					
						
							|  |  |  | 		SCREEN_REVERSE_PORTRAIT, | 
					
						
							|  |  |  | 		SCREEN_SENSOR_LANDSCAPE, | 
					
						
							|  |  |  | 		SCREEN_SENSOR_PORTRAIT, | 
					
						
							|  |  |  | 		SCREEN_SENSOR, | 
					
						
							|  |  |  | 	}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	virtual void screen_set_orientation(ScreenOrientation p_orientation, int p_screen = SCREEN_OF_MAIN_WINDOW); | 
					
						
							| 
									
										
										
										
											2020-03-27 17:30:18 +01:00
										 |  |  | 	virtual ScreenOrientation screen_get_orientation(int p_screen = SCREEN_OF_MAIN_WINDOW) const; | 
					
						
							| 
									
										
										
										
											2020-03-01 19:14:37 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-03-03 10:36:29 -03:00
										 |  |  | 	virtual void screen_set_keep_on(bool p_enable); //disable screensaver
 | 
					
						
							|  |  |  | 	virtual bool screen_is_kept_on() const; | 
					
						
							| 
									
										
										
										
											2020-03-01 19:14:37 -03:00
										 |  |  | 	enum { | 
					
						
							|  |  |  | 		MAIN_WINDOW_ID = 0, | 
					
						
							| 
									
										
										
										
											2023-08-03 12:45:56 +03:00
										 |  |  | 		INVALID_WINDOW_ID = -1, | 
					
						
							|  |  |  | 		INVALID_INDICATOR_ID = -1 | 
					
						
							| 
									
										
										
										
											2020-03-01 19:14:37 -03:00
										 |  |  | 	}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	typedef int WindowID; | 
					
						
							| 
									
										
										
										
											2023-08-03 12:45:56 +03:00
										 |  |  | 	typedef int IndicatorID; | 
					
						
							| 
									
										
										
										
											2020-03-01 19:14:37 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-03-24 20:15:35 -03:00
										 |  |  | 	virtual Vector<DisplayServer::WindowID> get_window_list() const = 0; | 
					
						
							| 
									
										
										
										
											2020-03-01 19:14:37 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	enum WindowFlags { | 
					
						
							|  |  |  | 		WINDOW_FLAG_RESIZE_DISABLED, | 
					
						
							|  |  |  | 		WINDOW_FLAG_BORDERLESS, | 
					
						
							|  |  |  | 		WINDOW_FLAG_ALWAYS_ON_TOP, | 
					
						
							|  |  |  | 		WINDOW_FLAG_TRANSPARENT, | 
					
						
							| 
									
										
										
										
											2020-03-20 17:51:53 -03:00
										 |  |  | 		WINDOW_FLAG_NO_FOCUS, | 
					
						
							| 
									
										
										
										
											2022-02-24 11:21:23 +02:00
										 |  |  | 		WINDOW_FLAG_POPUP, | 
					
						
							| 
									
										
										
										
											2022-08-23 13:40:48 +03:00
										 |  |  | 		WINDOW_FLAG_EXTEND_TO_TITLE, | 
					
						
							| 
									
										
										
										
											2023-01-15 12:05:25 +02:00
										 |  |  | 		WINDOW_FLAG_MOUSE_PASSTHROUGH, | 
					
						
							| 
									
										
										
										
											2020-03-01 19:14:37 -03:00
										 |  |  | 		WINDOW_FLAG_MAX, | 
					
						
							| 
									
										
										
										
											2020-04-01 15:35:00 +02:00
										 |  |  | 	}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	// Separate enum otherwise we get warnings in switches not handling all values.
 | 
					
						
							|  |  |  | 	enum WindowFlagsBit { | 
					
						
							| 
									
										
										
										
											2020-03-01 19:14:37 -03:00
										 |  |  | 		WINDOW_FLAG_RESIZE_DISABLED_BIT = (1 << WINDOW_FLAG_RESIZE_DISABLED), | 
					
						
							|  |  |  | 		WINDOW_FLAG_BORDERLESS_BIT = (1 << WINDOW_FLAG_BORDERLESS), | 
					
						
							|  |  |  | 		WINDOW_FLAG_ALWAYS_ON_TOP_BIT = (1 << WINDOW_FLAG_ALWAYS_ON_TOP), | 
					
						
							| 
									
										
										
										
											2020-03-20 17:51:53 -03:00
										 |  |  | 		WINDOW_FLAG_TRANSPARENT_BIT = (1 << WINDOW_FLAG_TRANSPARENT), | 
					
						
							| 
									
										
										
										
											2022-02-24 11:21:23 +02:00
										 |  |  | 		WINDOW_FLAG_NO_FOCUS_BIT = (1 << WINDOW_FLAG_NO_FOCUS), | 
					
						
							|  |  |  | 		WINDOW_FLAG_POPUP_BIT = (1 << WINDOW_FLAG_POPUP), | 
					
						
							| 
									
										
										
										
											2022-08-23 13:40:48 +03:00
										 |  |  | 		WINDOW_FLAG_EXTEND_TO_TITLE_BIT = (1 << WINDOW_FLAG_EXTEND_TO_TITLE), | 
					
						
							| 
									
										
										
										
											2023-01-15 12:05:25 +02:00
										 |  |  | 		WINDOW_FLAG_MOUSE_PASSTHROUGH_BIT = (1 << WINDOW_FLAG_MOUSE_PASSTHROUGH), | 
					
						
							| 
									
										
										
										
											2020-03-01 19:14:37 -03:00
										 |  |  | 	}; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-07-25 00:20:31 +08:00
										 |  |  | 	virtual WindowID create_sub_window(WindowMode p_mode, VSyncMode p_vsync_mode, uint32_t p_flags, const Rect2i &p_rect = Rect2i(), bool p_exclusive = false, WindowID p_transient_parent = INVALID_WINDOW_ID); | 
					
						
							| 
									
										
										
										
											2020-08-21 09:39:30 +02:00
										 |  |  | 	virtual void show_window(WindowID p_id); | 
					
						
							| 
									
										
										
										
											2020-03-01 19:14:37 -03:00
										 |  |  | 	virtual void delete_sub_window(WindowID p_id); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-06-02 22:05:21 +02:00
										 |  |  | 	virtual WindowID window_get_active_popup() const { return INVALID_WINDOW_ID; } | 
					
						
							|  |  |  | 	virtual void window_set_popup_safe_rect(WindowID p_window, const Rect2i &p_rect) {} | 
					
						
							|  |  |  | 	virtual Rect2i window_get_popup_safe_rect(WindowID p_window) const { return Rect2i(); } | 
					
						
							| 
									
										
										
										
											2022-02-24 11:21:23 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-14 12:41:04 +02:00
										 |  |  | 	virtual int64_t window_get_native_handle(HandleType p_handle_type, WindowID p_window = MAIN_WINDOW_ID) const; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-03-24 20:15:35 -03:00
										 |  |  | 	virtual WindowID get_window_at_screen_position(const Point2i &p_position) const = 0; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	virtual void window_attach_instance_id(ObjectID p_instance, WindowID p_window = MAIN_WINDOW_ID) = 0; | 
					
						
							|  |  |  | 	virtual ObjectID window_get_attached_instance_id(WindowID p_window = MAIN_WINDOW_ID) const = 0; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-03-14 13:06:39 -03:00
										 |  |  | 	virtual void window_set_rect_changed_callback(const Callable &p_callable, WindowID p_window = MAIN_WINDOW_ID) = 0; | 
					
						
							| 
									
										
										
										
											2020-03-04 13:36:09 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	enum WindowEvent { | 
					
						
							|  |  |  | 		WINDOW_EVENT_MOUSE_ENTER, | 
					
						
							|  |  |  | 		WINDOW_EVENT_MOUSE_EXIT, | 
					
						
							|  |  |  | 		WINDOW_EVENT_FOCUS_IN, | 
					
						
							|  |  |  | 		WINDOW_EVENT_FOCUS_OUT, | 
					
						
							|  |  |  | 		WINDOW_EVENT_CLOSE_REQUEST, | 
					
						
							|  |  |  | 		WINDOW_EVENT_GO_BACK_REQUEST, | 
					
						
							| 
									
										
										
										
											2020-03-07 18:02:54 +02:00
										 |  |  | 		WINDOW_EVENT_DPI_CHANGE, | 
					
						
							| 
									
										
										
										
											2022-09-22 12:06:11 +03:00
										 |  |  | 		WINDOW_EVENT_TITLEBAR_CHANGE, | 
					
						
							| 
									
										
										
										
											2020-03-04 13:36:09 -03:00
										 |  |  | 	}; | 
					
						
							|  |  |  | 	virtual void window_set_window_event_callback(const Callable &p_callable, WindowID p_window = MAIN_WINDOW_ID) = 0; | 
					
						
							|  |  |  | 	virtual void window_set_input_event_callback(const Callable &p_callable, WindowID p_window = MAIN_WINDOW_ID) = 0; | 
					
						
							|  |  |  | 	virtual void window_set_input_text_callback(const Callable &p_callable, WindowID p_window = MAIN_WINDOW_ID) = 0; | 
					
						
							| 
									
										
										
										
											2020-03-04 16:03:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-03-04 13:36:09 -03:00
										 |  |  | 	virtual void window_set_drop_files_callback(const Callable &p_callable, WindowID p_window = MAIN_WINDOW_ID) = 0; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-03-01 19:14:37 -03:00
										 |  |  | 	virtual void window_set_title(const String &p_title, WindowID p_window = MAIN_WINDOW_ID) = 0; | 
					
						
							| 
									
										
										
										
											2023-08-08 11:31:56 +03:00
										 |  |  | 	virtual Size2i window_get_title_size(const String &p_title, WindowID p_window = MAIN_WINDOW_ID) const { return Size2i(); } | 
					
						
							| 
									
										
										
										
											2020-03-01 19:14:37 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-06-29 12:31:36 +03:00
										 |  |  | 	virtual void window_set_mouse_passthrough(const Vector<Vector2> &p_region, WindowID p_window = MAIN_WINDOW_ID); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-03-01 19:14:37 -03:00
										 |  |  | 	virtual int window_get_current_screen(WindowID p_window = MAIN_WINDOW_ID) const = 0; | 
					
						
							|  |  |  | 	virtual void window_set_current_screen(int p_screen, WindowID p_window = MAIN_WINDOW_ID) = 0; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	virtual Point2i window_get_position(WindowID p_window = MAIN_WINDOW_ID) const = 0; | 
					
						
							| 
									
										
										
										
											2022-11-30 10:28:16 +02:00
										 |  |  | 	virtual Point2i window_get_position_with_decorations(WindowID p_window = MAIN_WINDOW_ID) const = 0; | 
					
						
							| 
									
										
										
										
											2020-03-01 19:14:37 -03:00
										 |  |  | 	virtual void window_set_position(const Point2i &p_position, WindowID p_window = MAIN_WINDOW_ID) = 0; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-03-04 16:03:30 -03:00
										 |  |  | 	virtual void window_set_transient(WindowID p_window, WindowID p_parent) = 0; | 
					
						
							| 
									
										
										
										
											2022-01-19 14:04:05 +02:00
										 |  |  | 	virtual void window_set_exclusive(WindowID p_window, bool p_exclusive); | 
					
						
							| 
									
										
										
										
											2020-03-04 16:03:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-03-01 19:14:37 -03:00
										 |  |  | 	virtual void window_set_max_size(const Size2i p_size, WindowID p_window = MAIN_WINDOW_ID) = 0; | 
					
						
							|  |  |  | 	virtual Size2i window_get_max_size(WindowID p_window = MAIN_WINDOW_ID) const = 0; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	virtual void window_set_min_size(const Size2i p_size, WindowID p_window = MAIN_WINDOW_ID) = 0; | 
					
						
							|  |  |  | 	virtual Size2i window_get_min_size(WindowID p_window = MAIN_WINDOW_ID) const = 0; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	virtual void window_set_size(const Size2i p_size, WindowID p_window = MAIN_WINDOW_ID) = 0; | 
					
						
							|  |  |  | 	virtual Size2i window_get_size(WindowID p_window = MAIN_WINDOW_ID) const = 0; | 
					
						
							| 
									
										
										
										
											2022-11-30 10:28:16 +02:00
										 |  |  | 	virtual Size2i window_get_size_with_decorations(WindowID p_window = MAIN_WINDOW_ID) const = 0; | 
					
						
							| 
									
										
										
										
											2020-03-01 19:14:37 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	virtual void window_set_mode(WindowMode p_mode, WindowID p_window = MAIN_WINDOW_ID) = 0; | 
					
						
							|  |  |  | 	virtual WindowMode window_get_mode(WindowID p_window = MAIN_WINDOW_ID) const = 0; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-19 17:44:59 +02:00
										 |  |  | 	virtual void window_set_vsync_mode(VSyncMode p_vsync_mode, WindowID p_window = MAIN_WINDOW_ID); | 
					
						
							|  |  |  | 	virtual VSyncMode window_get_vsync_mode(WindowID p_window) const; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-03-01 19:14:37 -03:00
										 |  |  | 	virtual bool window_is_maximize_allowed(WindowID p_window = MAIN_WINDOW_ID) const = 0; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	virtual void window_set_flag(WindowFlags p_flag, bool p_enabled, WindowID p_window = MAIN_WINDOW_ID) = 0; | 
					
						
							|  |  |  | 	virtual bool window_get_flag(WindowFlags p_flag, WindowID p_window = MAIN_WINDOW_ID) const = 0; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	virtual void window_request_attention(WindowID p_window = MAIN_WINDOW_ID) = 0; | 
					
						
							|  |  |  | 	virtual void window_move_to_foreground(WindowID p_window = MAIN_WINDOW_ID) = 0; | 
					
						
							| 
									
										
										
										
											2023-06-15 10:53:31 +03:00
										 |  |  | 	virtual bool window_is_focused(WindowID p_window = MAIN_WINDOW_ID) const = 0; | 
					
						
							| 
									
										
										
										
											2020-03-01 19:14:37 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-12-22 17:50:21 +01:00
										 |  |  | 	virtual WindowID get_focused_window() const; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-20 11:12:49 +03:00
										 |  |  | 	virtual void window_set_window_buttons_offset(const Vector2i &p_offset, WindowID p_window = MAIN_WINDOW_ID) {} | 
					
						
							| 
									
										
										
										
											2022-10-10 10:32:41 +03:00
										 |  |  | 	virtual Vector3i window_get_safe_title_margins(WindowID p_window = MAIN_WINDOW_ID) const { return Vector3i(); } | 
					
						
							| 
									
										
										
										
											2022-08-23 13:40:48 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-03-01 19:14:37 -03:00
										 |  |  | 	virtual bool window_can_draw(WindowID p_window = MAIN_WINDOW_ID) const = 0; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-03-03 10:36:29 -03:00
										 |  |  | 	virtual bool can_any_window_draw() const = 0; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-03-01 19:14:37 -03:00
										 |  |  | 	virtual void window_set_ime_active(const bool p_active, WindowID p_window = MAIN_WINDOW_ID); | 
					
						
							|  |  |  | 	virtual void window_set_ime_position(const Point2i &p_pos, WindowID p_window = MAIN_WINDOW_ID); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-23 13:40:48 +03:00
										 |  |  | 	virtual bool window_maximize_on_title_dbl_click() const { return false; } | 
					
						
							|  |  |  | 	virtual bool window_minimize_on_title_dbl_click() const { return false; } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-18 18:11:30 +00:00
										 |  |  | 	// necessary for GL focus, may be able to use one of the existing functions for this, not sure yet
 | 
					
						
							|  |  |  | 	virtual void gl_window_make_current(DisplayServer::WindowID p_window_id); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-03-01 19:14:37 -03:00
										 |  |  | 	virtual Point2i ime_get_selection() const; | 
					
						
							|  |  |  | 	virtual String ime_get_text() const; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-07-07 14:20:10 -04:00
										 |  |  | 	enum VirtualKeyboardType { | 
					
						
							|  |  |  | 		KEYBOARD_TYPE_DEFAULT, | 
					
						
							|  |  |  | 		KEYBOARD_TYPE_MULTILINE, | 
					
						
							|  |  |  | 		KEYBOARD_TYPE_NUMBER, | 
					
						
							|  |  |  | 		KEYBOARD_TYPE_NUMBER_DECIMAL, | 
					
						
							|  |  |  | 		KEYBOARD_TYPE_PHONE, | 
					
						
							|  |  |  | 		KEYBOARD_TYPE_EMAIL_ADDRESS, | 
					
						
							|  |  |  | 		KEYBOARD_TYPE_PASSWORD, | 
					
						
							|  |  |  | 		KEYBOARD_TYPE_URL | 
					
						
							|  |  |  | 	}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	virtual void virtual_keyboard_show(const String &p_existing_text, const Rect2 &p_screen_rect = Rect2(), VirtualKeyboardType p_type = KEYBOARD_TYPE_DEFAULT, int p_max_length = -1, int p_cursor_start = -1, int p_cursor_end = -1); | 
					
						
							| 
									
										
										
										
											2020-03-01 19:14:37 -03:00
										 |  |  | 	virtual void virtual_keyboard_hide(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	// returns height of the currently shown virtual keyboard (0 if keyboard is hidden)
 | 
					
						
							|  |  |  | 	virtual int virtual_keyboard_get_height() const; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	enum CursorShape { | 
					
						
							|  |  |  | 		CURSOR_ARROW, | 
					
						
							|  |  |  | 		CURSOR_IBEAM, | 
					
						
							|  |  |  | 		CURSOR_POINTING_HAND, | 
					
						
							|  |  |  | 		CURSOR_CROSS, | 
					
						
							|  |  |  | 		CURSOR_WAIT, | 
					
						
							|  |  |  | 		CURSOR_BUSY, | 
					
						
							|  |  |  | 		CURSOR_DRAG, | 
					
						
							|  |  |  | 		CURSOR_CAN_DROP, | 
					
						
							|  |  |  | 		CURSOR_FORBIDDEN, | 
					
						
							|  |  |  | 		CURSOR_VSIZE, | 
					
						
							|  |  |  | 		CURSOR_HSIZE, | 
					
						
							|  |  |  | 		CURSOR_BDIAGSIZE, | 
					
						
							|  |  |  | 		CURSOR_FDIAGSIZE, | 
					
						
							|  |  |  | 		CURSOR_MOVE, | 
					
						
							|  |  |  | 		CURSOR_VSPLIT, | 
					
						
							|  |  |  | 		CURSOR_HSPLIT, | 
					
						
							|  |  |  | 		CURSOR_HELP, | 
					
						
							|  |  |  | 		CURSOR_MAX | 
					
						
							|  |  |  | 	}; | 
					
						
							|  |  |  | 	virtual void cursor_set_shape(CursorShape p_shape); | 
					
						
							|  |  |  | 	virtual CursorShape cursor_get_shape() const; | 
					
						
							| 
									
										
										
										
											2022-05-03 01:43:50 +02:00
										 |  |  | 	virtual void cursor_set_custom_image(const Ref<Resource> &p_cursor, CursorShape p_shape = CURSOR_ARROW, const Vector2 &p_hotspot = Vector2()); | 
					
						
							| 
									
										
										
										
											2020-03-01 19:14:37 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-08 18:02:38 -05:00
										 |  |  | 	virtual bool get_swap_cancel_ok(); | 
					
						
							| 
									
										
										
										
											2020-03-01 19:14:37 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	virtual void enable_for_stealing_focus(OS::ProcessID pid); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	virtual Error dialog_show(String p_title, String p_description, Vector<String> p_buttons, const Callable &p_callback); | 
					
						
							|  |  |  | 	virtual Error dialog_input_text(String p_title, String p_description, String p_partial, const Callable &p_callback); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-30 15:42:50 +03:00
										 |  |  | 	enum FileDialogMode { | 
					
						
							|  |  |  | 		FILE_DIALOG_MODE_OPEN_FILE, | 
					
						
							|  |  |  | 		FILE_DIALOG_MODE_OPEN_FILES, | 
					
						
							|  |  |  | 		FILE_DIALOG_MODE_OPEN_DIR, | 
					
						
							|  |  |  | 		FILE_DIALOG_MODE_OPEN_ANY, | 
					
						
							| 
									
										
										
										
											2023-08-21 10:54:24 +03:00
										 |  |  | 		FILE_DIALOG_MODE_SAVE_FILE, | 
					
						
							|  |  |  | 		FILE_DIALOG_MODE_SAVE_MAX | 
					
						
							| 
									
										
										
										
											2021-03-30 15:42:50 +03:00
										 |  |  | 	}; | 
					
						
							|  |  |  | 	virtual Error file_dialog_show(const String &p_title, const String &p_current_directory, const String &p_filename, bool p_show_hidden, FileDialogMode p_mode, const Vector<String> &p_filters, const Callable &p_callback); | 
					
						
							| 
									
										
										
										
											2023-10-13 12:37:46 +03:00
										 |  |  | 	virtual Error file_dialog_with_options_show(const String &p_title, const String &p_current_directory, const String &p_root, const String &p_filename, bool p_show_hidden, FileDialogMode p_mode, const Vector<String> &p_filters, const TypedArray<Dictionary> &p_options, const Callable &p_callback); | 
					
						
							| 
									
										
										
										
											2021-03-30 15:42:50 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-06-11 12:27:07 +03:00
										 |  |  | 	virtual int keyboard_get_layout_count() const; | 
					
						
							|  |  |  | 	virtual int keyboard_get_current_layout() const; | 
					
						
							|  |  |  | 	virtual void keyboard_set_current_layout(int p_index); | 
					
						
							|  |  |  | 	virtual String keyboard_get_layout_language(int p_index) const; | 
					
						
							|  |  |  | 	virtual String keyboard_get_layout_name(int p_index) const; | 
					
						
							| 
									
										
										
										
											2021-09-17 03:07:59 +02:00
										 |  |  | 	virtual Key keyboard_get_keycode_from_physical(Key p_keycode) const; | 
					
						
							| 
									
										
										
										
											2023-06-08 09:26:48 +03:00
										 |  |  | 	virtual Key keyboard_get_label_from_physical(Key p_keycode) const; | 
					
						
							| 
									
										
										
										
											2020-03-01 19:14:37 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-06-02 22:05:21 +02:00
										 |  |  | 	virtual int tablet_get_driver_count() const { return 1; } | 
					
						
							|  |  |  | 	virtual String tablet_get_driver_name(int p_driver) const { return "default"; } | 
					
						
							|  |  |  | 	virtual String tablet_get_current_driver() const { return "default"; } | 
					
						
							|  |  |  | 	virtual void tablet_set_current_driver(const String &p_driver) {} | 
					
						
							| 
									
										
										
										
											2021-02-17 16:07:56 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-03-01 19:14:37 -03:00
										 |  |  | 	virtual void process_events() = 0; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	virtual void force_process_and_drop_events(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	virtual void release_rendering_thread(); | 
					
						
							|  |  |  | 	virtual void swap_buffers(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	virtual void set_native_icon(const String &p_filename); | 
					
						
							|  |  |  | 	virtual void set_icon(const Ref<Image> &p_icon); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-16 23:14:30 +02:00
										 |  |  | 	virtual IndicatorID create_status_indicator(const Ref<Texture2D> &p_icon, const String &p_tooltip, const Callable &p_callback); | 
					
						
							|  |  |  | 	virtual void status_indicator_set_icon(IndicatorID p_id, const Ref<Texture2D> &p_icon); | 
					
						
							| 
									
										
										
										
											2023-08-03 12:45:56 +03:00
										 |  |  | 	virtual void status_indicator_set_tooltip(IndicatorID p_id, const String &p_tooltip); | 
					
						
							| 
									
										
										
										
											2024-03-16 23:14:30 +02:00
										 |  |  | 	virtual void status_indicator_set_menu(IndicatorID p_id, const RID &p_menu_rid); | 
					
						
							| 
									
										
										
										
											2023-08-03 12:45:56 +03:00
										 |  |  | 	virtual void status_indicator_set_callback(IndicatorID p_id, const Callable &p_callback); | 
					
						
							| 
									
										
										
										
											2024-03-08 09:24:58 +02:00
										 |  |  | 	virtual Rect2 status_indicator_get_rect(IndicatorID p_id) const; | 
					
						
							| 
									
										
										
										
											2023-08-03 12:45:56 +03:00
										 |  |  | 	virtual void delete_status_indicator(IndicatorID p_id); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-03-03 10:36:29 -03:00
										 |  |  | 	virtual void set_context(Context p_context); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-05-03 11:48:46 +03:00
										 |  |  | 	virtual bool is_window_transparency_available() const { return false; } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-07-15 16:58:21 -05:00
										 |  |  | 	void register_additional_output(Object *p_output); | 
					
						
							|  |  |  | 	void unregister_additional_output(Object *p_output); | 
					
						
							|  |  |  | 	bool has_additional_outputs() const { return additional_outputs.size() > 0; } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-03-27 10:48:30 +01:00
										 |  |  | 	static void register_create_function(const char *p_name, CreateFunction p_function, GetRenderingDriversFunction p_get_drivers); | 
					
						
							| 
									
										
										
										
											2020-03-03 10:36:29 -03:00
										 |  |  | 	static int get_create_function_count(); | 
					
						
							|  |  |  | 	static const char *get_create_function_name(int p_index); | 
					
						
							|  |  |  | 	static Vector<String> get_create_function_rendering_drivers(int p_index); | 
					
						
							| 
									
										
										
										
											2024-05-22 09:06:04 -03:00
										 |  |  | 	static DisplayServer *create(int p_index, const String &p_rendering_driver, WindowMode p_mode, VSyncMode p_vsync_mode, uint32_t p_flags, const Vector2i *p_position, const Vector2i &p_resolution, int p_screen, Context p_context, Error &r_error); | 
					
						
							| 
									
										
										
										
											2020-03-01 19:14:37 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	DisplayServer(); | 
					
						
							|  |  |  | 	~DisplayServer(); | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-03-04 13:36:09 -03:00
										 |  |  | VARIANT_ENUM_CAST(DisplayServer::WindowEvent) | 
					
						
							| 
									
										
										
										
											2020-03-01 19:14:37 -03:00
										 |  |  | VARIANT_ENUM_CAST(DisplayServer::Feature) | 
					
						
							|  |  |  | VARIANT_ENUM_CAST(DisplayServer::MouseMode) | 
					
						
							|  |  |  | VARIANT_ENUM_CAST(DisplayServer::ScreenOrientation) | 
					
						
							|  |  |  | VARIANT_ENUM_CAST(DisplayServer::WindowMode) | 
					
						
							|  |  |  | VARIANT_ENUM_CAST(DisplayServer::WindowFlags) | 
					
						
							| 
									
										
										
										
											2022-01-14 12:41:04 +02:00
										 |  |  | VARIANT_ENUM_CAST(DisplayServer::HandleType) | 
					
						
							| 
									
										
										
										
											2022-07-07 14:20:10 -04:00
										 |  |  | VARIANT_ENUM_CAST(DisplayServer::VirtualKeyboardType); | 
					
						
							| 
									
										
										
										
											2020-03-01 19:14:37 -03:00
										 |  |  | VARIANT_ENUM_CAST(DisplayServer::CursorShape) | 
					
						
							| 
									
										
										
										
											2021-06-19 17:44:59 +02:00
										 |  |  | VARIANT_ENUM_CAST(DisplayServer::VSyncMode) | 
					
						
							| 
									
										
										
										
											2021-11-04 14:33:37 +02:00
										 |  |  | VARIANT_ENUM_CAST(DisplayServer::TTSUtteranceEvent) | 
					
						
							| 
									
										
										
										
											2021-03-30 15:42:50 +03:00
										 |  |  | VARIANT_ENUM_CAST(DisplayServer::FileDialogMode) | 
					
						
							| 
									
										
										
										
											2020-03-01 19:14:37 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | #endif // DISPLAY_SERVER_H
 |