Setting Window Collection Behavior
The are a number of different options that can be set regarding the window collection behavior of a window. They include a window’s behavior when using Spaces, Exposé, and the “Cycle Through Windows” command. These options can be set using the setCollectionBehavior:
method of NSWindow
, by passing in at most one constant from each group, combined using bitwise or operators. The current options may be accessed via the collectionBehavior
method.
Spaces Collection Behavior
There are three options that can be set for a window’s Spaces collection behavior. The default is NSWindowCollectionBehaviorDefault
, which allows the window to be associated with one space at a time. The second option is NSWindowCollectionBehaviorCanJoinAllSpaces
. This option causes the window to appear on all spaces, like the menu bar. The third option is NSWindowCollectionBehaviorMoveToActiveSpace
. This causes the window to switch to the active space when it is made active. Only one of these options may be used at a time.
If a window is currently associated with the active space, isOnActiveSpace
returns YES
. Otherwise, it returns NO
. Additionally, you can get an array of the window numbers of windows on one or all spaces using the method windowNumbersWithOptions:
and specified your desired options. The possible options are specified by NSWindowNumberListOptions
.
Exposé Collection Behavior
There are also three options that can be set for a window’s Exposé collection behavior. If a window has a window level of NSNormalWindowLevel
, the default behavior is NSWindowCollectionBehaviorManaged
, which causes the window to participate in both Spaces and Exposé. NSWindowCollectionBehaviorTransient
causes the window to float in Spaces and be hidden in Exposé. This is the default behavior if the window level is not NSNormalWindowLevel
. The final option is NSWindowCollectionBehaviorStationary
, which causes the window to be unaffected by Exposé; i.e. it stays visible and does not move, like the desktop window. Only one of these options may be used at a time.
Window Cycling Behavior
There are two options: NSWindowCollectionBehaviorParticipatesInCycle
and NSWindowCollectionBehaviorIgnoresCycle
. These options cause the window to participate in the window cycle for the “Cycle Through Windows” menu option or not participate in it, respectively.
Copyright © 2002, 2009 Apple Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2009-11-27