| Inherits from | |
| Conforms to | |
| Framework | /System/Library/Frameworks/AppKit.framework |
| Availability | Available in Mac OS X v10.0 and later. |
| Companion guide | |
| Declared in | NSStatusItem.h |
The NSStatusItem class represents the individual elements displayed within an NSStatusBar object. Instances are created by the NSStatusBar method statusItemWithLength:, which automatically adds the new status item to the status bar. The appearance and behavior of the status item are then set using the various NSStatusItem methods, such as setTitle: and setAction:.
– setTitle:
– title
– setAttributedTitle:
– attributedTitle
– setImage:
– image
– setAlternateImage:
– alternateImage
– setLength:
– length
– setHighlightMode:
– highlightMode
– setToolTip:
– toolTip
– setEnabled:
– isEnabled
– setTarget:
– target
– setAction:
– action
– setDoubleAction:
– doubleAction
– sendActionOn:
– setMenu:
– menu
– popUpStatusItemMenu:
Returns the selector that is sent to the receiver’s target when the user clicks the receiver.
- (SEL)action
NSStatusItem.hReturns the alternate image that is displayed when a status bar item is highlighted.
- (NSImage *)alternateImage
NSStatusItem.hReturns the attributed string that is displayed at the receiver’s position in the status bar
- (NSAttributedString *)attributedTitle
.
NSStatusItem.hReturns the selector that is sent to the receiver’s target when the user double-clicks the receiver.
- (SEL)doubleAction
NSStatusItem.hDraws the menu background pattern for a custom status-bar item in regular or highlight pattern.
- (void)drawStatusBarBackgroundInRect:(NSRect)rect withHighlight:(BOOL)highlight
A rectangle defining the area of a custom status-bar item.
YES to draw the background pattern in the standard highlight pattern, NO to not highlight the pattern..
You can use this method to help a custom status-bar item emulate the behavior of a standard item.
NSStatusItem.hReturns whether the receiver is highlighted when clicked.
- (BOOL)highlightMode
NSStatusItem.hReturns the image that is displayed at the receiver’s position in the status bar.
- (NSImage *)image
Returns nil if an image has not been set.
NSStatusItem.hReturns whether the receiver is enabled and responding to clicks.
- (BOOL)isEnabled
NSStatusItem.hReturns the amount of space allocated to the receiver within its status bar.
- (CGFloat)length
If the status bar is horizontal, the return value is the width of the status item. Besides a physical length, the return value may be NSSquareStatusItemLength or NSVariableStatusItemLength (see NSStatusBar “Constants”), if the status item size is either determined by the status bar thickness or allowed to vary according to the status item’s true size, respectively.
– setLength:– statusItemWithLength: (NSStatusBar)NSStatusItem.hReturns the drop-down menu that is displayed when the receiver is clicked.
- (NSMenu *)menu
NSStatusItem.hDisplays a menu under a custom status bar item.
- (void)popUpStatusItemMenu:(NSMenu *)menu
The NSMenu object to display.
You can use this method to cause a popup menu to appear under a custom status bar item when the user clicks the item. Note that the view of the receiver must exist (that is, it must not be nil).
NSStatusItem.hSets the conditions on which the receiver sends action messages to its target.
- (NSInteger)sendActionOn:(NSInteger)mask
Takes one or more of the following bit masks described in “Constants” section of the NSEvent class reference: NSLeftMouseUpMask, NSLeftMouseDownMask, NSLeftMouseDraggedMask, and NSPeriodicMask. Bitwise-OR multiple bit masks.
A bit mask containing the previous settings. This bit mask uses the same values as specified in the mask parameter.
NSStatusItem.hSets the selector that is sent to the receiver’s target when the receiver is clicked.
- (void)setAction:(SEL)action
If the receiver has a menu set, action is not sent to the target when the receiver is clicked; instead, the click causes the menu to appear.
See Action Messages for additional information on action messages.
NSStatusItem.hSets an alternate image to be displayed when a status bar item is highlighted.
- (void)setAlternateImage:(NSImage *)image
NSStatusItem.hSets the attributed string that is displayed at the receiver’s position in the status bar.
- (void)setAttributedTitle:(NSAttributedString *)title
If an image is also set, the title appears to the right of the image.
NSStatusItem.hSets the selector that is sent to the receiver’s target when the receiver is double-clicked.
- (void)setDoubleAction:(SEL)action
For the method to have any effect, the receiver’s action and target must be set to the class in which the selector is declared. See Action Messages for additional information on action messages.
NSStatusItem.hSets whether the receiver is enabled to respond to clicks.
- (void)setEnabled:(BOOL)flag
NSStatusItem.hSets whether the receiver is highlighted when it is clicked.
- (void)setHighlightMode:(BOOL)flag
The default is NO, which means the receiver isn’t highlighted when it is clicked.
NSStatusItem.hSets the image that is displayed at the receiver’s position in the status bar to image.
- (void)setImage:(NSImage *)image
If a title is also set, the image appears to the left of the title.
NSStatusItem.hSets the amount of space in the status bar that should be allocated to the receiver.
- (void)setLength:(CGFloat)len
If the status bar is horizontal, len is the horizontal space to allocate. In addition to a fixed length, len can be NSSquareStatusItemLength or NSVariableStatusItemLength (see “Constants” in the NSStatusBar class reference) to allow the status bar to allocate (and adjust) the space according to either the status bar’s thickness or the status item’s true size.
– length– statusItemWithLength: (NSStatusBar)NSStatusItem.hSets the pull-down menu that is displayed when the receiver is clicked.
- (void)setMenu:(NSMenu *)menu
The NSMenu object to display.
When set, the receiver’s single click action behavior is not used. The menu can be removed by setting menu to nil.
NSStatusItem.hSets the target object to which the receiver’s action message is sent when the receiver is clicked.
- (void)setTarget:(id)target
If the receiver has a menu set, the action is not sent to target when the receiver is clicked; instead, the click causes the menu to appear.
NSStatusItem.hSets the string that is displayed at the receiver’s position in the status bar.
- (void)setTitle:(NSString *)title
If an image is also set, the title appears to the right of the image.
NSStatusItem.hSets the tool tip string that is displayed when the cursor pauses over the receiver.
- (void)setToolTip:(NSString *)toolTip
A string that functions as the title of the status item.
NSStatusItem.hSets the custom view that is displayed at the receiver’s position in the status bar.
- (void)setView:(NSView *)view
The NSView object representing the custom view.
Setting a custom view overrides all the other appearance and behavior settings defined by NSStatusItem. The custom view is responsible for drawing itself and providing its own behaviors, such as processing mouse clicks and sending action messages.
NSStatusItem.hReturns the status bar in which the receiver is displayed.
- (NSStatusBar *)statusBar
NSStatusItem.hReturns the target to which the receiver’s action message is sent when the user clicks the receiver.
- (id)target
NSStatusItem.hReturns the string that is displayed at the receiver’s position in the status bar.
- (NSString *)title
NSStatusItem.hReturns the tool tip string that is displayed when the cursor pauses over the receiver.
- (NSString *)toolTip
NSStatusItem.hReturns the custom view that is displayed at the receiver’s position in the status bar.
- (NSView *)view
NSStatusItem.hLast updated: 2007-03-05