use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
pub type NSTextInputSourceIdentifier = NSString;
extern_class!(
#[unsafe(super(NSObject))]
#[thread_kind = MainThreadOnly]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSTextInputContext;
);
extern_conformance!(
unsafe impl NSObjectProtocol for NSTextInputContext {}
);
impl NSTextInputContext {
extern_methods!(
#[unsafe(method(currentInputContext))]
#[unsafe(method_family = none)]
pub fn currentInputContext(mtm: MainThreadMarker) -> Option<Retained<NSTextInputContext>>;
#[cfg(feature = "NSTextInputClient")]
#[unsafe(method(initWithClient:))]
#[unsafe(method_family = init)]
pub fn initWithClient(
this: Allocated<Self>,
client: &ProtocolObject<dyn NSTextInputClient>,
) -> Retained<Self>;
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[cfg(feature = "NSTextInputClient")]
#[unsafe(method(client))]
#[unsafe(method_family = none)]
pub fn client(&self) -> Retained<ProtocolObject<dyn NSTextInputClient>>;
#[unsafe(method(acceptsGlyphInfo))]
#[unsafe(method_family = none)]
pub fn acceptsGlyphInfo(&self) -> bool;
#[unsafe(method(setAcceptsGlyphInfo:))]
#[unsafe(method_family = none)]
pub fn setAcceptsGlyphInfo(&self, accepts_glyph_info: bool);
#[unsafe(method(allowedInputSourceLocales))]
#[unsafe(method_family = none)]
pub fn allowedInputSourceLocales(&self) -> Option<Retained<NSArray<NSString>>>;
#[unsafe(method(setAllowedInputSourceLocales:))]
#[unsafe(method_family = none)]
pub fn setAllowedInputSourceLocales(
&self,
allowed_input_source_locales: Option<&NSArray<NSString>>,
);
#[unsafe(method(activate))]
#[unsafe(method_family = none)]
pub fn activate(&self);
#[unsafe(method(deactivate))]
#[unsafe(method_family = none)]
pub fn deactivate(&self);
#[cfg(feature = "NSEvent")]
#[unsafe(method(handleEvent:))]
#[unsafe(method_family = none)]
pub fn handleEvent(&self, event: &NSEvent) -> bool;
#[unsafe(method(discardMarkedText))]
#[unsafe(method_family = none)]
pub fn discardMarkedText(&self);
#[unsafe(method(invalidateCharacterCoordinates))]
#[unsafe(method_family = none)]
pub fn invalidateCharacterCoordinates(&self);
#[unsafe(method(textInputClientWillStartScrollingOrZooming))]
#[unsafe(method_family = none)]
pub fn textInputClientWillStartScrollingOrZooming(&self);
#[unsafe(method(textInputClientDidEndScrollingOrZooming))]
#[unsafe(method_family = none)]
pub fn textInputClientDidEndScrollingOrZooming(&self);
#[unsafe(method(textInputClientDidUpdateSelection))]
#[unsafe(method_family = none)]
pub fn textInputClientDidUpdateSelection(&self);
#[unsafe(method(textInputClientDidScroll))]
#[unsafe(method_family = none)]
pub fn textInputClientDidScroll(&self);
#[unsafe(method(keyboardInputSources))]
#[unsafe(method_family = none)]
pub fn keyboardInputSources(
&self,
) -> Option<Retained<NSArray<NSTextInputSourceIdentifier>>>;
#[unsafe(method(selectedKeyboardInputSource))]
#[unsafe(method_family = none)]
pub fn selectedKeyboardInputSource(&self) -> Option<Retained<NSTextInputSourceIdentifier>>;
#[unsafe(method(setSelectedKeyboardInputSource:))]
#[unsafe(method_family = none)]
pub fn setSelectedKeyboardInputSource(
&self,
selected_keyboard_input_source: Option<&NSTextInputSourceIdentifier>,
);
#[unsafe(method(localizedNameForInputSource:))]
#[unsafe(method_family = none)]
pub fn localizedNameForInputSource(
input_source_identifier: &NSTextInputSourceIdentifier,
mtm: MainThreadMarker,
) -> Option<Retained<NSString>>;
);
}
impl NSTextInputContext {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
);
}
extern "C" {
pub static NSTextInputContextKeyboardSelectionDidChangeNotification:
&'static NSNotificationName;
}