use objc2::__framework_prelude::*;
use objc2_foundation::*;
#[cfg(feature = "objc2-symbols")]
use objc2_symbols::*;
use crate::*;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIBarButtonItemStyle(pub NSInteger);
impl UIBarButtonItemStyle {
#[doc(alias = "UIBarButtonItemStylePlain")]
pub const Plain: Self = Self(0);
#[deprecated]
#[doc(alias = "UIBarButtonItemStyleBordered")]
pub const Bordered: Self = Self(1);
#[doc(alias = "UIBarButtonItemStyleDone")]
pub const Done: Self = Self(2);
}
unsafe impl Encode for UIBarButtonItemStyle {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for UIBarButtonItemStyle {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIBarButtonSystemItem(pub NSInteger);
impl UIBarButtonSystemItem {
#[doc(alias = "UIBarButtonSystemItemDone")]
pub const Done: Self = Self(0);
#[doc(alias = "UIBarButtonSystemItemCancel")]
pub const Cancel: Self = Self(1);
#[doc(alias = "UIBarButtonSystemItemEdit")]
pub const Edit: Self = Self(2);
#[doc(alias = "UIBarButtonSystemItemSave")]
pub const Save: Self = Self(3);
#[doc(alias = "UIBarButtonSystemItemAdd")]
pub const Add: Self = Self(4);
#[doc(alias = "UIBarButtonSystemItemFlexibleSpace")]
pub const FlexibleSpace: Self = Self(5);
#[doc(alias = "UIBarButtonSystemItemFixedSpace")]
pub const FixedSpace: Self = Self(6);
#[doc(alias = "UIBarButtonSystemItemCompose")]
pub const Compose: Self = Self(7);
#[doc(alias = "UIBarButtonSystemItemReply")]
pub const Reply: Self = Self(8);
#[doc(alias = "UIBarButtonSystemItemAction")]
pub const Action: Self = Self(9);
#[doc(alias = "UIBarButtonSystemItemOrganize")]
pub const Organize: Self = Self(10);
#[doc(alias = "UIBarButtonSystemItemBookmarks")]
pub const Bookmarks: Self = Self(11);
#[doc(alias = "UIBarButtonSystemItemSearch")]
pub const Search: Self = Self(12);
#[doc(alias = "UIBarButtonSystemItemRefresh")]
pub const Refresh: Self = Self(13);
#[doc(alias = "UIBarButtonSystemItemStop")]
pub const Stop: Self = Self(14);
#[doc(alias = "UIBarButtonSystemItemCamera")]
pub const Camera: Self = Self(15);
#[doc(alias = "UIBarButtonSystemItemTrash")]
pub const Trash: Self = Self(16);
#[doc(alias = "UIBarButtonSystemItemPlay")]
pub const Play: Self = Self(17);
#[doc(alias = "UIBarButtonSystemItemPause")]
pub const Pause: Self = Self(18);
#[doc(alias = "UIBarButtonSystemItemRewind")]
pub const Rewind: Self = Self(19);
#[doc(alias = "UIBarButtonSystemItemFastForward")]
pub const FastForward: Self = Self(20);
#[doc(alias = "UIBarButtonSystemItemUndo")]
pub const Undo: Self = Self(21);
#[doc(alias = "UIBarButtonSystemItemRedo")]
pub const Redo: Self = Self(22);
#[deprecated]
#[doc(alias = "UIBarButtonSystemItemPageCurl")]
pub const PageCurl: Self = Self(23);
#[doc(alias = "UIBarButtonSystemItemClose")]
pub const Close: Self = Self(24);
}
unsafe impl Encode for UIBarButtonSystemItem {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for UIBarButtonSystemItem {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "UIBarItem")]
pub struct UIBarButtonItem;
#[cfg(feature = "UIBarItem")]
unsafe impl ClassType for UIBarButtonItem {
#[inherits(NSObject)]
type Super = UIBarItem;
type Mutability = MainThreadOnly;
}
);
#[cfg(feature = "UIBarItem")]
unsafe impl NSCoding for UIBarButtonItem {}
#[cfg(feature = "UIBarItem")]
unsafe impl NSObjectProtocol for UIBarButtonItem {}
#[cfg(all(feature = "UIAppearance", feature = "UIBarItem"))]
unsafe impl UIAppearance for UIBarButtonItem {}
extern_methods!(
#[cfg(feature = "UIBarItem")]
unsafe impl UIBarButtonItem {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
#[cfg(feature = "UIImage")]
#[method_id(@__retain_semantics Init initWithImage:style:target:action:)]
pub unsafe fn initWithImage_style_target_action(
this: Allocated<Self>,
image: Option<&UIImage>,
style: UIBarButtonItemStyle,
target: Option<&AnyObject>,
action: Option<Sel>,
) -> Retained<Self>;
#[cfg(feature = "UIImage")]
#[method_id(@__retain_semantics Init initWithImage:landscapeImagePhone:style:target:action:)]
pub unsafe fn initWithImage_landscapeImagePhone_style_target_action(
this: Allocated<Self>,
image: Option<&UIImage>,
landscape_image_phone: Option<&UIImage>,
style: UIBarButtonItemStyle,
target: Option<&AnyObject>,
action: Option<Sel>,
) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithTitle:style:target:action:)]
pub unsafe fn initWithTitle_style_target_action(
this: Allocated<Self>,
title: Option<&NSString>,
style: UIBarButtonItemStyle,
target: Option<&AnyObject>,
action: Option<Sel>,
) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithBarButtonSystemItem:target:action:)]
pub unsafe fn initWithBarButtonSystemItem_target_action(
this: Allocated<Self>,
system_item: UIBarButtonSystemItem,
target: Option<&AnyObject>,
action: Option<Sel>,
) -> Retained<Self>;
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
#[method_id(@__retain_semantics Init initWithCustomView:)]
pub unsafe fn initWithCustomView(
this: Allocated<Self>,
custom_view: &UIView,
) -> Retained<Self>;
#[cfg(all(feature = "UIAction", feature = "UIMenuElement"))]
#[method_id(@__retain_semantics Init initWithBarButtonSystemItem:primaryAction:)]
pub unsafe fn initWithBarButtonSystemItem_primaryAction(
this: Allocated<Self>,
system_item: UIBarButtonSystemItem,
primary_action: Option<&UIAction>,
) -> Retained<Self>;
#[cfg(all(feature = "UIAction", feature = "UIMenuElement"))]
#[method_id(@__retain_semantics Init initWithPrimaryAction:)]
pub unsafe fn initWithPrimaryAction(
this: Allocated<Self>,
primary_action: Option<&UIAction>,
) -> Retained<Self>;
#[cfg(all(feature = "UIMenu", feature = "UIMenuElement"))]
#[method_id(@__retain_semantics Init initWithBarButtonSystemItem:menu:)]
pub unsafe fn initWithBarButtonSystemItem_menu(
this: Allocated<Self>,
system_item: UIBarButtonSystemItem,
menu: Option<&UIMenu>,
) -> Retained<Self>;
#[cfg(all(feature = "UIMenu", feature = "UIMenuElement"))]
#[method_id(@__retain_semantics Init initWithTitle:menu:)]
pub unsafe fn initWithTitle_menu(
this: Allocated<Self>,
title: Option<&NSString>,
menu: Option<&UIMenu>,
) -> Retained<Self>;
#[cfg(all(feature = "UIImage", feature = "UIMenu", feature = "UIMenuElement"))]
#[method_id(@__retain_semantics Init initWithImage:menu:)]
pub unsafe fn initWithImage_menu(
this: Allocated<Self>,
image: Option<&UIImage>,
menu: Option<&UIMenu>,
) -> Retained<Self>;
#[cfg(all(feature = "UIAction", feature = "UIMenu", feature = "UIMenuElement"))]
#[method_id(@__retain_semantics Init initWithPrimaryAction:menu:)]
pub unsafe fn initWithPrimaryAction_menu(
this: Allocated<Self>,
primary_action: Option<&UIAction>,
menu: Option<&UIMenu>,
) -> Retained<Self>;
#[cfg(all(feature = "UIAction", feature = "UIMenu", feature = "UIMenuElement"))]
#[method_id(@__retain_semantics Init initWithBarButtonSystemItem:primaryAction:menu:)]
pub unsafe fn initWithBarButtonSystemItem_primaryAction_menu(
this: Allocated<Self>,
system_item: UIBarButtonSystemItem,
primary_action: Option<&UIAction>,
menu: Option<&UIMenu>,
) -> Retained<Self>;
#[cfg(all(feature = "UIImage", feature = "UIMenu", feature = "UIMenuElement"))]
#[method_id(@__retain_semantics Init initWithTitle:image:target:action:menu:)]
pub unsafe fn initWithTitle_image_target_action_menu(
this: Allocated<Self>,
title: Option<&NSString>,
image: Option<&UIImage>,
target: Option<&AnyObject>,
action: Option<Sel>,
menu: Option<&UIMenu>,
) -> Retained<Self>;
#[method_id(@__retain_semantics Other fixedSpaceItemOfWidth:)]
pub unsafe fn fixedSpaceItemOfWidth(
width: CGFloat,
mtm: MainThreadMarker,
) -> Retained<Self>;
#[method_id(@__retain_semantics Other flexibleSpaceItem)]
pub unsafe fn flexibleSpaceItem(mtm: MainThreadMarker) -> Retained<Self>;
#[method(style)]
pub unsafe fn style(&self) -> UIBarButtonItemStyle;
#[method(setStyle:)]
pub unsafe fn setStyle(&self, style: UIBarButtonItemStyle);
#[method(width)]
pub unsafe fn width(&self) -> CGFloat;
#[method(setWidth:)]
pub unsafe fn setWidth(&self, width: CGFloat);
#[method_id(@__retain_semantics Other possibleTitles)]
pub unsafe fn possibleTitles(&self) -> Option<Retained<NSSet<NSString>>>;
#[method(setPossibleTitles:)]
pub unsafe fn setPossibleTitles(&self, possible_titles: Option<&NSSet<NSString>>);
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
#[method_id(@__retain_semantics Other customView)]
pub unsafe fn customView(&self) -> Option<Retained<UIView>>;
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
#[method(setCustomView:)]
pub unsafe fn setCustomView(&self, custom_view: Option<&UIView>);
#[method(action)]
pub unsafe fn action(&self) -> Option<Sel>;
#[method(setAction:)]
pub unsafe fn setAction(&self, action: Option<Sel>);
#[method_id(@__retain_semantics Other target)]
pub unsafe fn target(&self) -> Option<Retained<AnyObject>>;
#[method(setTarget:)]
pub unsafe fn setTarget(&self, target: Option<&AnyObject>);
#[cfg(all(feature = "UIAction", feature = "UIMenuElement"))]
#[method_id(@__retain_semantics Other primaryAction)]
pub unsafe fn primaryAction(&self) -> Option<Retained<UIAction>>;
#[cfg(all(feature = "UIAction", feature = "UIMenuElement"))]
#[method(setPrimaryAction:)]
pub unsafe fn setPrimaryAction(&self, primary_action: Option<&UIAction>);
#[cfg(all(feature = "UIMenu", feature = "UIMenuElement"))]
#[method_id(@__retain_semantics Other menu)]
pub unsafe fn menu(&self) -> Option<Retained<UIMenu>>;
#[cfg(all(feature = "UIMenu", feature = "UIMenuElement"))]
#[method(setMenu:)]
pub unsafe fn setMenu(&self, menu: Option<&UIMenu>);
#[cfg(feature = "UIContextMenuConfiguration")]
#[method(preferredMenuElementOrder)]
pub unsafe fn preferredMenuElementOrder(&self) -> UIContextMenuConfigurationElementOrder;
#[cfg(feature = "UIContextMenuConfiguration")]
#[method(setPreferredMenuElementOrder:)]
pub unsafe fn setPreferredMenuElementOrder(
&self,
preferred_menu_element_order: UIContextMenuConfigurationElementOrder,
);
#[method(changesSelectionAsPrimaryAction)]
pub unsafe fn changesSelectionAsPrimaryAction(&self) -> bool;
#[method(setChangesSelectionAsPrimaryAction:)]
pub unsafe fn setChangesSelectionAsPrimaryAction(
&self,
changes_selection_as_primary_action: bool,
);
#[method(isSelected)]
pub unsafe fn isSelected(&self) -> bool;
#[method(setSelected:)]
pub unsafe fn setSelected(&self, selected: bool);
#[method(isHidden)]
pub unsafe fn isHidden(&self) -> bool;
#[method(setHidden:)]
pub unsafe fn setHidden(&self, hidden: bool);
#[method(isSymbolAnimationEnabled)]
pub unsafe fn isSymbolAnimationEnabled(&self) -> bool;
#[method(setSymbolAnimationEnabled:)]
pub unsafe fn setSymbolAnimationEnabled(&self, symbol_animation_enabled: bool);
#[cfg(feature = "UIMenuElement")]
#[method_id(@__retain_semantics Other menuRepresentation)]
pub unsafe fn menuRepresentation(&self) -> Option<Retained<UIMenuElement>>;
#[cfg(feature = "UIMenuElement")]
#[method(setMenuRepresentation:)]
pub unsafe fn setMenuRepresentation(&self, menu_representation: Option<&UIMenuElement>);
#[cfg(feature = "UIBarButtonItemGroup")]
#[method_id(@__retain_semantics Other creatingFixedGroup)]
pub unsafe fn creatingFixedGroup(&self) -> Retained<UIBarButtonItemGroup>;
#[cfg(feature = "UIBarButtonItemGroup")]
#[method_id(@__retain_semantics Other creatingMovableGroupWithCustomizationIdentifier:)]
pub unsafe fn creatingMovableGroupWithCustomizationIdentifier(
&self,
customization_identifier: &NSString,
) -> Retained<UIBarButtonItemGroup>;
#[cfg(feature = "UIBarButtonItemGroup")]
#[method_id(@__retain_semantics Other creatingOptionalGroupWithCustomizationIdentifier:inDefaultCustomization:)]
pub unsafe fn creatingOptionalGroupWithCustomizationIdentifier_inDefaultCustomization(
&self,
customization_identifier: &NSString,
in_default_customization: bool,
) -> Retained<UIBarButtonItemGroup>;
#[cfg(all(feature = "UIBarCommon", feature = "UIControl", feature = "UIImage"))]
#[method(setBackgroundImage:forState:barMetrics:)]
pub unsafe fn setBackgroundImage_forState_barMetrics(
&self,
background_image: Option<&UIImage>,
state: UIControlState,
bar_metrics: UIBarMetrics,
);
#[cfg(all(feature = "UIBarCommon", feature = "UIControl", feature = "UIImage"))]
#[method_id(@__retain_semantics Other backgroundImageForState:barMetrics:)]
pub unsafe fn backgroundImageForState_barMetrics(
&self,
state: UIControlState,
bar_metrics: UIBarMetrics,
) -> Option<Retained<UIImage>>;
#[cfg(all(feature = "UIBarCommon", feature = "UIControl", feature = "UIImage"))]
#[method(setBackgroundImage:forState:style:barMetrics:)]
pub unsafe fn setBackgroundImage_forState_style_barMetrics(
&self,
background_image: Option<&UIImage>,
state: UIControlState,
style: UIBarButtonItemStyle,
bar_metrics: UIBarMetrics,
);
#[cfg(all(feature = "UIBarCommon", feature = "UIControl", feature = "UIImage"))]
#[method_id(@__retain_semantics Other backgroundImageForState:style:barMetrics:)]
pub unsafe fn backgroundImageForState_style_barMetrics(
&self,
state: UIControlState,
style: UIBarButtonItemStyle,
bar_metrics: UIBarMetrics,
) -> Option<Retained<UIImage>>;
#[cfg(feature = "UIColor")]
#[method_id(@__retain_semantics Other tintColor)]
pub unsafe fn tintColor(&self) -> Option<Retained<UIColor>>;
#[cfg(feature = "UIColor")]
#[method(setTintColor:)]
pub unsafe fn setTintColor(&self, tint_color: Option<&UIColor>);
#[cfg(feature = "UIBarCommon")]
#[method(setBackgroundVerticalPositionAdjustment:forBarMetrics:)]
pub unsafe fn setBackgroundVerticalPositionAdjustment_forBarMetrics(
&self,
adjustment: CGFloat,
bar_metrics: UIBarMetrics,
);
#[cfg(feature = "UIBarCommon")]
#[method(backgroundVerticalPositionAdjustmentForBarMetrics:)]
pub unsafe fn backgroundVerticalPositionAdjustmentForBarMetrics(
&self,
bar_metrics: UIBarMetrics,
) -> CGFloat;
#[cfg(all(feature = "UIBarCommon", feature = "UIGeometry"))]
#[method(setTitlePositionAdjustment:forBarMetrics:)]
pub unsafe fn setTitlePositionAdjustment_forBarMetrics(
&self,
adjustment: UIOffset,
bar_metrics: UIBarMetrics,
);
#[cfg(all(feature = "UIBarCommon", feature = "UIGeometry"))]
#[method(titlePositionAdjustmentForBarMetrics:)]
pub unsafe fn titlePositionAdjustmentForBarMetrics(
&self,
bar_metrics: UIBarMetrics,
) -> UIOffset;
#[cfg(all(feature = "UIBarCommon", feature = "UIControl", feature = "UIImage"))]
#[method(setBackButtonBackgroundImage:forState:barMetrics:)]
pub unsafe fn setBackButtonBackgroundImage_forState_barMetrics(
&self,
background_image: Option<&UIImage>,
state: UIControlState,
bar_metrics: UIBarMetrics,
);
#[cfg(all(feature = "UIBarCommon", feature = "UIControl", feature = "UIImage"))]
#[method_id(@__retain_semantics Other backButtonBackgroundImageForState:barMetrics:)]
pub unsafe fn backButtonBackgroundImageForState_barMetrics(
&self,
state: UIControlState,
bar_metrics: UIBarMetrics,
) -> Option<Retained<UIImage>>;
#[cfg(all(feature = "UIBarCommon", feature = "UIGeometry"))]
#[method(setBackButtonTitlePositionAdjustment:forBarMetrics:)]
pub unsafe fn setBackButtonTitlePositionAdjustment_forBarMetrics(
&self,
adjustment: UIOffset,
bar_metrics: UIBarMetrics,
);
#[cfg(all(feature = "UIBarCommon", feature = "UIGeometry"))]
#[method(backButtonTitlePositionAdjustmentForBarMetrics:)]
pub unsafe fn backButtonTitlePositionAdjustmentForBarMetrics(
&self,
bar_metrics: UIBarMetrics,
) -> UIOffset;
#[cfg(feature = "UIBarCommon")]
#[method(setBackButtonBackgroundVerticalPositionAdjustment:forBarMetrics:)]
pub unsafe fn setBackButtonBackgroundVerticalPositionAdjustment_forBarMetrics(
&self,
adjustment: CGFloat,
bar_metrics: UIBarMetrics,
);
#[cfg(feature = "UIBarCommon")]
#[method(backButtonBackgroundVerticalPositionAdjustmentForBarMetrics:)]
pub unsafe fn backButtonBackgroundVerticalPositionAdjustmentForBarMetrics(
&self,
bar_metrics: UIBarMetrics,
) -> CGFloat;
}
);
extern_methods!(
#[cfg(feature = "UIBarItem")]
unsafe impl UIBarButtonItem {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
}
);
extern_methods!(
#[cfg(feature = "UIBarItem")]
unsafe impl UIBarButtonItem {}
);
#[cfg(all(feature = "UIBarItem", feature = "UISpringLoadedInteractionSupporting"))]
unsafe impl UISpringLoadedInteractionSupporting for UIBarButtonItem {}
extern_methods!(
#[cfg(feature = "UIBarItem")]
unsafe impl UIBarButtonItem {
#[cfg(feature = "objc2-symbols")]
#[method(addSymbolEffect:)]
pub unsafe fn addSymbolEffect(&self, symbol_effect: &NSSymbolEffect);
#[cfg(feature = "objc2-symbols")]
#[method(addSymbolEffect:options:)]
pub unsafe fn addSymbolEffect_options(
&self,
symbol_effect: &NSSymbolEffect,
options: &NSSymbolEffectOptions,
);
#[cfg(feature = "objc2-symbols")]
#[method(addSymbolEffect:options:animated:)]
pub unsafe fn addSymbolEffect_options_animated(
&self,
symbol_effect: &NSSymbolEffect,
options: &NSSymbolEffectOptions,
animated: bool,
);
#[cfg(feature = "objc2-symbols")]
#[method(removeSymbolEffectOfType:)]
pub unsafe fn removeSymbolEffectOfType(&self, symbol_effect: &NSSymbolEffect);
#[cfg(feature = "objc2-symbols")]
#[method(removeSymbolEffectOfType:options:)]
pub unsafe fn removeSymbolEffectOfType_options(
&self,
symbol_effect: &NSSymbolEffect,
options: &NSSymbolEffectOptions,
);
#[cfg(feature = "objc2-symbols")]
#[method(removeSymbolEffectOfType:options:animated:)]
pub unsafe fn removeSymbolEffectOfType_options_animated(
&self,
symbol_effect: &NSSymbolEffect,
options: &NSSymbolEffectOptions,
animated: bool,
);
#[method(removeAllSymbolEffects)]
pub unsafe fn removeAllSymbolEffects(&self);
#[cfg(feature = "objc2-symbols")]
#[method(removeAllSymbolEffectsWithOptions:)]
pub unsafe fn removeAllSymbolEffectsWithOptions(&self, options: &NSSymbolEffectOptions);
#[cfg(feature = "objc2-symbols")]
#[method(removeAllSymbolEffectsWithOptions:animated:)]
pub unsafe fn removeAllSymbolEffectsWithOptions_animated(
&self,
options: &NSSymbolEffectOptions,
animated: bool,
);
#[cfg(all(feature = "UIImage", feature = "objc2-symbols"))]
#[method(setSymbolImage:withContentTransition:)]
pub unsafe fn setSymbolImage_withContentTransition(
&self,
symbol_image: &UIImage,
transition: &NSSymbolContentTransition,
);
#[cfg(all(feature = "UIImage", feature = "objc2-symbols"))]
#[method(setSymbolImage:withContentTransition:options:)]
pub unsafe fn setSymbolImage_withContentTransition_options(
&self,
symbol_image: &UIImage,
transition: &NSSymbolContentTransition,
options: &NSSymbolEffectOptions,
);
}
);