pub trait ApplicationHandlerExtMacOS: ApplicationHandler {
// Provided method
fn standard_key_binding(
&mut self,
event_loop: &dyn ActiveEventLoop,
window_id: WindowId,
action: &str,
) { ... }
}Expand description
Additional events on ApplicationHandler that are specific to macOS.
This can be registered with ApplicationHandler::macos_handler.
Provided Methods§
Sourcefn standard_key_binding(
&mut self,
event_loop: &dyn ActiveEventLoop,
window_id: WindowId,
action: &str,
)
fn standard_key_binding( &mut self, event_loop: &dyn ActiveEventLoop, window_id: WindowId, action: &str, )
The system interpreted a keypress as a standard key binding command.
Examples include inserting tabs and newlines, or moving the insertion point, see
NSStandardKeyBindingResponding for the full list of key bindings. They are often text
editing related.
This corresponds to the doCommandBySelector: method on NSTextInputClient.
The action parameter contains the string representation of the selector. Examples include
"insertBacktab:", "indent:" and "noop:".
§Example
ⓘ
impl ApplicationHandlerExtMacOS for App {
fn standard_key_binding(
&mut self,
event_loop: &dyn ActiveEventLoop,
window_id: WindowId,
action: &str,
) {
match action {
"moveBackward:" => self.cursor.position -= 1,
"moveForward:" => self.cursor.position += 1,
_ => {} // Ignore other actions
}
}
}