addWindowsItem(_:title:filename:)
Adds an item to the Window menu for a given window.
Declaration
func addWindowsItem(_ win: NSWindow, title string: String, filename isFilename: Bool)Parameters
- win:
The window being added to the menu. If this window object already exists in the Window menu, this method has no effect.
- string:
The string to display for the window’s menu item. How the string is interpreted is dependent on the value in the
isFilenameparameter. - isFilename:
If False,
aStringappears literally in the menu; otherwise,aStringis assumed to be a converted pathname with the name of the file preceding the path (the way theNSWindowmethod Settitlewithrepresentedfilename(_:) shows a title)
Discussion
You rarely need to invoke this method directly because Cocoa places an item in the Window menu automatically whenever you set the title of an NSWindow object.