objc2_app_kit/generated/NSItemBadge.rs
1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5use objc2_foundation::*;
6
7use crate::*;
8
9extern_class!(
10 /// `NSItemBadge` represents a badge that can be attached to an `NSToolbarItem`.
11 ///
12 /// This badge provides a way to display small visual indicators, such as counts and text labels, within a toolbar item. Badges can be used to highlight important information,
13 /// such as unread notifications or status indicators.
14 ///
15 /// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nsitembadge?language=objc)
16 #[unsafe(super(NSObject))]
17 #[derive(Debug, PartialEq, Eq, Hash)]
18 pub struct NSItemBadge;
19);
20
21extern_conformance!(
22 unsafe impl NSObjectProtocol for NSItemBadge {}
23);
24
25impl NSItemBadge {
26 extern_methods!(
27 /// Creates a badge displaying a localized numerical count.
28 ///
29 ///
30 /// Parameter `count`: The integer value to localize and display in the badge.
31 ///
32 /// Returns: A new NSItemBadge instance with the localized specified count.
33 #[unsafe(method(badgeWithCount:))]
34 #[unsafe(method_family = none)]
35 pub fn badgeWithCount(count: NSInteger) -> Retained<NSItemBadge>;
36
37 /// Creates a badge displaying a text.
38 ///
39 ///
40 /// Parameter `text`: The text to be displayed inside the badge.
41 ///
42 /// Returns: A new `NSItemBadge` instance with the specified text.
43 #[unsafe(method(badgeWithText:))]
44 #[unsafe(method_family = none)]
45 pub fn badgeWithText(text: &NSString) -> Retained<NSItemBadge>;
46
47 /// Creates a badge styled as an indicator. In this context, an indicator is simply a badge without any text.
48 ///
49 ///
50 /// Returns: A new `NSItemBadge` instance styled as an indicator.
51 #[unsafe(method(indicatorBadge))]
52 #[unsafe(method_family = none)]
53 pub fn indicatorBadge() -> Retained<NSItemBadge>;
54
55 /// The text to be displayed within the badge.
56 #[unsafe(method(text))]
57 #[unsafe(method_family = none)]
58 pub fn text(&self) -> Retained<NSString>;
59 );
60}
61
62/// Methods declared on superclass `NSObject`.
63impl NSItemBadge {
64 extern_methods!(
65 #[unsafe(method(init))]
66 #[unsafe(method_family = init)]
67 pub fn init(this: Allocated<Self>) -> Retained<Self>;
68
69 #[unsafe(method(new))]
70 #[unsafe(method_family = new)]
71 pub fn new() -> Retained<Self>;
72 );
73}
74
75impl DefaultRetained for NSItemBadge {
76 #[inline]
77 fn default_retained() -> Retained<Self> {
78 Self::new()
79 }
80}