objc2-browser-engine-kit 0.3.2

Bindings to the BrowserEngineKit framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/browserenginekit/betextinputdelegate?language=objc)
    pub unsafe trait BETextInputDelegate {
        #[cfg(all(feature = "BEKeyEntryContext", feature = "BETextInput"))]
        /// Defers the key event to the system and returns whether the key event was handled.
        ///
        /// For example, the system will handle key events for character insertions, deletions, key commands, and more.
        #[unsafe(method(shouldDeferEventHandlingToSystemForTextInput:context:))]
        #[unsafe(method_family = none)]
        unsafe fn shouldDeferEventHandlingToSystemForTextInput_context(
            &self,
            text_input: &ProtocolObject<dyn BETextInput>,
            key_event_context: &BEKeyEntryContext,
        ) -> bool;

        #[cfg(all(feature = "BETextInput", feature = "BETextSuggestion"))]
        /// Provides text suggestions to the system.
        ///
        /// For example, suggestions could include data list elements or AutoFill candidates.
        #[unsafe(method(textInput:setCandidateSuggestions:))]
        #[unsafe(method_family = none)]
        unsafe fn textInput_setCandidateSuggestions(
            &self,
            text_input: &ProtocolObject<dyn BETextInput>,
            suggestions: Option<&NSArray<BETextSuggestion>>,
        );

        #[cfg(feature = "BETextInput")]
        /// Tells the system when the selection is about to change in the document.
        #[unsafe(method(selectionWillChangeForTextInput:))]
        #[unsafe(method_family = none)]
        unsafe fn selectionWillChangeForTextInput(
            &self,
            text_input: &ProtocolObject<dyn BETextInput>,
        );

        #[cfg(feature = "BETextInput")]
        /// Tells the system when the selection has changed in the document.
        ///
        /// This method results in an document state refresh with an invocation to:
        /// -[BETextInput requestTextContextForAutocorrectionWithCompletionHandler:]
        #[unsafe(method(selectionDidChangeForTextInput:))]
        #[unsafe(method_family = none)]
        unsafe fn selectionDidChangeForTextInput(
            &self,
            text_input: &ProtocolObject<dyn BETextInput>,
        );

        #[cfg(feature = "BETextInput")]
        /// Defers a replace text action to the ssytem.
        ///
        /// When handling the replace: action, use this method to defer the replacement to the system.
        ///
        /// For example, a replacement could be deferred after it is selected from the autocorrect replacements list.
        ///
        /// # Safety
        ///
        /// `sender` should be of the correct type.
        #[unsafe(method(textInput:deferReplaceTextActionToSystem:))]
        #[unsafe(method_family = none)]
        unsafe fn textInput_deferReplaceTextActionToSystem(
            &self,
            text_input: &ProtocolObject<dyn BETextInput>,
            sender: &AnyObject,
        );

        #[cfg(feature = "BETextInput")]
        /// Tells the system the text entry context has changed and that text entry UI's need to be refreshed.
        ///
        /// This is a costly operation and should only used with intention.  For example, when switching focus
        /// between different elements.
        #[unsafe(method(invalidateTextEntryContextForTextInput:))]
        #[unsafe(method_family = none)]
        unsafe fn invalidateTextEntryContextForTextInput(
            &self,
            text_input: &ProtocolObject<dyn BETextInput>,
        );
    }
);