objc2_app_kit/generated/
NSRulerMarker.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#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8use objc2_foundation::*;
9
10use crate::*;
11
12extern_class!(
13    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsrulermarker?language=objc)
14    #[unsafe(super(NSObject))]
15    #[derive(Debug, PartialEq, Eq, Hash)]
16    pub struct NSRulerMarker;
17);
18
19extern_conformance!(
20    unsafe impl NSCoding for NSRulerMarker {}
21);
22
23extern_conformance!(
24    unsafe impl NSCopying for NSRulerMarker {}
25);
26
27unsafe impl CopyingHelper for NSRulerMarker {
28    type Result = Self;
29}
30
31extern_conformance!(
32    unsafe impl NSObjectProtocol for NSRulerMarker {}
33);
34
35impl NSRulerMarker {
36    extern_methods!(
37        #[cfg(all(
38            feature = "NSImage",
39            feature = "NSResponder",
40            feature = "NSRulerView",
41            feature = "NSView",
42            feature = "objc2-core-foundation"
43        ))]
44        /// ************************** Initialization ***************************
45        #[unsafe(method(initWithRulerView:markerLocation:image:imageOrigin:))]
46        #[unsafe(method_family = init)]
47        pub fn initWithRulerView_markerLocation_image_imageOrigin(
48            this: Allocated<Self>,
49            ruler: &NSRulerView,
50            location: CGFloat,
51            image: &NSImage,
52            image_origin: NSPoint,
53        ) -> Retained<Self>;
54
55        /// # Safety
56        ///
57        /// `coder` possibly has further requirements.
58        #[unsafe(method(initWithCoder:))]
59        #[unsafe(method_family = init)]
60        pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
61
62        #[unsafe(method(init))]
63        #[unsafe(method_family = init)]
64        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
65
66        #[cfg(all(feature = "NSResponder", feature = "NSRulerView", feature = "NSView"))]
67        /// ********************* Query/Set basic attributes **********************
68        #[unsafe(method(ruler))]
69        #[unsafe(method_family = none)]
70        pub fn ruler(&self, mtm: MainThreadMarker) -> Option<Retained<NSRulerView>>;
71
72        #[cfg(feature = "objc2-core-foundation")]
73        #[unsafe(method(markerLocation))]
74        #[unsafe(method_family = none)]
75        pub fn markerLocation(&self) -> CGFloat;
76
77        #[cfg(feature = "objc2-core-foundation")]
78        /// Setter for [`markerLocation`][Self::markerLocation].
79        #[unsafe(method(setMarkerLocation:))]
80        #[unsafe(method_family = none)]
81        pub fn setMarkerLocation(&self, marker_location: CGFloat);
82
83        #[cfg(feature = "NSImage")]
84        #[unsafe(method(image))]
85        #[unsafe(method_family = none)]
86        pub fn image(&self) -> Retained<NSImage>;
87
88        #[cfg(feature = "NSImage")]
89        /// Setter for [`image`][Self::image].
90        #[unsafe(method(setImage:))]
91        #[unsafe(method_family = none)]
92        pub fn setImage(&self, image: &NSImage);
93
94        #[unsafe(method(imageOrigin))]
95        #[unsafe(method_family = none)]
96        pub fn imageOrigin(&self) -> NSPoint;
97
98        /// Setter for [`imageOrigin`][Self::imageOrigin].
99        #[unsafe(method(setImageOrigin:))]
100        #[unsafe(method_family = none)]
101        pub fn setImageOrigin(&self, image_origin: NSPoint);
102
103        #[unsafe(method(isMovable))]
104        #[unsafe(method_family = none)]
105        pub fn isMovable(&self) -> bool;
106
107        /// Setter for [`isMovable`][Self::isMovable].
108        #[unsafe(method(setMovable:))]
109        #[unsafe(method_family = none)]
110        pub fn setMovable(&self, movable: bool);
111
112        #[unsafe(method(isRemovable))]
113        #[unsafe(method_family = none)]
114        pub fn isRemovable(&self) -> bool;
115
116        /// Setter for [`isRemovable`][Self::isRemovable].
117        #[unsafe(method(setRemovable:))]
118        #[unsafe(method_family = none)]
119        pub fn setRemovable(&self, removable: bool);
120
121        #[unsafe(method(isDragging))]
122        #[unsafe(method_family = none)]
123        pub fn isDragging(&self) -> bool;
124
125        #[unsafe(method(representedObject))]
126        #[unsafe(method_family = none)]
127        pub fn representedObject(&self) -> Option<Retained<ProtocolObject<dyn NSCopying>>>;
128
129        /// Setter for [`representedObject`][Self::representedObject].
130        ///
131        /// # Safety
132        ///
133        /// `represented_object` should be of the correct type.
134        #[unsafe(method(setRepresentedObject:))]
135        #[unsafe(method_family = none)]
136        pub unsafe fn setRepresentedObject(
137            &self,
138            represented_object: Option<&ProtocolObject<dyn NSCopying>>,
139        );
140
141        /// ************************ Ruler facilities *************************
142        #[unsafe(method(imageRectInRuler))]
143        #[unsafe(method_family = none)]
144        pub fn imageRectInRuler(&self) -> NSRect;
145
146        #[cfg(feature = "objc2-core-foundation")]
147        #[unsafe(method(thicknessRequiredInRuler))]
148        #[unsafe(method_family = none)]
149        pub fn thicknessRequiredInRuler(&self) -> CGFloat;
150
151        #[unsafe(method(drawRect:))]
152        #[unsafe(method_family = none)]
153        pub fn drawRect(&self, rect: NSRect);
154
155        #[cfg(feature = "NSEvent")]
156        #[unsafe(method(trackMouse:adding:))]
157        #[unsafe(method_family = none)]
158        pub fn trackMouse_adding(&self, mouse_down_event: &NSEvent, is_adding: bool) -> bool;
159    );
160}
161
162/// Methods declared on superclass `NSObject`.
163impl NSRulerMarker {
164    extern_methods!(
165        #[unsafe(method(new))]
166        #[unsafe(method_family = new)]
167        pub unsafe fn new() -> Retained<Self>;
168    );
169}