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