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 unsafe 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        #[unsafe(method(initWithCoder:))]
56        #[unsafe(method_family = init)]
57        pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
58
59        #[unsafe(method(init))]
60        #[unsafe(method_family = init)]
61        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
62
63        #[cfg(all(feature = "NSResponder", feature = "NSRulerView", feature = "NSView"))]
64        /// ********************* Query/Set basic attributes **********************
65        #[unsafe(method(ruler))]
66        #[unsafe(method_family = none)]
67        pub unsafe fn ruler(&self, mtm: MainThreadMarker) -> Option<Retained<NSRulerView>>;
68
69        #[cfg(feature = "objc2-core-foundation")]
70        #[unsafe(method(markerLocation))]
71        #[unsafe(method_family = none)]
72        pub unsafe fn markerLocation(&self) -> CGFloat;
73
74        #[cfg(feature = "objc2-core-foundation")]
75        /// Setter for [`markerLocation`][Self::markerLocation].
76        #[unsafe(method(setMarkerLocation:))]
77        #[unsafe(method_family = none)]
78        pub unsafe fn setMarkerLocation(&self, marker_location: CGFloat);
79
80        #[cfg(feature = "NSImage")]
81        #[unsafe(method(image))]
82        #[unsafe(method_family = none)]
83        pub unsafe fn image(&self) -> Retained<NSImage>;
84
85        #[cfg(feature = "NSImage")]
86        /// Setter for [`image`][Self::image].
87        #[unsafe(method(setImage:))]
88        #[unsafe(method_family = none)]
89        pub unsafe fn setImage(&self, image: &NSImage);
90
91        #[unsafe(method(imageOrigin))]
92        #[unsafe(method_family = none)]
93        pub unsafe fn imageOrigin(&self) -> NSPoint;
94
95        /// Setter for [`imageOrigin`][Self::imageOrigin].
96        #[unsafe(method(setImageOrigin:))]
97        #[unsafe(method_family = none)]
98        pub unsafe fn setImageOrigin(&self, image_origin: NSPoint);
99
100        #[unsafe(method(isMovable))]
101        #[unsafe(method_family = none)]
102        pub unsafe fn isMovable(&self) -> bool;
103
104        /// Setter for [`isMovable`][Self::isMovable].
105        #[unsafe(method(setMovable:))]
106        #[unsafe(method_family = none)]
107        pub unsafe fn setMovable(&self, movable: bool);
108
109        #[unsafe(method(isRemovable))]
110        #[unsafe(method_family = none)]
111        pub unsafe fn isRemovable(&self) -> bool;
112
113        /// Setter for [`isRemovable`][Self::isRemovable].
114        #[unsafe(method(setRemovable:))]
115        #[unsafe(method_family = none)]
116        pub unsafe fn setRemovable(&self, removable: bool);
117
118        #[unsafe(method(isDragging))]
119        #[unsafe(method_family = none)]
120        pub unsafe fn isDragging(&self) -> bool;
121
122        #[unsafe(method(representedObject))]
123        #[unsafe(method_family = none)]
124        pub unsafe fn representedObject(&self) -> Option<Retained<ProtocolObject<dyn NSCopying>>>;
125
126        /// Setter for [`representedObject`][Self::representedObject].
127        #[unsafe(method(setRepresentedObject:))]
128        #[unsafe(method_family = none)]
129        pub unsafe fn setRepresentedObject(
130            &self,
131            represented_object: Option<&ProtocolObject<dyn NSCopying>>,
132        );
133
134        /// ************************ Ruler facilities *************************
135        #[unsafe(method(imageRectInRuler))]
136        #[unsafe(method_family = none)]
137        pub unsafe fn imageRectInRuler(&self) -> NSRect;
138
139        #[cfg(feature = "objc2-core-foundation")]
140        #[unsafe(method(thicknessRequiredInRuler))]
141        #[unsafe(method_family = none)]
142        pub unsafe fn thicknessRequiredInRuler(&self) -> CGFloat;
143
144        #[unsafe(method(drawRect:))]
145        #[unsafe(method_family = none)]
146        pub unsafe fn drawRect(&self, rect: NSRect);
147
148        #[cfg(feature = "NSEvent")]
149        #[unsafe(method(trackMouse:adding:))]
150        #[unsafe(method_family = none)]
151        pub unsafe fn trackMouse_adding(&self, mouse_down_event: &NSEvent, is_adding: bool)
152            -> bool;
153    );
154}
155
156/// Methods declared on superclass `NSObject`.
157impl NSRulerMarker {
158    extern_methods!(
159        #[unsafe(method(new))]
160        #[unsafe(method_family = new)]
161        pub unsafe fn new() -> Retained<Self>;
162    );
163}