MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
Cocoa/KeyMapping.hpp
Go to the documentation of this file.
1#pragma once
2
3#ifdef MAYAFLUX_PLATFORM_MACOS
4
6
7#include <cstdint>
8
9namespace MayaFlux::Core {
10
11/**
12 * @brief Convert a macOS virtual key code to a layout-independent key.
13 * @param key_code Key code from NSEvent.keyCode.
14 * @return The matching key, or IO::Keys::Unknown when unmapped.
15 */
16MAYAFLUX_API IO::Keys from_cocoa_key(uint16_t key_code) noexcept;
17
18/**
19 * @brief Convert a key to a macOS virtual key code.
20 * @param key Key to convert.
21 * @return The matching key code, or -1 when unmapped.
22 */
23MAYAFLUX_API int to_cocoa_key(IO::Keys key) noexcept;
24
25/**
26 * @brief Check whether a macOS virtual key code has a matching key.
27 * @param key_code Key code to check.
28 * @return True when the key code is mapped.
29 */
30MAYAFLUX_API bool is_valid_cocoa_key(uint16_t key_code) noexcept;
31
32}
33
34#endif