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