objc2-mail-kit 0.3.2

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

use crate::*;

/// An enumeration corresponding to the action user took to start a new mail compose window.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/mailkit/mecomposeuseraction?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MEComposeUserAction(pub NSInteger);
impl MEComposeUserAction {
    /// Compose a new message.
    #[doc(alias = "MEComposeUserActionNewMessage")]
    pub const NewMessage: Self = Self(1);
    /// Reply to the sender of an original email.
    #[doc(alias = "MEComposeUserActionReply")]
    pub const Reply: Self = Self(2);
    /// Reply to the sender and all the recipeients of original email.
    #[doc(alias = "MEComposeUserActionReplyAll")]
    pub const ReplyAll: Self = Self(3);
    /// Forward an original message.
    #[doc(alias = "MEComposeUserActionForward")]
    pub const Forward: Self = Self(4);
}

unsafe impl Encode for MEComposeUserAction {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for MEComposeUserAction {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_class!(
    /// An object encapsulating additional information about the message being composed.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/mailkit/mecomposecontext?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct MEComposeContext;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for MEComposeContext {}
);

impl MEComposeContext {
    extern_methods!(
        /// A unique identifier for the compose context.
        #[unsafe(method(contextID))]
        #[unsafe(method_family = none)]
        pub unsafe fn contextID(&self) -> Retained<NSUUID>;

        #[cfg(feature = "MEMessage")]
        /// The original email message on which user performed an action
        /// It is
        /// `nil`for
        /// `MEComposeUserActionNewMessage`actions.
        #[unsafe(method(originalMessage))]
        #[unsafe(method_family = none)]
        pub unsafe fn originalMessage(&self) -> Option<Retained<MEMessage>>;

        /// Indicates the action performed by the user that created this compose context.
        #[unsafe(method(action))]
        #[unsafe(method_family = none)]
        pub unsafe fn action(&self) -> MEComposeUserAction;

        /// Boolean that indicates the message is encrypted by a Message Security extension.
        #[unsafe(method(isEncrypted))]
        #[unsafe(method_family = none)]
        pub unsafe fn isEncrypted(&self) -> bool;

        /// Boolean that indicates if the user wants to encrypt the message.
        #[unsafe(method(shouldEncrypt))]
        #[unsafe(method_family = none)]
        pub unsafe fn shouldEncrypt(&self) -> bool;

        /// Boolean that indicates the message is signed by a Message Security extension.
        #[unsafe(method(isSigned))]
        #[unsafe(method_family = none)]
        pub unsafe fn isSigned(&self) -> bool;

        /// A Boolean that indicates if the user wants to sign the message.
        #[unsafe(method(shouldSign))]
        #[unsafe(method_family = none)]
        pub unsafe fn shouldSign(&self) -> bool;
    );
}

/// Methods declared on superclass `NSObject`.
impl MEComposeContext {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}