use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSTextInputTraitType(pub NSInteger);
impl NSTextInputTraitType {
#[doc(alias = "NSTextInputTraitTypeDefault")]
pub const Default: Self = Self(0);
#[doc(alias = "NSTextInputTraitTypeNo")]
pub const No: Self = Self(1);
#[doc(alias = "NSTextInputTraitTypeYes")]
pub const Yes: Self = Self(2);
}
unsafe impl Encode for NSTextInputTraitType {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSTextInputTraitType {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSWritingToolsBehavior(pub NSInteger);
impl NSWritingToolsBehavior {
#[doc(alias = "NSWritingToolsBehaviorNone")]
pub const None: Self = Self(-1);
#[doc(alias = "NSWritingToolsBehaviorDefault")]
pub const Default: Self = Self(0);
#[doc(alias = "NSWritingToolsBehaviorComplete")]
pub const Complete: Self = Self(1);
#[doc(alias = "NSWritingToolsBehaviorLimited")]
pub const Limited: Self = Self(2);
}
unsafe impl Encode for NSWritingToolsBehavior {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSWritingToolsBehavior {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSWritingToolsResultOptions(pub NSUInteger);
bitflags::bitflags! {
impl NSWritingToolsResultOptions: NSUInteger {
#[doc(alias = "NSWritingToolsResultDefault")]
const Default = 0;
#[doc(alias = "NSWritingToolsResultPlainText")]
const PlainText = 1<<0;
#[doc(alias = "NSWritingToolsResultRichText")]
const RichText = 1<<1;
#[doc(alias = "NSWritingToolsResultList")]
const List = 1<<2;
#[doc(alias = "NSWritingToolsResultTable")]
const Table = 1<<3;
#[doc(alias = "NSWritingToolsResultPresentationIntent")]
const PresentationIntent = 1<<4;
}
}
unsafe impl Encode for NSWritingToolsResultOptions {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSWritingToolsResultOptions {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_protocol!(
pub unsafe trait NSTextInputTraits {
#[optional]
#[unsafe(method(autocorrectionType))]
#[unsafe(method_family = none)]
fn autocorrectionType(&self) -> NSTextInputTraitType;
#[optional]
#[unsafe(method(setAutocorrectionType:))]
#[unsafe(method_family = none)]
fn setAutocorrectionType(&self, autocorrection_type: NSTextInputTraitType);
#[optional]
#[unsafe(method(spellCheckingType))]
#[unsafe(method_family = none)]
fn spellCheckingType(&self) -> NSTextInputTraitType;
#[optional]
#[unsafe(method(setSpellCheckingType:))]
#[unsafe(method_family = none)]
fn setSpellCheckingType(&self, spell_checking_type: NSTextInputTraitType);
#[optional]
#[unsafe(method(grammarCheckingType))]
#[unsafe(method_family = none)]
fn grammarCheckingType(&self) -> NSTextInputTraitType;
#[optional]
#[unsafe(method(setGrammarCheckingType:))]
#[unsafe(method_family = none)]
fn setGrammarCheckingType(&self, grammar_checking_type: NSTextInputTraitType);
#[optional]
#[unsafe(method(smartQuotesType))]
#[unsafe(method_family = none)]
fn smartQuotesType(&self) -> NSTextInputTraitType;
#[optional]
#[unsafe(method(setSmartQuotesType:))]
#[unsafe(method_family = none)]
fn setSmartQuotesType(&self, smart_quotes_type: NSTextInputTraitType);
#[optional]
#[unsafe(method(smartDashesType))]
#[unsafe(method_family = none)]
fn smartDashesType(&self) -> NSTextInputTraitType;
#[optional]
#[unsafe(method(setSmartDashesType:))]
#[unsafe(method_family = none)]
fn setSmartDashesType(&self, smart_dashes_type: NSTextInputTraitType);
#[optional]
#[unsafe(method(smartInsertDeleteType))]
#[unsafe(method_family = none)]
fn smartInsertDeleteType(&self) -> NSTextInputTraitType;
#[optional]
#[unsafe(method(setSmartInsertDeleteType:))]
#[unsafe(method_family = none)]
fn setSmartInsertDeleteType(&self, smart_insert_delete_type: NSTextInputTraitType);
#[optional]
#[unsafe(method(textReplacementType))]
#[unsafe(method_family = none)]
fn textReplacementType(&self) -> NSTextInputTraitType;
#[optional]
#[unsafe(method(setTextReplacementType:))]
#[unsafe(method_family = none)]
fn setTextReplacementType(&self, text_replacement_type: NSTextInputTraitType);
#[optional]
#[unsafe(method(dataDetectionType))]
#[unsafe(method_family = none)]
fn dataDetectionType(&self) -> NSTextInputTraitType;
#[optional]
#[unsafe(method(setDataDetectionType:))]
#[unsafe(method_family = none)]
fn setDataDetectionType(&self, data_detection_type: NSTextInputTraitType);
#[optional]
#[unsafe(method(linkDetectionType))]
#[unsafe(method_family = none)]
fn linkDetectionType(&self) -> NSTextInputTraitType;
#[optional]
#[unsafe(method(setLinkDetectionType:))]
#[unsafe(method_family = none)]
fn setLinkDetectionType(&self, link_detection_type: NSTextInputTraitType);
#[optional]
#[unsafe(method(textCompletionType))]
#[unsafe(method_family = none)]
fn textCompletionType(&self) -> NSTextInputTraitType;
#[optional]
#[unsafe(method(setTextCompletionType:))]
#[unsafe(method_family = none)]
fn setTextCompletionType(&self, text_completion_type: NSTextInputTraitType);
#[optional]
#[unsafe(method(inlinePredictionType))]
#[unsafe(method_family = none)]
fn inlinePredictionType(&self) -> NSTextInputTraitType;
#[optional]
#[unsafe(method(setInlinePredictionType:))]
#[unsafe(method_family = none)]
fn setInlinePredictionType(&self, inline_prediction_type: NSTextInputTraitType);
#[optional]
#[unsafe(method(mathExpressionCompletionType))]
#[unsafe(method_family = none)]
fn mathExpressionCompletionType(&self) -> NSTextInputTraitType;
#[optional]
#[unsafe(method(setMathExpressionCompletionType:))]
#[unsafe(method_family = none)]
fn setMathExpressionCompletionType(
&self,
math_expression_completion_type: NSTextInputTraitType,
);
#[optional]
#[unsafe(method(writingToolsBehavior))]
#[unsafe(method_family = none)]
fn writingToolsBehavior(&self) -> NSWritingToolsBehavior;
#[optional]
#[unsafe(method(setWritingToolsBehavior:))]
#[unsafe(method_family = none)]
fn setWritingToolsBehavior(&self, writing_tools_behavior: NSWritingToolsBehavior);
#[optional]
#[unsafe(method(allowedWritingToolsResultOptions))]
#[unsafe(method_family = none)]
fn allowedWritingToolsResultOptions(&self) -> NSWritingToolsResultOptions;
#[optional]
#[unsafe(method(setAllowedWritingToolsResultOptions:))]
#[unsafe(method_family = none)]
fn setAllowedWritingToolsResultOptions(
&self,
allowed_writing_tools_result_options: NSWritingToolsResultOptions,
);
}
);
extern_protocol!(
#[cfg(feature = "NSTextInputClient")]
pub unsafe trait NSTextCheckingClient: NSTextInputClient + NSTextInputTraits {
#[unsafe(method(annotatedSubstringForProposedRange:actualRange:))]
#[unsafe(method_family = none)]
unsafe fn annotatedSubstringForProposedRange_actualRange(
&self,
range: NSRange,
actual_range: NSRangePointer,
) -> Option<Retained<NSAttributedString>>;
#[unsafe(method(setAnnotations:range:))]
#[unsafe(method_family = none)]
fn setAnnotations_range(
&self,
annotations: &NSDictionary<NSAttributedStringKey, NSString>,
range: NSRange,
);
#[unsafe(method(addAnnotations:range:))]
#[unsafe(method_family = none)]
fn addAnnotations_range(
&self,
annotations: &NSDictionary<NSAttributedStringKey, NSString>,
range: NSRange,
);
#[unsafe(method(removeAnnotation:range:))]
#[unsafe(method_family = none)]
fn removeAnnotation_range(&self, annotation_name: &NSAttributedStringKey, range: NSRange);
#[unsafe(method(replaceCharactersInRange:withAnnotatedString:))]
#[unsafe(method_family = none)]
fn replaceCharactersInRange_withAnnotatedString(
&self,
range: NSRange,
annotated_string: &NSAttributedString,
);
#[unsafe(method(selectAndShowRange:))]
#[unsafe(method_family = none)]
fn selectAndShowRange(&self, range: NSRange);
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
#[unsafe(method(viewForRange:firstRect:actualRange:))]
#[unsafe(method_family = none)]
unsafe fn viewForRange_firstRect_actualRange(
&self,
range: NSRange,
first_rect: NSRectPointer,
actual_range: NSRangePointer,
mtm: MainThreadMarker,
) -> Option<Retained<NSView>>;
#[cfg(all(feature = "NSCandidateListTouchBarItem", feature = "NSTouchBarItem"))]
#[unsafe(method(candidateListTouchBarItem))]
#[unsafe(method_family = none)]
fn candidateListTouchBarItem(
&self,
mtm: MainThreadMarker,
) -> Option<Retained<NSCandidateListTouchBarItem>>;
}
);