TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | BSD |
ReleasedLast Release | Dec 2014 |
Maintained by Unclaimed.
OBMenuBarWindow is an NSWindow subclass that adds the ability to attach the window to an icon in the menu bar in OS X.
It emulates much of the look and feel of NSPopover but retains the appearance and functionality of a regular window, including the title bar and traffic light controls. You can drag the window to and from the menu bar icon to attach and detach it from the menu bar.
Notes:
Info.plist
file for LSUIElement
of Boolean type and set its value to YES
. A side-effect of doing this is that the application’s dock icon will be hidden.OBMenuBarWindowDidAttachToMenuBar
and OBMenuBarWindowDidDetachFromMenuBar
notifications from the window object to be notified when the user attaches or detaches the window from the menu bar.Download the source and add OBMenuBarWindow.h
and OBMenuBarWindow.m
to your project.
OBMenuBarWindow
.menuBarIcon
property.hasMenuBarIcon
property to YES
.Menu bar icon
hasMenuBarIcon
- whether the window has a menu bar icon (BOOL
, default is NO
).menuBarIcon
- the menu bar icon image (NSImage
).highlightedMenuBarIcon
- the highlighted version of the menu bar icon (NSImage
).statusItem
- the status item associated with the window (NSStatusItem
).Attaching to the menu bar
attachedToMenuBar
- whether the window is attached to the menu bar (BOOL
, default is NO
).isDetachable
- whether the window can be detached from the menu bar (BOOL
, default is YES
).hideWindowControlsWhenAttached
- whether to hide the window "traffic lights" when it is attached to the menu bar (BOOL
, default is YES
).snapDistance
- the threshold distance between the centre of the title bar and the menu bar icon at which to "snap" the window to the menu bar when dragging (CGFloat
, default is 30 pixels).distanceFromMenuBar
- the distance between the window and the menu bar when the window is attached (CGFloat
, default is 0 pixels).arrowSize
- the size of the arrow that points to the menu bar icon (NSSize
, default is {20, 10}
).Title bar
titleBarHeight
- the height of the title bar (CGFloat
, default is 22 pixels).titleTextField
- the window title text field (NSTextField
).toolbarView
- the view containing the window's toolbar items (NSView
).Read the Documentation.
OBMenuBarWindow was created by Oliver Bolton.
OBMenuBarWindow is licensed under the Modified BSD License. See the LICENSE
file for more information.