Debian Codegraph @

platform/macos/display_server_macos_base.h

raw symbols SCIP
1 /**************************************************************************/
2 /* display_server_macos_base.h */
3 /**************************************************************************/
4 /* This file is part of: */
5 /* GODOT ENGINE */
6 /* https://godotengine.org */
7 /**************************************************************************/
8 /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
9 /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
10 /* */
11 /* Permission is hereby granted, free of charge, to any person obtaining */
12 /* a copy of this software and associated documentation files (the */
13 /* "Software"), to deal in the Software without restriction, including */
14 /* without limitation the rights to use, copy, modify, merge, publish, */
15 /* distribute, sublicense, and/or sell copies of the Software, and to */
16 /* permit persons to whom the Software is furnished to do so, subject to */
17 /* the following conditions: */
18 /* */
19 /* The above copyright notice and this permission notice shall be */
20 /* included in all copies or substantial portions of the Software. */
21 /* */
22 /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
23 /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
24 /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
25 /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
26 /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
27 /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
28 /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
29 /**************************************************************************/
30
31 #pragma once
32
33 #include "core/input/input.h"
34 #include "servers/display/display_server.h"
35
36 #define FontVariation __FontVariation
37
38 #import <AppKit/AppKit.h>
39
40 #undef FontVariation
41
42 class DisplayServerMacOSBase : public DisplayServer {
43 GDSOFTCLASS(DisplayServerMacOSBase, DisplayServer)
44
45 id tts = nullptr;
46
47 struct LayoutInfo {
48 String name;
49 String code;
50 };
51 mutable Vector<LayoutInfo> kbd_layouts;
52 mutable int current_layout = 0;
53 mutable bool keyboard_layout_dirty = true;
54
55 Callable system_theme_changed;
56
57 protected:
58 _THREAD_SAFE_CLASS_
59
60 void initialize_tts() const;
61
62 void _update_keyboard_layouts() const;
63 static void _keyboard_layout_changed(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef user_info);
64
65 public:
66 virtual void clipboard_set(const String &p_text) override;
67 virtual String clipboard_get() const override;
68 virtual Ref<Image> clipboard_get_image() const override;
69 virtual bool clipboard_has() const override;
70 virtual bool clipboard_has_image() const override;
71
72 virtual int keyboard_get_layout_count() const override;
73 virtual int keyboard_get_current_layout() const override;
74 virtual void keyboard_set_current_layout(int p_index) override;
75 virtual String keyboard_get_layout_language(int p_index) const override;
76 virtual String keyboard_get_layout_name(int p_index) const override;
77 virtual Key keyboard_get_keycode_from_physical(Key p_keycode) const override;
78 virtual Key keyboard_get_label_from_physical(Key p_keycode) const override;
79 virtual void show_emoji_and_symbol_picker() const override;
80
81 void emit_system_theme_changed();
82 virtual bool is_dark_mode_supported() const override;
83 virtual bool is_dark_mode() const override;
84 virtual Color get_accent_color() const override;
85 virtual Color get_base_color() const override;
86 virtual void set_system_theme_change_callback(const Callable &p_callable) override;
87
88 virtual bool tts_is_speaking() const override;
89 virtual bool tts_is_paused() const override;
90 virtual TypedArray<Dictionary> tts_get_voices() const override;
91
92 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, int64_t p_utterance_id = 0, bool p_interrupt = false) override;
93 virtual void tts_pause() override;
94 virtual void tts_resume() override;
95 virtual void tts_stop() override;
96
97 DisplayServerMacOSBase();
98 ~DisplayServerMacOSBase();
99 };