Path: blob/master/platform/macos/display_server_macos_base.h
10277 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_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;5354protected:55_THREAD_SAFE_CLASS_5657void initialize_tts() const;5859void _update_keyboard_layouts() const;60static void _keyboard_layout_changed(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef user_info);6162public:63virtual void clipboard_set(const String &p_text) override;64virtual String clipboard_get() const override;65virtual Ref<Image> clipboard_get_image() const override;66virtual bool clipboard_has() const override;67virtual bool clipboard_has_image() const override;6869virtual int keyboard_get_layout_count() const override;70virtual int keyboard_get_current_layout() const override;71virtual void keyboard_set_current_layout(int p_index) override;72virtual String keyboard_get_layout_language(int p_index) const override;73virtual String keyboard_get_layout_name(int p_index) const override;74virtual Key keyboard_get_keycode_from_physical(Key p_keycode) const override;75virtual Key keyboard_get_label_from_physical(Key p_keycode) const override;76virtual void show_emoji_and_symbol_picker() const override;7778virtual bool tts_is_speaking() const override;79virtual bool tts_is_paused() const override;80virtual TypedArray<Dictionary> tts_get_voices() const override;8182virtual 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) override;83virtual void tts_pause() override;84virtual void tts_resume() override;85virtual void tts_stop() override;8687DisplayServerMacOSBase();88~DisplayServerMacOSBase();89};909192