mirror of
https://github.com/slint-ui/slint.git
synced 2025-09-27 12:29:41 +00:00
Add support for dispatching key events through the public platform API
This change adds `KeyPress` and `KeyRelease` variants to the `WindowEvent` enum, along with the new `slint::Key` enum, that allows encoding keys.
This commit is contained in:
parent
e3838543fe
commit
61c39b5fa1
36 changed files with 681 additions and 315 deletions
|
@ -24,12 +24,17 @@ inline void send_mouse_click(const Component *component, float x, float y)
|
|||
}
|
||||
|
||||
template<typename Component>
|
||||
inline void send_keyboard_string_sequence(const Component *component,
|
||||
const slint::SharedString &str,
|
||||
cbindgen_private::KeyboardModifiers modifiers = {})
|
||||
inline void send_keyboard_char(const Component *component, const slint::SharedString &str,
|
||||
bool pressed)
|
||||
{
|
||||
cbindgen_private::send_keyboard_string_sequence(&str, modifiers,
|
||||
&component->m_window.window_handle());
|
||||
cbindgen_private::slint_send_keyboard_char(&str, pressed, &component->m_window.window_handle());
|
||||
}
|
||||
|
||||
template<typename Component>
|
||||
inline void send_keyboard_string_sequence(const Component *component,
|
||||
const slint::SharedString &str)
|
||||
{
|
||||
cbindgen_private::send_keyboard_string_sequence(&str, &component->m_window.window_handle());
|
||||
}
|
||||
|
||||
#define assert_eq(A, B) \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue