objc2_ui_kit/generated/
UIMessageConversationEntry.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6
7use crate::*;
8
9/// A list of options that represent the kinds of data a message can contain.
10///
11/// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uimessageconversationentrydatakind?language=objc)
12// NS_ENUM
13#[repr(transparent)]
14#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
15pub struct UIMessageConversationEntryDataKind(pub NSInteger);
16impl UIMessageConversationEntryDataKind {
17    /// The message contains text.
18    #[doc(alias = "UIMessageConversationEntryDataKindText")]
19    pub const Text: Self = Self(0);
20    /// The message contains an attachment, such as an image or file.
21    #[doc(alias = "UIMessageConversationEntryDataKindAttachment")]
22    pub const Attachment: Self = Self(1);
23    /// The message contains other data, such as data that represents a sticker or a payment.
24    #[doc(alias = "UIMessageConversationEntryDataKindOther")]
25    pub const Other: Self = Self(2);
26}
27
28unsafe impl Encode for UIMessageConversationEntryDataKind {
29    const ENCODING: Encoding = NSInteger::ENCODING;
30}
31
32unsafe impl RefEncode for UIMessageConversationEntryDataKind {
33    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
34}
35
36extern_class!(
37    /// A class that represents a message in a message conversation.
38    ///
39    /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uimessageconversationentry?language=objc)
40    #[unsafe(super(UIConversationEntry, NSObject))]
41    #[derive(Debug, PartialEq, Eq, Hash)]
42    #[cfg(feature = "UIConversationEntry")]
43    pub struct UIMessageConversationEntry;
44);
45
46#[cfg(feature = "UIConversationEntry")]
47extern_conformance!(
48    unsafe impl NSObjectProtocol for UIMessageConversationEntry {}
49);
50
51#[cfg(feature = "UIConversationEntry")]
52impl UIMessageConversationEntry {
53    extern_methods!(
54        /// Indicates the data format of the entry
55        #[unsafe(method(dataKind))]
56        #[unsafe(method_family = none)]
57        pub unsafe fn dataKind(&self) -> UIMessageConversationEntryDataKind;
58
59        /// Setter for [`dataKind`][Self::dataKind].
60        #[unsafe(method(setDataKind:))]
61        #[unsafe(method_family = none)]
62        pub unsafe fn setDataKind(&self, data_kind: UIMessageConversationEntryDataKind);
63
64        /// A Boolean value that indicates whether the current user sent the message.
65        #[unsafe(method(wasSentBySelf))]
66        #[unsafe(method_family = none)]
67        pub unsafe fn wasSentBySelf(&self) -> bool;
68
69        /// Setter for [`wasSentBySelf`][Self::wasSentBySelf].
70        #[unsafe(method(setWasSentBySelf:))]
71        #[unsafe(method_family = none)]
72        pub unsafe fn setWasSentBySelf(&self, was_sent_by_self: bool);
73    );
74}
75
76/// Methods declared on superclass `NSObject`.
77#[cfg(feature = "UIConversationEntry")]
78impl UIMessageConversationEntry {
79    extern_methods!(
80        #[unsafe(method(init))]
81        #[unsafe(method_family = init)]
82        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
83
84        #[unsafe(method(new))]
85        #[unsafe(method_family = new)]
86        pub unsafe fn new() -> Retained<Self>;
87    );
88}