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::*;
pub type NSStatusItemAutosaveName = NSString;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSStatusItemBehavior(pub NSUInteger);
bitflags::bitflags! {
impl NSStatusItemBehavior: NSUInteger {
#[doc(alias = "NSStatusItemBehaviorRemovalAllowed")]
const RemovalAllowed = 1<<1;
#[doc(alias = "NSStatusItemBehaviorTerminationOnRemoval")]
const TerminationOnRemoval = 1<<2;
}
}
unsafe impl Encode for NSStatusItemBehavior {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSStatusItemBehavior {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSStatusItem;
);
extern_conformance!(
unsafe impl NSObjectProtocol for NSStatusItem {}
);
impl NSStatusItem {
extern_methods!(
#[cfg(feature = "NSStatusBar")]
#[unsafe(method(statusBar))]
#[unsafe(method_family = none)]
pub fn statusBar(&self) -> Option<Retained<NSStatusBar>>;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(length))]
#[unsafe(method_family = none)]
pub fn length(&self) -> CGFloat;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(setLength:))]
#[unsafe(method_family = none)]
pub fn setLength(&self, length: CGFloat);
#[cfg(feature = "NSMenu")]
#[unsafe(method(menu))]
#[unsafe(method_family = none)]
pub fn menu(&self, mtm: MainThreadMarker) -> Option<Retained<NSMenu>>;
#[cfg(feature = "NSMenu")]
#[unsafe(method(setMenu:))]
#[unsafe(method_family = none)]
pub fn setMenu(&self, menu: Option<&NSMenu>);
#[cfg(all(
feature = "NSButton",
feature = "NSControl",
feature = "NSResponder",
feature = "NSStatusBarButton",
feature = "NSView"
))]
#[unsafe(method(button))]
#[unsafe(method_family = none)]
pub fn button(&self, mtm: MainThreadMarker) -> Option<Retained<NSStatusBarButton>>;
#[unsafe(method(behavior))]
#[unsafe(method_family = none)]
pub fn behavior(&self) -> NSStatusItemBehavior;
#[unsafe(method(setBehavior:))]
#[unsafe(method_family = none)]
pub fn setBehavior(&self, behavior: NSStatusItemBehavior);
#[unsafe(method(isVisible))]
#[unsafe(method_family = none)]
pub fn isVisible(&self) -> bool;
#[unsafe(method(setVisible:))]
#[unsafe(method_family = none)]
pub fn setVisible(&self, visible: bool);
#[unsafe(method(autosaveName))]
#[unsafe(method_family = none)]
pub fn autosaveName(&self) -> Retained<NSStatusItemAutosaveName>;
#[unsafe(method(setAutosaveName:))]
#[unsafe(method_family = none)]
pub fn setAutosaveName(&self, autosave_name: Option<&NSStatusItemAutosaveName>);
);
}
impl NSStatusItem {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
impl DefaultRetained for NSStatusItem {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
impl NSStatusItem {
extern_methods!(
#[deprecated = "Use the receiver's button.action instead"]
#[unsafe(method(action))]
#[unsafe(method_family = none)]
pub fn action(&self) -> Option<Sel>;
#[deprecated = "Use the receiver's button.action instead"]
#[unsafe(method(setAction:))]
#[unsafe(method_family = none)]
pub unsafe fn setAction(&self, action: Option<Sel>);
#[deprecated = "Use the receiver's button.doubleAction instead"]
#[unsafe(method(doubleAction))]
#[unsafe(method_family = none)]
pub fn doubleAction(&self) -> Option<Sel>;
#[deprecated = "Use the receiver's button.doubleAction instead"]
#[unsafe(method(setDoubleAction:))]
#[unsafe(method_family = none)]
pub unsafe fn setDoubleAction(&self, double_action: Option<Sel>);
#[deprecated = "Use the receiver's button.target instead"]
#[unsafe(method(target))]
#[unsafe(method_family = none)]
pub fn target(&self) -> Option<Retained<AnyObject>>;
#[deprecated = "Use the receiver's button.target instead"]
#[unsafe(method(setTarget:))]
#[unsafe(method_family = none)]
pub unsafe fn setTarget(&self, target: Option<&AnyObject>);
#[deprecated = "Use the receiver's button.title instead"]
#[unsafe(method(title))]
#[unsafe(method_family = none)]
pub fn title(&self) -> Option<Retained<NSString>>;
#[deprecated = "Use the receiver's button.title instead"]
#[unsafe(method(setTitle:))]
#[unsafe(method_family = none)]
pub fn setTitle(&self, title: Option<&NSString>);
#[deprecated = "Use the receiver's button.attributedTitle instead"]
#[unsafe(method(attributedTitle))]
#[unsafe(method_family = none)]
pub fn attributedTitle(&self) -> Option<Retained<NSAttributedString>>;
#[deprecated = "Use the receiver's button.attributedTitle instead"]
#[unsafe(method(setAttributedTitle:))]
#[unsafe(method_family = none)]
pub fn setAttributedTitle(&self, attributed_title: Option<&NSAttributedString>);
#[cfg(feature = "NSImage")]
#[deprecated = "Use the receiver's button.image instead"]
#[unsafe(method(image))]
#[unsafe(method_family = none)]
pub fn image(&self) -> Option<Retained<NSImage>>;
#[cfg(feature = "NSImage")]
#[deprecated = "Use the receiver's button.image instead"]
#[unsafe(method(setImage:))]
#[unsafe(method_family = none)]
pub fn setImage(&self, image: Option<&NSImage>);
#[cfg(feature = "NSImage")]
#[deprecated = "Use the receiver's button.alternateImage instead"]
#[unsafe(method(alternateImage))]
#[unsafe(method_family = none)]
pub fn alternateImage(&self) -> Option<Retained<NSImage>>;
#[cfg(feature = "NSImage")]
#[deprecated = "Use the receiver's button.alternateImage instead"]
#[unsafe(method(setAlternateImage:))]
#[unsafe(method_family = none)]
pub fn setAlternateImage(&self, alternate_image: Option<&NSImage>);
#[deprecated = "Use the receiver's button.enabled instead"]
#[unsafe(method(isEnabled))]
#[unsafe(method_family = none)]
pub fn isEnabled(&self) -> bool;
#[deprecated = "Use the receiver's button.enabled instead"]
#[unsafe(method(setEnabled:))]
#[unsafe(method_family = none)]
pub fn setEnabled(&self, enabled: bool);
#[deprecated = "Use the receiver's button.cell.highlightsBy instead"]
#[unsafe(method(highlightMode))]
#[unsafe(method_family = none)]
pub fn highlightMode(&self) -> bool;
#[deprecated = "Use the receiver's button.cell.highlightsBy instead"]
#[unsafe(method(setHighlightMode:))]
#[unsafe(method_family = none)]
pub fn setHighlightMode(&self, highlight_mode: bool);
#[deprecated = "Use the receiver's button.toolTip instead"]
#[unsafe(method(toolTip))]
#[unsafe(method_family = none)]
pub fn toolTip(&self) -> Option<Retained<NSString>>;
#[deprecated = "Use the receiver's button.toolTip instead"]
#[unsafe(method(setToolTip:))]
#[unsafe(method_family = none)]
pub fn setToolTip(&self, tool_tip: Option<&NSString>);
#[cfg(feature = "NSEvent")]
#[deprecated = "Use the receiver's button's -sendActionOn: instead"]
#[unsafe(method(sendActionOn:))]
#[unsafe(method_family = none)]
pub fn sendActionOn(&self, mask: NSEventMask) -> NSInteger;
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
#[deprecated = "Use the standard button property instead"]
#[unsafe(method(view))]
#[unsafe(method_family = none)]
pub fn view(&self, mtm: MainThreadMarker) -> Option<Retained<NSView>>;
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
#[deprecated = "Use the standard button property instead"]
#[unsafe(method(setView:))]
#[unsafe(method_family = none)]
pub fn setView(&self, view: Option<&NSView>);
#[deprecated = "Use the standard button instead which handles highlight drawing, making this method obsolete"]
#[unsafe(method(drawStatusBarBackgroundInRect:withHighlight:))]
#[unsafe(method_family = none)]
pub fn drawStatusBarBackgroundInRect_withHighlight(&self, rect: NSRect, highlight: bool);
#[cfg(feature = "NSMenu")]
#[deprecated = "Use the menu property instead"]
#[unsafe(method(popUpStatusItemMenu:))]
#[unsafe(method_family = none)]
pub fn popUpStatusItemMenu(&self, menu: &NSMenu);
);
}