| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 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 |
}; |