Contents

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 isFilename parameter.

  • isFilename:

    If False, aString appears literally in the menu; otherwise, aString is assumed to be a converted pathname with the name of the file preceding the path (the way the NSWindow method 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.

See Also

Related Documentation

Managing the Window Menu