objc2_mail_kit/generated/
MEComposeContext.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5use objc2_foundation::*;
6
7use crate::*;
8
9/// An enumeration corresponding to the action user took to start a new mail compose window.
10///
11/// See also [Apple's documentation](https://developer.apple.com/documentation/mailkit/mecomposeuseraction?language=objc)
12// NS_ENUM
13#[repr(transparent)]
14#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
15pub struct MEComposeUserAction(pub NSInteger);
16impl MEComposeUserAction {
17    /// Compose a new message.
18    #[doc(alias = "MEComposeUserActionNewMessage")]
19    pub const NewMessage: Self = Self(1);
20    /// Reply to the sender of an original email.
21    #[doc(alias = "MEComposeUserActionReply")]
22    pub const Reply: Self = Self(2);
23    /// Reply to the sender and all the recipeients of original email.
24    #[doc(alias = "MEComposeUserActionReplyAll")]
25    pub const ReplyAll: Self = Self(3);
26    /// Forward an original message.
27    #[doc(alias = "MEComposeUserActionForward")]
28    pub const Forward: Self = Self(4);
29}
30
31unsafe impl Encode for MEComposeUserAction {
32    const ENCODING: Encoding = NSInteger::ENCODING;
33}
34
35unsafe impl RefEncode for MEComposeUserAction {
36    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
37}
38
39extern_class!(
40    /// An object encapsulating additional information about the message being composed.
41    ///
42    /// See also [Apple's documentation](https://developer.apple.com/documentation/mailkit/mecomposecontext?language=objc)
43    #[unsafe(super(NSObject))]
44    #[derive(Debug, PartialEq, Eq, Hash)]
45    pub struct MEComposeContext;
46);
47
48extern_conformance!(
49    unsafe impl NSObjectProtocol for MEComposeContext {}
50);
51
52impl MEComposeContext {
53    extern_methods!(
54        /// A unique identifier for the compose context.
55        #[unsafe(method(contextID))]
56        #[unsafe(method_family = none)]
57        pub unsafe fn contextID(&self) -> Retained<NSUUID>;
58
59        #[cfg(feature = "MEMessage")]
60        /// The original email message on which user performed an action
61        /// It is
62        /// `nil`for
63        /// `MEComposeUserActionNewMessage`actions.
64        #[unsafe(method(originalMessage))]
65        #[unsafe(method_family = none)]
66        pub unsafe fn originalMessage(&self) -> Option<Retained<MEMessage>>;
67
68        /// Indicates the action performed by the user that created this compose context.
69        #[unsafe(method(action))]
70        #[unsafe(method_family = none)]
71        pub unsafe fn action(&self) -> MEComposeUserAction;
72
73        /// Boolean that indicates the message is encrypted by a Message Security extension.
74        #[unsafe(method(isEncrypted))]
75        #[unsafe(method_family = none)]
76        pub unsafe fn isEncrypted(&self) -> bool;
77
78        /// Boolean that indicates if the user wants to encrypt the message.
79        #[unsafe(method(shouldEncrypt))]
80        #[unsafe(method_family = none)]
81        pub unsafe fn shouldEncrypt(&self) -> bool;
82
83        /// Boolean that indicates the message is signed by a Message Security extension.
84        #[unsafe(method(isSigned))]
85        #[unsafe(method_family = none)]
86        pub unsafe fn isSigned(&self) -> bool;
87
88        /// A Boolean that indicates if the user wants to sign the message.
89        #[unsafe(method(shouldSign))]
90        #[unsafe(method_family = none)]
91        pub unsafe fn shouldSign(&self) -> bool;
92    );
93}
94
95/// Methods declared on superclass `NSObject`.
96impl MEComposeContext {
97    extern_methods!(
98        #[unsafe(method(init))]
99        #[unsafe(method_family = init)]
100        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
101
102        #[unsafe(method(new))]
103        #[unsafe(method_family = new)]
104        pub unsafe fn new() -> Retained<Self>;
105    );
106}