use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
use objc2_foundation::*;
use crate::*;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSUsableScrollerParts(pub NSUInteger);
impl NSUsableScrollerParts {
#[doc(alias = "NSNoScrollerParts")]
pub const NoScrollerParts: Self = Self(0);
#[doc(alias = "NSOnlyScrollerArrows")]
#[deprecated = "Scroller arrows are not used anymore."]
pub const OnlyScrollerArrows: Self = Self(1);
#[doc(alias = "NSAllScrollerParts")]
pub const AllScrollerParts: Self = Self(2);
}
unsafe impl Encode for NSUsableScrollerParts {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSUsableScrollerParts {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSScrollerPart(pub NSUInteger);
impl NSScrollerPart {
#[doc(alias = "NSScrollerNoPart")]
pub const NoPart: Self = Self(0);
#[doc(alias = "NSScrollerDecrementPage")]
pub const DecrementPage: Self = Self(1);
#[doc(alias = "NSScrollerKnob")]
pub const Knob: Self = Self(2);
#[doc(alias = "NSScrollerIncrementPage")]
pub const IncrementPage: Self = Self(3);
#[doc(alias = "NSScrollerDecrementLine")]
#[deprecated = "Scroller arrows are not used anymore."]
pub const DecrementLine: Self = Self(4);
#[doc(alias = "NSScrollerIncrementLine")]
#[deprecated = "Scroller arrows are not used anymore."]
pub const IncrementLine: Self = Self(5);
#[doc(alias = "NSScrollerKnobSlot")]
pub const KnobSlot: Self = Self(6);
}
unsafe impl Encode for NSScrollerPart {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSScrollerPart {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSScrollerStyle(pub NSInteger);
impl NSScrollerStyle {
#[doc(alias = "NSScrollerStyleLegacy")]
pub const Legacy: Self = Self(0);
#[doc(alias = "NSScrollerStyleOverlay")]
pub const Overlay: Self = Self(1);
}
unsafe impl Encode for NSScrollerStyle {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSScrollerStyle {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSScrollerKnobStyle(pub NSInteger);
impl NSScrollerKnobStyle {
#[doc(alias = "NSScrollerKnobStyleDefault")]
pub const Default: Self = Self(0);
#[doc(alias = "NSScrollerKnobStyleDark")]
pub const Dark: Self = Self(1);
#[doc(alias = "NSScrollerKnobStyleLight")]
pub const Light: Self = Self(2);
}
unsafe impl Encode for NSScrollerKnobStyle {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSScrollerKnobStyle {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[unsafe(super(NSControl, NSView, NSResponder, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
pub struct NSScroller;
);
#[cfg(all(
feature = "NSAccessibilityProtocols",
feature = "NSControl",
feature = "NSResponder",
feature = "NSView"
))]
extern_conformance!(
unsafe impl NSAccessibility for NSScroller {}
);
#[cfg(all(
feature = "NSAccessibilityProtocols",
feature = "NSControl",
feature = "NSResponder",
feature = "NSView"
))]
extern_conformance!(
unsafe impl NSAccessibilityElementProtocol for NSScroller {}
);
#[cfg(all(
feature = "NSAnimation",
feature = "NSControl",
feature = "NSResponder",
feature = "NSView"
))]
extern_conformance!(
unsafe impl NSAnimatablePropertyContainer for NSScroller {}
);
#[cfg(all(
feature = "NSAppearance",
feature = "NSControl",
feature = "NSResponder",
feature = "NSView"
))]
extern_conformance!(
unsafe impl NSAppearanceCustomization for NSScroller {}
);
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
extern_conformance!(
unsafe impl NSCoding for NSScroller {}
);
#[cfg(all(
feature = "NSControl",
feature = "NSDragging",
feature = "NSResponder",
feature = "NSView"
))]
extern_conformance!(
unsafe impl NSDraggingDestination for NSScroller {}
);
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
extern_conformance!(
unsafe impl NSObjectProtocol for NSScroller {}
);
#[cfg(all(
feature = "NSControl",
feature = "NSResponder",
feature = "NSUserInterfaceItemIdentification",
feature = "NSView"
))]
extern_conformance!(
unsafe impl NSUserInterfaceItemIdentification for NSScroller {}
);
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
impl NSScroller {
extern_methods!(
#[unsafe(method(isCompatibleWithOverlayScrollers))]
#[unsafe(method_family = none)]
pub fn isCompatibleWithOverlayScrollers(mtm: MainThreadMarker) -> bool;
#[cfg(all(feature = "NSCell", feature = "objc2-core-foundation"))]
#[unsafe(method(scrollerWidthForControlSize:scrollerStyle:))]
#[unsafe(method_family = none)]
pub fn scrollerWidthForControlSize_scrollerStyle(
control_size: NSControlSize,
scroller_style: NSScrollerStyle,
mtm: MainThreadMarker,
) -> CGFloat;
#[unsafe(method(preferredScrollerStyle))]
#[unsafe(method_family = none)]
pub fn preferredScrollerStyle(mtm: MainThreadMarker) -> NSScrollerStyle;
#[unsafe(method(scrollerStyle))]
#[unsafe(method_family = none)]
pub fn scrollerStyle(&self) -> NSScrollerStyle;
#[unsafe(method(setScrollerStyle:))]
#[unsafe(method_family = none)]
pub fn setScrollerStyle(&self, scroller_style: NSScrollerStyle);
#[unsafe(method(knobStyle))]
#[unsafe(method_family = none)]
pub fn knobStyle(&self) -> NSScrollerKnobStyle;
#[unsafe(method(setKnobStyle:))]
#[unsafe(method_family = none)]
pub fn setKnobStyle(&self, knob_style: NSScrollerKnobStyle);
#[unsafe(method(rectForPart:))]
#[unsafe(method_family = none)]
pub fn rectForPart(&self, part_code: NSScrollerPart) -> NSRect;
#[unsafe(method(checkSpaceForParts))]
#[unsafe(method_family = none)]
pub fn checkSpaceForParts(&self);
#[unsafe(method(usableParts))]
#[unsafe(method_family = none)]
pub fn usableParts(&self) -> NSUsableScrollerParts;
#[cfg(feature = "NSCell")]
#[unsafe(method(controlSize))]
#[unsafe(method_family = none)]
pub fn controlSize(&self) -> NSControlSize;
#[cfg(feature = "NSCell")]
#[unsafe(method(setControlSize:))]
#[unsafe(method_family = none)]
pub fn setControlSize(&self, control_size: NSControlSize);
#[unsafe(method(drawKnob))]
#[unsafe(method_family = none)]
pub fn drawKnob(&self);
#[unsafe(method(drawKnobSlotInRect:highlight:))]
#[unsafe(method_family = none)]
pub fn drawKnobSlotInRect_highlight(&self, slot_rect: NSRect, flag: bool);
#[unsafe(method(testPart:))]
#[unsafe(method_family = none)]
pub fn testPart(&self, point: NSPoint) -> NSScrollerPart;
#[cfg(feature = "NSEvent")]
#[unsafe(method(trackKnob:))]
#[unsafe(method_family = none)]
pub fn trackKnob(&self, event: &NSEvent);
#[unsafe(method(hitPart))]
#[unsafe(method_family = none)]
pub fn hitPart(&self) -> NSScrollerPart;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(knobProportion))]
#[unsafe(method_family = none)]
pub fn knobProportion(&self) -> CGFloat;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(setKnobProportion:))]
#[unsafe(method_family = none)]
pub fn setKnobProportion(&self, knob_proportion: CGFloat);
);
}
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
impl NSScroller {
extern_methods!(
#[unsafe(method(initWithFrame:))]
#[unsafe(method_family = init)]
pub fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
#[unsafe(method(initWithCoder:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
);
}
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
impl NSScroller {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
);
}
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
impl NSScroller {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
);
}
extern "C" {
pub static NSPreferredScrollerStyleDidChangeNotification: &'static NSNotificationName;
}
#[deprecated = "Scroller arrows are not used anymore."]
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSScrollArrowPosition(pub NSUInteger);
impl NSScrollArrowPosition {
#[doc(alias = "NSScrollerArrowsMaxEnd")]
pub const ScrollerArrowsMaxEnd: Self = Self(0);
#[doc(alias = "NSScrollerArrowsMinEnd")]
pub const ScrollerArrowsMinEnd: Self = Self(1);
#[doc(alias = "NSScrollerArrowsDefaultSetting")]
pub const ScrollerArrowsDefaultSetting: Self = Self(0);
#[doc(alias = "NSScrollerArrowsNone")]
pub const ScrollerArrowsNone: Self = Self(2);
}
unsafe impl Encode for NSScrollArrowPosition {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSScrollArrowPosition {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[deprecated = "Scroller arrows are not used anymore."]
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSScrollerArrow(pub NSUInteger);
impl NSScrollerArrow {
#[doc(alias = "NSScrollerIncrementArrow")]
pub const IncrementArrow: Self = Self(0);
#[doc(alias = "NSScrollerDecrementArrow")]
pub const DecrementArrow: Self = Self(1);
}
unsafe impl Encode for NSScrollerArrow {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSScrollerArrow {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
impl NSScroller {
extern_methods!(
#[cfg(all(feature = "NSCell", feature = "objc2-core-foundation"))]
#[deprecated = "Use +scrollerWidthForControlSize:scrollerStyle: instead"]
#[unsafe(method(scrollerWidthForControlSize:))]
#[unsafe(method_family = none)]
pub fn scrollerWidthForControlSize(
control_size: NSControlSize,
mtm: MainThreadMarker,
) -> CGFloat;
#[cfg(feature = "objc2-core-foundation")]
#[deprecated = "Use +scrollerWidthForControlSize:scrollerStyle: instead"]
#[unsafe(method(scrollerWidth))]
#[unsafe(method_family = none)]
pub fn scrollerWidth(mtm: MainThreadMarker) -> CGFloat;
#[cfg(feature = "objc2-core-foundation")]
#[deprecated]
#[unsafe(method(setFloatValue:knobProportion:))]
#[unsafe(method_family = none)]
pub fn setFloatValue_knobProportion(&self, value: c_float, proportion: CGFloat);
#[deprecated = "Has had no effect since 10.7"]
#[unsafe(method(arrowsPosition))]
#[unsafe(method_family = none)]
pub fn arrowsPosition(&self) -> NSScrollArrowPosition;
#[deprecated = "Has had no effect since 10.7"]
#[unsafe(method(setArrowsPosition:))]
#[unsafe(method_family = none)]
pub fn setArrowsPosition(&self, arrows_position: NSScrollArrowPosition);
#[cfg(feature = "NSCell")]
#[deprecated = "Has had no effect since 10.7"]
#[unsafe(method(controlTint))]
#[unsafe(method_family = none)]
pub fn controlTint(&self) -> NSControlTint;
#[cfg(feature = "NSCell")]
#[deprecated = "Has had no effect since 10.7"]
#[unsafe(method(setControlTint:))]
#[unsafe(method_family = none)]
pub fn setControlTint(&self, control_tint: NSControlTint);
#[deprecated = "Has had no effect since 10.7"]
#[unsafe(method(highlight:))]
#[unsafe(method_family = none)]
pub fn highlight(&self, flag: bool);
#[cfg(feature = "NSEvent")]
#[deprecated = "Not invoked since 10.7"]
#[unsafe(method(trackScrollButtons:))]
#[unsafe(method_family = none)]
pub fn trackScrollButtons(&self, event: &NSEvent);
#[deprecated = "Not invoked on any macOS version"]
#[unsafe(method(drawParts))]
#[unsafe(method_family = none)]
pub fn drawParts(&self);
#[deprecated = "Scrollers don't have arrows as of 10.7"]
#[unsafe(method(drawArrow:highlight:))]
#[unsafe(method_family = none)]
pub fn drawArrow_highlight(&self, which_arrow: NSScrollerArrow, flag: bool);
);
}