Retired Document
Important: This document may not represent best practices for current development. Links to downloads and other resources may no longer be valid.
Window Manager Reference (Legacy)
| Framework | Carbon/Carbon.h |
| Declared in | HIToolboxDebugging.h HIWindowViews.h IOMacOSTypes.h MacWindows.h Quickdraw.h |
Overview
Your application uses the Window Manager to create and manage windows. For example, your application uses the Window Manager to create and display a new window when the user creates a new document or opens an existing document. When the user clicks or holds down the mouse button while the cursor is in a window created by your application, you use the Window Manager to determine the location of the mouse action and to alter the window display as appropriate. When the user closes a window, you use the Window Manager to remove the window from the screen.
A Macintosh application uses windows for most communication with the user, from discrete interactions such as presenting and acknowledging alert boxes to open-ended interactions such as creating and editing documents. Users generally type words and formulas, draw pictures, or otherwise enter data in a window on the screen. Your application typically lets the user save this data in a file, open saved files, and view the saved data in a window.
A window can be any size or shape, and the user can display any number of windows, within the limits of available memory, on the screen at once.
The Window Manager defines a set of standard windows and provides a set of routines for managing them. The Window Manager helps your application display windows that are consistent with the Macintosh user interface.
Carbon supports the Window Manager. Be aware, however, that if you use custom window definition procedures (also known as WDEFs), you must move them out of resources and compile them into your application. In addition:
Your application must use the functions defined by the Window Manager whenever it creates and disposes of Window Manager data structures. For example, instead of directly creating and disposing of window records, applications must call Window Manager functions such as
CreateNewWindowandDisposeWindow.You must revise your application so that it accesses Window Manager data structures only through accessor functions.
You are encouraged to adopt the standard Mac OS window definition procedures in your application. Applications that use the standard Mac OS window definition procedures inherit the Mac OS human interface appearance on Mac OS 9 and Mac OS X. Applications that use custom window definition procedures work correctly, but because custom definition procedures invoke their own drawing routines, the Mac OS can’t draw these applications with the current appearance (unless you specifically use Appearance Manager drawing primitives).
Functions by Task
Accessing Information About a Window
-
IsValidWindowPtr -
GetWindowGreatestAreaDevice -
HIWindowGetGreatestAreaDisplay -
HIWindowCopyShape -
GetWindowList -
GetWindowWidgetHilite -
IsWindowModified -
SetWindowModified -
HIWindowGetCGWindowID -
HIWindowFromCGWindowID -
GetWindowRegionDeprecated in OS X v10.5 -
HIWindowGetScaleModeDeprecated in OS X v10.7
Activating Window Path Pop-Up Menus
-
IsWindowPathSelectEvent -
WindowPathSelect -
IsWindowPathSelectClickDeprecated in OS X v10.5
Associating Data With Windows
-
GetWindowProperty -
SetWindowProperty -
GetWindowPropertySize -
RemoveWindowProperty -
ChangeWindowPropertyAttributes -
GetWindowPropertyAttributes
Collapsing Windows
Creating, Storing, and Closing Windows
-
CreateNewWindow -
CreateCustomWindow -
HIWindowCreate -
DisposeWindow -
CreateWindowFromCollectionDeprecated in OS X v10.5 -
CreateWindowFromResourceDeprecated in OS X v10.5 -
StoreWindowIntoCollectionDeprecated in OS X v10.5
Displaying Floating Windows and Window Animations
Displaying Windows
-
ActivateWindow -
IsWindowActive -
HiliteWindow -
SelectWindow -
ShowWindow -
HideWindow -
ShowHide -
BringToFront -
SendBehind -
HIWindowInvalidateShadow
Dragging Proxy Icons
-
BeginWindowProxyDrag -
EndWindowProxyDrag -
HiliteWindowFrameForDrag -
TrackWindowProxyDrag -
TrackWindowProxyFromExistingDrag -
HIWindowTrackProxyDrag
Establishing Proxy Icons
-
GetWindowProxyAlias -
SetWindowProxyAlias -
GetWindowProxyIcon -
SetWindowProxyIcon -
RemoveWindowProxy -
SetWindowProxyCreatorAndType -
HIWindowGetProxyFSRef -
HIWindowSetProxyFSRef
Getting and Setting Window Structure Fields
-
GetNextWindow -
GetWindowKind -
SetWindowKind -
GetWindowPort -
SetPortWindowPort -
GetWindowPortBounds -
GetWindowStandardState -
SetWindowStandardState -
GetWindowUserState -
SetWindowUserState -
IsWindowHilited -
IsWindowLatentVisible -
IsWindowVisible -
GetWindowStructurePort -
GetWindowStructureWidths
Handling Mouse Events in Windows
Locating Windows
-
ActiveNonFloatingWindow -
FrontNonFloatingWindow -
FindWindow -
FindWindowOfClass -
HIWindowFindAtLocation -
GetFrontWindowOfClass -
GetNextWindowOfClass -
GetPreviousWindow -
FrontWindowDeprecated in OS X v10.5
Maintaining the Update Region
-
BeginUpdate -
EndUpdate -
InvalWindowRect -
InvalWindowRgn -
IsWindowUpdatePending -
ValidWindowRect -
ValidWindowRgn
Managing Activation Scope
Managing Dock Tiles
-
HIWindowCreateCollapsedDockTileContext -
HIWindowReleaseCollapsedDockTileContext -
GetWindowDockTileMenu -
SetWindowDockTileMenu -
UpdateCollapsedWindowDockTile -
CreateQDContextForCollapsedWindowDockTileDeprecated in OS X v10.5 -
ReleaseQDContextForCollapsedWindowDockTileDeprecated in OS X v10.5
Managing Modality
Managing Themes
Managing Toolbars
-
GetWindowToolbar -
SetWindowToolbar -
ShowHideWindowToolbar -
IsWindowToolbarVisible -
HIWindowSetToolbarView
Managing Transitions
Managing Transparency
Managing UPPs
-
DisposeWindowDefUPPDeprecated in OS X v10.5 -
DisposeWindowPaintUPPDeprecated in OS X v10.5 -
InvokeWindowDefUPPDeprecated in OS X v10.5 -
InvokeWindowPaintUPPDeprecated in OS X v10.5 -
NewWindowDefUPPDeprecated in OS X v10.5 -
NewWindowPaintUPPDeprecated in OS X v10.5
Managing Window Attributes
-
GetWindowAttributes -
GetAvailableWindowAttributes -
ChangeWindowAttributes -
HIWindowTestAttribute -
HIWindowChangeAttributes -
HIWindowIsAttributeAvailable
Managing Window Availability
Managing Window Classes
-
GetWindowClass -
HIWindowChangeClass -
IsValidWindowClass -
SetWindowClassDeprecated in OS X v10.5
Managing Window Features
Managing Window Focus
Managing Window Groups
-
ChangeWindowGroupAttributes -
CopyWindowGroupName -
CountWindowGroupContents -
CreateWindowGroup -
DebugPrintAllWindowGroups -
DebugPrintWindowGroup -
GetIndexedWindow -
GetWindowGroup -
GetWindowGroupAttributes -
GetWindowGroupContents -
GetWindowGroupLevel -
GetWindowGroupLevelOfType -
GetWindowGroupOfClass -
GetWindowGroupOwner -
GetWindowGroupParent -
GetWindowGroupRetainCount -
GetWindowGroupSibling -
GetWindowIndex -
IsWindowContainedInGroup -
ReleaseWindowGroup -
RetainWindowGroup -
SendWindowGroupBehind -
SetWindowGroup -
SetWindowGroupLevel -
SetWindowGroupLevelOfType -
SetWindowGroupName -
SetWindowGroupOwner -
SetWindowGroupParent
Managing Window Titles
-
CopyWindowAlternateTitle -
SetWindowAlternateTitle -
CopyWindowTitleAsCFString -
SetWindowTitleWithCFString
Manipulating Drawers
-
HIWindowCopyDrawers -
OpenDrawer -
CloseDrawer -
GetDrawerCurrentEdge -
GetDrawerPreferredEdge -
SetDrawerPreferredEdge -
GetDrawerOffsets -
SetDrawerOffsets -
GetDrawerParent -
SetDrawerParent -
GetDrawerState -
ToggleDrawer
Manipulating Sheets
Manipulating Window Color Information
-
GetWindowContentColor -
GetWindowContentPattern -
SetWindowContentColor -
GetWRefCon -
SetWindowContentPattern -
SetWRefCon -
GetWindowPicDeprecated in OS X v10.5 -
SetWindowPicDeprecated in OS X v10.5
Referencing Windows
-
CloneWindowDeprecated in OS X v10.5 -
GetWindowOwnerCountDeprecated in OS X v10.5 -
GetWindowRetainCountDeprecated in OS X v10.5 -
ReleaseWindowDeprecated in OS X v10.5 -
RetainWindowDeprecated in OS X v10.5
Scrolling
Sizing and Positioning Windows
-
GetWindowBounds -
HIWindowGetBounds -
SetWindowBounds -
HIWindowSetBounds -
MoveWindowStructure -
RepositionWindow -
ResizeWindow -
GetAvailableWindowPositioningBounds -
HIWindowGetAvailablePositioningBounds -
GetAvailableWindowPositioningRegion -
HIWindowCopyAvailablePositioningShape -
ConstrainWindowToScreen -
HIWindowConstrain -
GetWindowResizeLimits -
SetWindowResizeLimits
Updating the Screen
Using Default and Cancel Buttons
You can use these functions to add dialog-like button controls to normal windows.
Zooming Windows
-
GetWindowIdealUserState -
HIWindowGetIdealUserState -
IsWindowInStandardState -
HIWindowIsInStandardState -
SetWindowIdealUserState -
HIWindowSetIdealUserState -
ZoomWindowIdeal
Miscellaneous
-
CreateStandardWindowMenu -
GetWindowFromPort -
HIWindowFlush -
RegisterWindowDefinition -
ReshapeCustomWindow -
InstallWindowContentPaintProcDeprecated in OS X v10.5
Legacy Functions
-
CalcVisDeprecated in OS X v10.5 -
CalcVisBehindDeprecated in OS X v10.5 -
CheckUpdateDeprecated in OS X v10.5 -
ClipAboveDeprecated in OS X v10.5 -
DragGrayRgnDeprecated in OS X v10.5 -
DragTheRgnDeprecated in OS X v10.5 -
DrawGrowIconDeprecated in OS X v10.5 -
GetGrayRgnDeprecated in OS X v10.5 -
GetNewCWindowDeprecated in OS X v10.5 -
GetNewWindowDeprecated in OS X v10.5 -
GetWindowProxyFSSpecDeprecated in OS X v10.5 -
GetWTitleDeprecated in OS X v10.5 -
GetWVariantDeprecated in OS X v10.5 -
GrowWindowDeprecated in OS X v10.5 -
NewCWindowDeprecated in OS X v10.5 -
NewWindowDeprecated in OS X v10.5 -
PaintBehindDeprecated in OS X v10.5 -
PaintOneDeprecated in OS X v10.5 -
SetWindowProxyFSSpecDeprecated in OS X v10.5 -
SetWTitleDeprecated in OS X v10.5
Functions
ActivateWindow
Activates or deactivates a window.
OSStatus ActivateWindow ( WindowRef inWindow, Boolean inActivate );
Parameters
- inWindow
The window to activate or deactivate.
- inActivate
Pass
trueto activate the window,falseotherwise.
Return Value
A result code. See “Window Manager Result Codes.”
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hActiveNonFloatingWindow
Returns the currently active nonfloating window.
WindowRef ActiveNonFloatingWindow ( void );
Return Value
A reference to the active window.
Discussion
Note that the active window is not necessarily the frontmost window, and it is not necessarily the window with user focus. Call GetUserFocusWindow to get the window that has user focus.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hAreFloatingWindowsVisible
Indicates whether an application’s floating windows are currently visible.
Boolean AreFloatingWindowsVisible ( void );
Return Value
A Boolean whose value is true if the application’s floating windows are currently shown or false if the application’s floating windows are currently hidden.
Discussion
This function checks the visibility state of an application’s floating windows, which are hidden automatically when the application receives a suspend event and are made visible automatically when the application receives a resume event.
Special Considerations
The AreFloatingWindowsVisible function operates only upon windows created with the kFloatingWindowClass constant; see “Window Class Constants” for more details on this constant.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hBeginUpdate
Starts updating a window when you receive an update event for that window.
void BeginUpdate ( WindowRef window );
Parameters
- window
The window that is to be updated when an update event is received. Your application gets this information from the
messagefield in the update event structure.
Discussion
The BeginUpdate function limits the visible region of the window’s graphics port to the intersection of the visible region and the update region it then sets the window’s update region to an empty region. After calling BeginUpdate, your application redraws either the entire content region or only the visible region. In either case, only the parts of the window that require updating are actually redrawn on the screen.
Every call to BeginUpdate must be matched with a subsequent call to EndUpdate after your application redraws the content region. BeginUpdate and EndUpdate can’t be nested. That is, you must call EndUpdate before the next call to BeginUpdate.
In Mac OS X, you only receive one update event. If you don’t call BeginUpdate, you won’t receive any further update events until the window is invalidated again.
Special Considerations
This function should not be used on composited windows. Modifying a composited window's update region does not affect the area of the window to be drawn. A composited window does not use its window update region to control drawing. Instead, a composited window determines what to draw by looking at the invalid regions of the views contained in the window.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hBeginWindowProxyDrag
Creates the drag reference and the drag image when the user drags a proxy icon.
OSStatus BeginWindowProxyDrag ( WindowRef window, DragRef *outNewDrag, RgnHandle outDragOutlineRgn );
Parameters
- window
The window whose proxy icon is being dragged.
- outNewDrag
On input, a pointer to a value of type
DragRef. On return, the value refers to the current drag process.- outDragOutlineRgn
On input, a value of type
RgnHandle. Your application can create this handle with a call to the QuickDraw functionNewRgn. On return, this region is set to the outline of the icon being dragged.
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
Typically, if the proxy icon represents a type of object (currently, file system entities such as files, folders, and volumes) supported by the Window Manager, the Window Manager can handle all aspects of the drag process itself, and your application should call the function TrackWindowProxyDrag. However, if the proxy icon represents a type of data that the Window Manager does not support, or if you want to implement custom dragging behavior, your application should call the function TrackWindowProxyFromExistingDrag.
The TrackWindowProxyFromExistingDrag function accepts an existing drag reference and adds file data if the window contains a file proxy. If your application uses TrackWindowProxyFromExistingDrag, you then have the choice of using this function in conjunction with the functions BeginWindowProxyDrag and EndWindowProxyDrag or simply calling TrackWindowProxyFromExistingDrag and handling all aspects of creating and disposing of the drag yourself.
Specifically, your application can call BeginWindowProxyDrag to set up the drag image and drag reference. Your application must then track the drag, using TrackWindowProxyFromExistingDrag, and do any required moving of data and, finally, call EndWindowProxyDrag to dispose of the drag reference. BeginWindowProxyDrag should not be used for types handled by the Window Manager unless the application wants to implement custom dragging behavior for those types.
Your application detects a drag when the function FindWindow returns the inProxyIcon result code.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hBringToFront
Brings a window to the front.
void BringToFront ( WindowRef window );
Parameters
- window
The window that is to be brought to the front.
Discussion
The BringToFront function puts the specified window at the beginning of the window list and redraws the window in front of all others on the screen. It does not change the window’s highlighting or make it active.
Your application does not ordinarily call BringToFront. The user interface guidelines specify that the frontmost window should be the active window. To bring a window to the front and make it active, call the function SelectWindow.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hChangeWindowAttributes
Changes a window’s attributes.
OSStatus ChangeWindowAttributes ( WindowRef window, WindowAttributes setTheseAttributes, WindowAttributes clearTheseAttributes );
Parameters
- window
The window whose attributes you want to change.
- setTheseAttributes
The attributes you want to set. Pass
kWindowNoAttributesif you do not want to set any attributes. See “Window Attributes” for a list of window attributes.- clearTheseAttributes
The attributes you want to clear (if any). Pass
kWindowNoAttributesif you do not want to clear any attributes. See “Window Attributes” for a list of window attributes.
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
If the changed attributes affect the visible window’s frame, the window regions are recalculated and the window is redrawn.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hChangeWindowGroupAttributes
Changes the attributes of a window group.
OSStatus ChangeWindowGroupAttributes ( WindowGroupRef inGroup, WindowGroupAttributes setTheseAttributes, WindowGroupAttributes clearTheseAttributes );
Parameters
- inGroup
The window group whose attributes you want to set.
- setTheseAttributes
The attributes you want to set. See “Window Group Attributes” for a list of possible attributes.
- clearTheseAttributes
The attributes you want to clear (if any). See “Window Group Attributes” for a list of possible attributes.
Return Value
A result code. See “Window Manager Result Codes.”
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hChangeWindowPropertyAttributes
Changes attributes associated with a window property.
OSStatus ChangeWindowPropertyAttributes ( WindowRef window, OSType propertyCreator, OSType propertyTag, OptionBits attributesToSet, OptionBits attributesToClear );
Parameters
- window
The window whose property attributes are to be changed.
- propertyCreator
The property creator.
- propertyTag
The property tag.
- attributesToSet
The attributes to set. For a possible value, see “Window Property Persistent Constant.”
- attributesToClear
The attributes to clear. For a possible value, see “Window Property Persistent Constant.”
Return Value
A result code. See “Window Manager Result Codes.”
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hCloseDrawer
Closes a drawer.
OSStatus CloseDrawer ( WindowRef inDrawerWindow, Boolean inAsync );
Parameters
- inDrawerWindow
The drawer window that is to be closed.
- inAsync
Pass
truefor asynchronous closing; otherwise, passfalse.
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
CloseDrawer may close the drawer either synchronously or asynchronously, depending on the value of the inAsync parameter. If inAsync is true, CloseDrawer installs an event loop timer that closes the drawer after CloseDrawer returns to the caller; therefore, the caller must be running its event loop for the drawer to close. If inAsync is false, CloseDrawer closes the drawer completely before returning to the caller. CloseDrawer retains the drawer window while the drawer is closing, and releases it when the drawer is fully closed. CloseDrawer sends the kEventWindowDrawerClosing event to the drawer, the drawer’s parent, and the application before closing the drawer. If an event handler for this event returns userCanceledErr, CloseDrawer will return immediately without closing the drawer. CloseDrawer sends the kEventWindowDrawerClosed event to the drawer, the drawer’s parent, and the application after the drawer has finished closing.
Availability
- Available in OS X v10.2 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hCollapseAllWindows
Collapses or expands all collapsable windows in an application.
OSStatus CollapseAllWindows ( Boolean collapse );
Parameters
- collapse
Set to
trueto collapse all windows in the application. Set tofalseto expand all windows in the application.
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
In Mac OS X, this function works with any window that has the kWindowCollapseBoxAttribute. If that attribute is not present, the Window Manager checks for the kWindowCanCollapse feature bit.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hCollapseWindow
Collapses or expands a window to the dock.
OSStatus CollapseWindow ( WindowRef window, Boolean collapse );
Parameters
- window
The window that is to be collapsed or expanded.
- collapse
Indicates whether the window should be collapsed or expanded.
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
The CollapseWindow function tells the Window Manager to collapse or expand a window depending upon the value passed in the collapse parameter. In Mac OS X, any window that has the kWindowCollapseBoxAttribute can be collapsed. If that attribute is not present, the Window Manager checks for the kWindowCanCollapse feature bit.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hConstrainWindowToScreen
Moves and resizes a window so that it’s contained entirely on a single screen.
OSStatus ConstrainWindowToScreen ( WindowRef inWindowRef, WindowRegionCode inRegionCode, WindowConstrainOptions inOptions, const Rect *inScreenRect, Rect *outStructure );
Parameters
- inWindowRef
The window to constrain.
- inRegionCode
The window region to constrain. See “Window Region Constants” for a list of possible constants to pass.
- inOptions
Flags controlling how the window is constrained.
- inScreenRect
A rectangle, in global coordinates, in which to constrain the window. May be
NULL. IfNULL, the window is constrained to the screen with the greatest intersection with the specified window region.- outStructure
On exit, contains the new structure bounds of the window, in global coordinates. May be
NULL.
Return Value
A result code. See “Window Manager Result Codes.”
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
See Also
Declared In
MacWindows.hCopyWindowAlternateTitle
Obtains a copy of the alternate window title.
OSStatus CopyWindowAlternateTitle ( WindowRef inWindow, CFStringRef *outTitle );
Parameters
- inWindow
The window to get the alternate title from.
- outTitle
Receives the alternate title for the window. If the window does not have an alternate title,
NULLwill be returned inoutTitle.
Return Value
A result code. See “Window Manager Result Codes.” An operating system status code.
Discussion
See the discussion of SetWindowAlternateTitle for more information about alternate window titles.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hCopyWindowGroupName
Obtains a copy of the window group name.
OSStatus CopyWindowGroupName ( WindowGroupRef inGroup, CFStringRef *outName );
Parameters
- inGroup
The window group to query. For information on this data type,
- outName
Return Value
A result code. See “Window Manager Result Codes.”
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hCopyWindowTitleAsCFString
Copies the window title into a Core Foundation string.
OSStatus CopyWindowTitleAsCFString ( WindowRef inWindow, CFStringRef *outString );
Parameters
- inWindow
The window whose title is to be copied.
- outString
On output, the window’s title.
Return Value
A result code. See “Window Manager Result Codes.”
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hCountWindowGroupContents
Counts the number of members of a window group.
ItemCount CountWindowGroupContents ( WindowGroupRef inGroup, WindowGroupContentOptions inOptions );
Parameters
- inGroup
The window group whose members are to be counted.
- inOptions
Counting options. See “Window Group Content Options” for possible constants to pass.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hCreateCustomWindow
Creates a custom window based on a registered toolbox object class or a custom window root view.
OSStatus CreateCustomWindow ( const WindowDefSpec *def, WindowClass windowClass, WindowAttributes attributes, const Rect *contentBounds, WindowRef *outWindow );
Parameters
- def
For information on this data type, see
WindowDefSpec.- windowClass
The class the custom window should belong to. This value determines the layer ordering of the custom window.
- attributes
Attributes for the window. See “Window Attributes” for a list of possible attributes.
- contentBounds
Pointer to a
Rectstructure in global coordinates indicating the dimensions of the window’s content region.- outWindow
On return, the newly-created window.
Return Value
A result code. See “Window Manager Result Codes.”
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
See Also
Declared In
MacWindows.hCreateNewWindow
Creates a window from parameter data.
OSStatus CreateNewWindow ( WindowClass windowClass, WindowAttributes attributes, const Rect *contentBounds, WindowRef *outWindow );
Parameters
- windowClass
A constant that categorizes the class of window to be created. For certain classes, the window class can be altered after the window is created by calling
HIWindowChangeClass. See “Window Class Constants” for a description of possible values for this parameter.- attributes
Attributes for the window. See “Window Attributes” for a list of possible attributes.
- contentBounds
Pointer to a
Rectstructure in global coordinates indicating the dimensions of the window’s content region.- outWindow
On input, a pointer to a value of type
WindowRef. On return, the window pointer points to the newly created window.
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
The CreateNewWindow function creates a window based on the attributes and class you specify in the attributes and windowClass parameters. CreateNewWindow sets the new window’s content region to the size and location specified by the rectangle passed in the bounds parameter, which in turn determines the dimensions of the entire window. The Window Manager creates the window invisibly and places it at the front of the window’s window group. After calling CreateNewWindow, you should set any desired associated data—using Window Manager or Control Manager accessor functions—then call the function TransitionWindow or ShowWindow to display the window.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
See Also
Declared In
MacWindows.hCreateStandardWindowMenu
Creates a standard window menu for your application.
OSStatus CreateStandardWindowMenu ( OptionBits inOptions, MenuRef *outMenu );
Parameters
- inOptions
Option bits. Pass 0 or
kWindowMenuIncludeRotate. For information on thekWindowMenuIncludeRotateconstant, see “Window Menu Item Property Constants.”- outMenu
On output, a new menu reference that contains the standard window menu items and commands.
Return Value
A result code. See “Window Manager Result Codes.” An operating system status code.
Discussion
You can call this function to create a window menu for your application. To register a window to be tracked by this menu, you either create your window with CreateNewWindow, passing the kWindowInWindowMenuAttribute, or you can use ChangeWindowAttributes after the window is created. The Toolbox takes care of acting on the standard items such as zoom and minimize, as well as bringing selected windows to the front. All you need to do is insert the menu in your menu bar (typically at the end of your menu list) and register your windows, and the Toolbox does the rest.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hCreateWindowGroup
Creates a window group.
OSStatus CreateWindowGroup ( WindowGroupAttributes inAttributes, WindowGroupRef *outGroup );
Parameters
- inAttributes
Attributes for the new window group. See “Window Group Attributes” for a listing of possible attributes.
- outGroup
For information on this data type, see WindowGroupRef.
Return Value
A result code. See “Window Manager Result Codes.”
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hDebugPrintAllWindowGroups
Debugging utility function listing all window groups.
void DebugPrintAllWindowGroups ( void );
Carbon Porting Notes
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
HIToolboxDebugging.hDebugPrintWindowGroup
Debugging utility functions for use with window groups.
void DebugPrintWindowGroup ( WindowGroupRef inGroup );
Parameters
- inGroup
The window group. For information on this data type,
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
HIToolboxDebugging.hDetachSheetWindow
Detaches a sheet window from its parent window.
OSStatus DetachSheetWindow ( WindowRef inSheet );
Parameters
- inSheet
The window sheet that is to be detached from its parent window.
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
This function detaches a sheet window from its parent window without affecting the visibility or position of the sheet or its parent. This function is useful for hiding a sheet window without an animation effect. To do so, call DetachSheetWindow to detach the sheet from the parent, and then call HideWindow to hide the sheet. Call DisposeWindow to destroy the sheet.
Availability
- Available in OS X v10.3 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hDisableScreenUpdates
Disables updates for changes to the current application’s windows.
OSStatus DisableScreenUpdates ( void );
Return Value
A result code. See “Window Manager Result Codes.”
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hDisposeWindow
Removes a window.
void DisposeWindow ( WindowRef window );
Parameters
- window
On input, the window to be closed.
Discussion
The DisposeWindow function reduces a window’s reference count by one. If the resulting reference count is zero, then DisposeWindow removes the window from the screen and deletes it from the window list, then releases the memory occupied by all structures associated with the window, including the window structure.
Note that DisposeWindow assumes that any picture pointed to by the window structure field windowPic is data, not a resource, and it calls the QuickDraw function KillPicture to delete it. If your application uses a picture stored as a resource, you must release the resource or release the memory it occupies with the ReleaseResource function and set the windowPic field to NULL before closing the window.
Any pending update events for the window are discarded. If the window being removed is the frontmost window, the window behind it, if any, becomes the active window.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hDragWindow
Moves a window on the screen when the user drags it by its drag region.
void DragWindow ( WindowRef window, Point startPt, const Rect *boundsRect );
Parameters
- window
The window that is to be dragged.
- startPt
On input, the location, in global coordinates, of the cursor at the time the user pressed the mouse button. Your application retrieves this point from the
wherefield of the event structure.- boundsRect
On input, a pointer to a rectangle, given in global coordinates, that limits the region to which a window can be dragged. If the mouse button is released when the cursor is outside the limits of
boundsRect,DragWindowreturns without moving the window (or, if it was inactive, without making it the active window).In CarbonLib and Mac OS X, this parameter can be
NULLto indicate that there are no restrictions on window movement. This parameter is ignored by CarbonLib and Mac OS X v10.0 through v10.2; it is obeyed in Mac OX v10.3 and later.
Discussion
The DragWindow function moves the window around the screen, following the movement of the cursor until the user releases the mouse button. If the Command key was not pressed when the mouse button was pressed, DragWindow calls SelectWindow to make the window active before it drags the window. If the Command key was pressed when the mouse button was pressed, DragWindow moves the window without making it active.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hEnableScreenUpdates
Enables screen updates for changes to the current application’s windows.
OSStatus EnableScreenUpdates ( void );
Return Value
A result code. See “Window Manager Result Codes.”
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hEndUpdate
Finishes updating a window.
void EndUpdate ( WindowRef window );
Parameters
- window
The window for which updating is to be finished.
Discussion
The EndUpdate function restores the normal visible region of a window’s graphics port. When you receive an update event for a window, you call BeginUpdate, redraw the update region, and then call EndUpdate. Each call to BeginUpdate must be balanced by a subsequent call to EndUpdate.
Special Considerations
This function should not be used on composited windows. Modifying a composited window's update region does not affect the area of the window to be drawn. A composited window does not use its window update region to control drawing. Instead, a composited window determines what to draw by looking at the invalid regions of the views contained in the window.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hEndWindowProxyDrag
Disposes of the drag reference when the user completes the drag of a proxy icon.
OSStatus EndWindowProxyDrag ( WindowRef window, DragRef theDrag );
Parameters
- window
The window whose proxy icon is being dragged.
- theDrag
A value that refers to the current drag process. Pass in the value produced in the
outNewDragparameter ofBeginWindowProxyDrag.
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
Typically, if the proxy icon represents a type of object (currently, file system entities such as files, folders, and volumes) supported by the Window Manager, the Window Manager can handle all aspects of the drag process itself, and your application should call the function TrackWindowProxyDrag. However, if the proxy icon represents a type of data that the Window Manager does not support, or if you want to implement custom dragging behavior, your application should call the function TrackWindowProxyFromExistingDrag.
The TrackWindowProxyFromExistingDrag function accepts an existing drag reference and adds file data if the window contains a file proxy. If your application uses TrackWindowProxyFromExistingDrag, you then have the choice of using this function in conjunction with the functions BeginWindowProxyDrag and EndWindowProxyDrag or simply calling TrackWindowProxyFromExistingDrag and handling all aspects of creating and disposing of the drag yourself.
Specifically, your application can call BeginWindowProxyDrag to set up the drag image and drag reference. Your application must then track the drag, using TrackWindowProxyFromExistingDrag, and do any required moving of data and, finally, call EndWindowProxyDrag to dispose of the drag reference and its associated image data. The EndWindowProxyDrag function does not dispose of the region created for use by BeginWindowProxyDrag, however, so this remains the application’s responsibility to dispose. The EndWindowProxyDrag function should not be used for types handled by the Window Manager unless you want to implement custom dragging behavior for those types.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hFindWindow
Maps the location of the cursor to a part of the screen or a region of a window when your application receives a mouse-down event.
WindowPartCode FindWindow ( Point thePoint, WindowRef *window );
Parameters
- thePoint
The point, in global coordinates, where the mouse-down event occurred. Your application retrieves this information from the
wherefield of the event structure.- window
A pointer to the window in which the mouse-down event occurred.
FindWindowproducesNULLif the mouse-down event occurred outside a window.
Return Value
The location of the cursor when the user pressed the mouse button; see “Window Part Code Constants.”
Discussion
You typically call the function FindWindow whenever you receive a mouse-down event. The FindWindow function helps you dispatch the event by reporting whether the cursor was in the menu bar or in a window when the mouse button was pressed. If the cursor was in a window, the function will produce both a pointer to the window and a constant that identifies the region of the window in which the event occurred.
If you are using the Carbon event handlers to handle events, a faster way of getting the window and part that received a mouse-down event is to get the kEventParamWindowRef and kEventParamWindowPartCode parameters from the event.
Availability
- Available in Mac OS X v10.0 and later.
- Not available to 64-bit applications.
See Also
Declared In
MacWindows.hFindWindowOfClass
Finds a window of a specific class at the specified point onscreen.
OSStatus FindWindowOfClass ( const Point *where, WindowClass inWindowClass, WindowRef *outWindow, WindowPartCode *outWindowPart );
Parameters
- where
The point, in global coordinates, at which to search for a window.
- inWindowClass
The class of window for which to search. Passing
kAllWindowClassesreturns any window found atwhere.- outWindow
On return, a pointer to the window, if it is of the specified class. If no window was found, this value is
NULL. Note that you can passNULLfor this parameter.- outWindowPart
On return, the part code of the window part under the mouse. If no window was found, this value is
inDesk. Note that you can passNULLfor this parameter.
Return Value
A result code. If no window of the specified class is found at the specified point, this function returns errWindowNotFound. For other possible return values, see “Window Manager Result Codes.”
Discussion
This function is similar to FindWindow, but lets you restrict the search to windows of a particular class.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
See Also
Declared In
MacWindows.hFrontNonFloatingWindow
Returns to the application the frontmost visible window that is not a floating window.
WindowRef FrontNonFloatingWindow ( void );
Return Value
The first visible window in the window list that is of a nonfloating class. See “Window Class Constants” for a description of window classes.
Discussion
Your application should call the FrontNonFloatingWindow function when you want to identify the frontmost visible window that is not a floating window. If you want to identify the frontmost visible window, whether floating or not, your application should call the function FrontWindow.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hGetAvailableWindowAttributes
Returns the window attributes that are valid for a window class
WindowAttributes GetAvailableWindowAttributes ( WindowClass inClass );
Parameters
- inClass
The window class to query.
Return Value
The window attributes that are valid for the window class specified by inClass. See “Window Attributes” for a list of possible attributes.
Discussion
Some window classes support different attributes on different platforms. For example, floating windows can have collapse boxes in Mac OS 9, but not in Mac OS X. The Window Manager returns an error if you attempt to create a window with attributes that aren’t supported for the requested window class.
You can use this API to determine those attributes that are supported by the current platform and remove those attributes that are not supported by the current platform before calling CreateNewWindow.
Availability
- Available in OS X v10.1 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hGetAvailableWindowPositioningBounds
Obtains the available window positioning bounds.
OSStatus GetAvailableWindowPositioningBounds ( GDHandle inDevice, Rect *outAvailableRect );
Parameters
- inDevice
The screen for which the available window positioning bounds are to be obtained.
- outAvailableRect
On return, a pointer to the available bounds for the device specified by
inDevice.
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
The available window positioning bounds is that area on the screen inside which a window may be positioned without intersecting or overlapping the menu bar, Dock, or other UI provided by the operating system.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hGetAvailableWindowPositioningRegion
Obtains the available window positioning region.
OSStatus GetAvailableWindowPositioningRegion ( GDHandle inDevice, RgnHandle ioRgn );
Parameters
- inDevice
The screen for which the available window positioning region is to be obtained.
- ioRgn
On input, contains a preallocated
RgnHandle. On return, theRgnHandlehas been modified to contain the available region for the given screen.
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
The available window positioning region is that area on the screen inside which a window may be positioned without intersecting or overlapping the menu bar, Dock, or other UI provided by the operating system. This function differs from GetAvailableWindowPositioningBounds in that the bounds version removes the entire area that may theoretically be covered by the Dock, even if the Dock does not currently reach from edge to edge of the device on which it is positioned. The region version includes the area at the sides of the Dock that is not covered by the Dock in the available region.
Availability
- Available in OS X v10.2 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hGetDrawerCurrentEdge
Obtains the current window edge from which the drawer appears.
OptionBits GetDrawerCurrentEdge ( WindowRef inDrawerWindow );
Parameters
- inDrawerWindow
The drawer window whose window edge is to be obtained.
Return Value
The current window edge. See “Window Edge Constants” for a list of possible return values.
Availability
- Available in OS X v10.2 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hGetDrawerOffsets
Obtains the positioning offsets of a drawer.
OSStatus GetDrawerOffsets ( WindowRef inDrawerWindow, CGFloat *outLeadingOffset, CGFloat *outTrailingOffset );
Parameters
- inDrawerWindow
The drawer window whose positioning offsets are to be obtained.
- outLeadingOffset
On exit, a pointer to the drawer’s leading offset. Pass
NULLif you don’t need this information.- outTrailingOffset
On exit, a pointer to the drawer’s trailing offset. Pass
NULLif you don’t need this information.
Return Value
A result code. See “Window Manager Result Codes.”
Availability
- Available in OS X v10.2 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hGetDrawerParent
Obtains the parent window of a drawer.
WindowRef GetDrawerParent ( WindowRef inDrawerWindow );
Parameters
- inDrawerWindow
The drawer window whose parent window is to be obtained.
Return Value
The window that is the parent of the drawer specified by inDrawerWindow.
Availability
- Available in OS X v10.2 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hGetDrawerPreferredEdge
Obtains the preferred opening edge for a drawer.
OptionBits GetDrawerPreferredEdge ( WindowRef inDrawerWindow );
Parameters
- inDrawerWindow
The drawer window whose preferred opening edge is to be obtained.
Return Value
See “Window Edge Constants” for a list of possible values.
Discussion
Note that the preferred edge may not be the same as the current edge, due to window positioning. For example, the right edge may be the preferred edge, but if the window is placed such that the right edge is offscreen, the drawer will appear on the left edge instead.
Availability
- Available in OS X v10.2 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hGetDrawerState
Determines the current state of the drawer.
WindowDrawerState GetDrawerState ( WindowRef inDrawerWindow );
Parameters
- inDrawerWindow
The drawer window whose state is to be determined.
Return Value
See “Drawer State Constants” for a list of possible values.
Availability
- Available in OS X v10.2 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hGetFrontWindowOfClass
Obtains the frontmost window of a given class.
WindowRef GetFrontWindowOfClass ( WindowClass inWindowClass, Boolean mustBeVisible );
Parameters
- inWindowClass
The class of the window you want to obtain. If you pass
kAllWindowClasses, the function returns the frontmost window in the window list.- mustBeVisible
If set to
true, the function returns the frontmost visible window. If set tofalse, the function returns the frontmost window of the specified class, regardless of whether the window is visible.
Return Value
A reference to the frontmost window of the class specified by inWindowClass.
Carbon Porting Notes
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hGetIndexedWindow
Obtains the window at the given index in the window group.
OSStatus GetIndexedWindow ( WindowGroupRef inGroup, ItemCount inIndex, WindowGroupContentOptions inOptions, WindowRef *outWindow );
Parameters
- inGroup
The window group. For information on this data type,
- inIndex
The index of the window. This parameter may range from
1to the value returned byCountWindowGroupContents.- inOptions
Options for determining the number of windows. See “Window Group Content Options” for possible values.
- outWindow
The window at the index specified by
inIndexin the group specified byinGroup.
Return Value
A result code. See “Window Manager Result Codes.”
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hGetNextWindow
Returns the next window in a window list.
WindowRef GetNextWindow ( WindowRef window );
Parameters
- window
The window to start from.
Return Value
The next window in a window list.
Availability
- Available in Mac OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hGetNextWindowOfClass
Obtains the next window in a given window group.
WindowRef GetNextWindowOfClass ( WindowRef inWindow, WindowClass inWindowClass, Boolean mustBeVisible );
Parameters
- inWindow
The window at which to start.
- inWindowClass
The class of window to obtain. If you pass
kAllWindowClasses, the function returns the window directly behind the input window. If no windows exist behind the front window, the function returnsNULL.- mustBeVisible
If set to
true, this function returns the next visible window of the specified window class. If set tofalse, this function returns the next window of the specified window class, regardless of whether it is visible.
Return Value
A reference for the next window of the specified class after the window specified by inWindow.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hGetPreviousWindow
Returns the window above the specified window in the window list.
WindowRef GetPreviousWindow ( WindowRef inWindow );
Parameters
- inWindow
The window at which to start.
Return Value
A reference for the previous window of the specified class.
Availability
- Available in OS X v10.2 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hGetSheetWindowParent
Obtains the parent window of a sheet.
OSStatus GetSheetWindowParent ( WindowRef inSheet, WindowRef *outParentWindow );
Parameters
- inSheet
The window sheet whose parent is to be obtained.
- outParentWindow
A pointer to the reference for the parent of the window sheet specified by
inSheet.
Return Value
A result code. See “Window Manager Result Codes.”
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hGetUserFocusWindow
Returns the current user focus window.
WindowRef GetUserFocusWindow ( void );
Return Value
The window receiving user focus.
Discussion
This function returns the window that receives menu commands and keyboard input as part of the standard event dispatching.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hGetWindowActivationScope
Obtains a window’s activation scope.
OSStatus GetWindowActivationScope ( WindowRef inWindow, WindowActivationScope *outScope );
Parameters
- inWindow
The window whose activation scope is to be obtained.
- outScope
On return, a pointer to the window’s activation scope.
Return Value
A result code. See “Window Manager Result Codes.”
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hGetWindowAlpha
Returns the current alpha channel value for the window.
OSStatus GetWindowAlpha ( WindowRef inWindow, CGFloat *outAlpha );
Parameters
- inWindow
The window for which the value of the alpha channel is to be obtained.
- outAlpha
The current alpha value. This value can range from 0.0 (completely transparent) to 1.0 (opaque).
Return Value
A result code. See “Window Manager Result Codes.”
Availability
- Available in OS X v10.2 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hGetWindowAttributes
Obtains the attributes of a window.
OSStatus GetWindowAttributes ( WindowRef window, WindowAttributes *outAttributes );
Parameters
- window
The window whose attributes you want to obtain.
- outAttributes
On input, a pointer to an unsigned 32-bit value of type
WindowAttributes. On return, the bits are set to the attributes of the specified window. See “Window Attributes” for a description of possible attributes.
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
Window attributes specify a window’s features (such as whether the window has a close box) and logical attributes (such as whether the window receives update and activate events).
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hGetWindowBounds
Obtains the size and position of the bounding rectangle of the specified window region.
OSStatus GetWindowBounds ( WindowRef window, WindowRegionCode regionCode, Rect *globalBounds );
Parameters
- window
The window whose bounds you want to obtain.
- regionCode
A constant identifying the window region whose bounds you want to obtain. See “Window Region Constants” for a list of possible values.
- globalBounds
A pointer to a structure of type
Rect. On return, the rectangle contains the dimensions and position, in global coordinates, of the window region specified in theregionCodeparameter.
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
Use the GetWindowBounds function to obtain the bounding rectangle for the specified window region for the specified window.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
See Also
Declared In
MacWindows.hGetWindowCancelButton
Returns the current Cancel button for a window.
OSStatus GetWindowCancelButton ( WindowRef inWindow, ControlRef *outControl );
Parameters
- inWindow
The window whose Cancel button you want to obtain.
- outControl
A pointer to a control. On output, the control is the Cancel button.
Return Value
A result code.
Discussion
You can use this function to determine which button or control is the specified Cancel button for a given window. This button would be considered to have been clicked if the user instead presses Command-period or the Escape key.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hGetWindowClass
Obtains the class of a window.
OSStatus GetWindowClass ( WindowRef window, WindowClass *outClass );
Parameters
- window
The window whose class you want to obtain.
- outClass
On input, a pointer to a value of type
WindowClass. On return, this value identifies the class of the specified window. See “Window Class Constants” for a list of possible window classes. In Mac OS 8 and Mac OS 9, for windows not originally created byCreateNewWindow, the class pointed to by theoutClassparameter is always identified by the constantkDocumentWindowClass.
Return Value
A result code. See “Window Manager Result Codes.”
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hGetWindowContentColor
Obtains the color to which a window’s content region is redrawn.
OSStatus GetWindowContentColor ( WindowRef window, RGBColor *color );
Parameters
- window
The window whose content color is being retrieved.
- color
On input, a pointer to an
RGBColorstructure. On return, the structure contains the content color for the specified window.
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
The GetWindowContentColor function obtains the color to which the window’s content region is redrawn.
See also the function SetWindowContentColor.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hGetWindowContentPattern
Obtains the pattern to which a window’s content region is redrawn.
OSStatus GetWindowContentPattern ( WindowRef window, PixPatHandle outPixPat );
Parameters
- window
The window whose content pattern is being retrieved.
- outPixPat
On input, a handle to a structure of type
PixPat. On return, the structure contains a copy of the content pattern data for the specified window, which your application is responsible for disposing.
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
The GetWindowContentPattern function obtains the pattern to which the window’s content region is redrawn.
See also the function SetWindowContentPattern.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hGetWindowDefaultButton
Returns the current default button for a window.
OSStatus GetWindowDefaultButton ( WindowRef inWindow, ControlRef *outControl );
Parameters
- inWindow
The window whose default button you want to obtain.
- outControl
A pointer to a control. On output, the control is the default button.
Return Value
A result code.
Discussion
You can use this function to determine which button or control is the default for a given window. This button would be considered to have been clicked if the user instead presses the Return or Enter keys on the keyboard.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hGetWindowDockTileMenu
Returns the menu to be displayed by a window’s dock tile.
MenuRef GetWindowDockTileMenu ( WindowRef inWindow );
Parameters
- inWindow
The window whose menu is to be obtained.
Return Value
The menu reference for the window specified by inWindow. See the Menu Manager documentation for a description of the MenuRef data type.
Availability
- Available in OS X v10.2 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hGetWindowFeatures
Obtains the features that a window supports.
OSStatus GetWindowFeatures ( WindowRef window, UInt32 *outFeatures );
Parameters
- window
A pointer to the window to be examined.
- outFeatures
On input, a pointer to an unsigned 32-bit value. On return, the bits of the value specify the features the window supports; see “Window Feature Bits.”
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
The GetWindowFeatures function produces a window definition function’s features in response to a kWindowMsgGetFeatures message.
Instead of calling this function, most applications should call GetWindowAttributes to check for specific attributes, such as kWindowCollapseBoxAttribute and kWindowResizableAttribute.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hGetWindowFromPort
Gets a window reference from a CGrafPtr data type.
WindowRef GetWindowFromPort ( CGrafPtr port );
Parameters
- port
The port to query.
Return Value
The window reference obtained from the port specified by port, or NULL if the port parameter is not actually attached to a window.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hGetWindowGreatestAreaDevice
Returns the graphics device with the greatest area of intersection with a specified window region.
OSStatus GetWindowGreatestAreaDevice ( WindowRef inWindow, WindowRegionCode inRegion, GDHandle *outGreatestDevice, Rect *outGreatestDeviceRect );
Parameters
- inWindow
The window to compare against.
- inRegion
The window region to compare against. See “Window Region Constants” for a list of possible values.
- outGreatestDevice
On return, the graphics device with the greatest intersection. May be
NULL.- outGreatestDeviceRect
On return, the bounds of the graphics device with the greatest intersection. May be
NULL. If the device with the greatest intersection also contains the menu bar, the device rect will exclude the menu bar area.
Return Value
A result code. See “Window Manager Result Codes.”
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hGetWindowGroup
Obtains the window group associated with a window.
WindowGroupRef GetWindowGroup ( WindowRef inWindow );
Parameters
- inWindow
The window whose window group is to be obtained.
Return Value
The window group reference for the window specified by inWindow. For information on this data type, see WindowGroupRef.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hGetWindowGroupAttributes
Obtains the attributes of a window group.
OSStatus GetWindowGroupAttributes ( WindowGroupRef inGroup, WindowGroupAttributes *outAttributes );
Parameters
- inGroup
The window group whose attributes are to be changed. For information on this data type,
- outAttributes
On return, the attributes of the group. See “Window Group Attributes” for a list of possible values.
Return Value
A result code. See “Window Manager Result Codes.”
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hGetWindowGroupContents
Obtains the contents of a window group.
OSStatus GetWindowGroupContents ( WindowGroupRef inGroup, WindowGroupContentOptions inOptions, ItemCount inAllowedItems, ItemCount *outNumItems, void **outItems );
Parameters
- inGroup
The window group whose contents you want to obtain. For information on this data type, see
WindowGroupRef.- inOptions
Options for determining how to count the group members. See “Window Group Content Options” for a list of possible values.
- inAllowedItems
The number of items that will fit in
outItems.- outNumItems
On return, the number of items in the group.
- outItems
On entry, this parameter must be a pointer to a pre-allocated buffer in which the window group contents (either window references or window group references) are to be placed. On return, the buffer pointed to by this parameter contains the requested window references or window group references.
Return Value
A result code. See “Window Manager Result Codes.”
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hGetWindowGroupLevel
Obtains the level of the group in the window class hierarchy.
OSStatus GetWindowGroupLevel ( WindowGroupRef inGroup, SInt32 *outLevel );
Parameters
- inGroup
The window group. For information on this data type,
- outLevel
On exit, the window level of the windows in this group.
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
The window group’s level is only used to set the level of its windows if the window group is a child of the root group. If there is another group in the group hierarchy between this group and the root group, this group’s level is ignored.
See the Core Graphics frameworks header CGWindowLevel.h for a listing of window levels.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hGetWindowGroupLevelOfType
Obtains the Core Graphics window level of a window group.
OSStatus GetWindowGroupLevelOfType ( WindowGroupRef inGroup, UInt32 inLevelType, CGWindowLevel *outLevel );
Parameters
- inGroup
The window group whose Core Graphics window level is to be obtained.
- inLevelType
The level type to obtain. Specify
kWindowGroupLevelActive,kWindowGroupLevelInactive, orkWindowGroupLevelPromoted. For details, see “Window Group Level Constants.”- outLevel
On output, the Core Graphics window level for the windows in this group.
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
In Mac OS X v10.4 and later, multiple Core Graphics window levels may be associated with a window group: one level for when the application is active and another for when the application is inactive. The Window Manager automatically switches each group’s Core Graphics window level as the application becomes active or inactive. Use GetWindowGroupLevelOfType to get each Core Graphics window level associated with a window group, including the promoted window level that is actually in use for windows in the group when the application is active.
Availability
- Available in OS X v10.4 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hGetWindowGroupOfClass
Obtains the window group corresponding to a given window class.
WindowGroupRef GetWindowGroupOfClass ( WindowClass windowClass );
Parameters
- windowClass
The window class to query.
Return Value
For information on this data type, see WindowGroupRef.
Discussion
Each window class has an associated pre-defined window group. This function returns the window group reference for the window group that is associated with windowClass. Note that all windows in a group do not have to be of the same window class.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hGetWindowGroupOwner
Obtains the window that owns a window group. (if any)
WindowRef GetWindowGroupOwner ( WindowGroupRef inGroup );
Parameters
- inGroup
The window group to query. For information on this data type,
Return Value
The window reference for the window that owns the group specified by inGroup.
Discussion
You call SetWindowGroupOwner to associate a window group with a particular window.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hGetWindowGroupParent
Obtains the parent group of a window group.
WindowGroupRef GetWindowGroupParent ( WindowGroupRef inGroup );
Parameters
- inGroup
The window group whose parent is to be obtained.
Return Value
The parent of the window group specified by inGroup.
Discussion
You can nest window groups within each other.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hGetWindowGroupRetainCount
Determines the current reference count for a window group.
ItemCount GetWindowGroupRetainCount ( WindowGroupRef inGroup );
Parameters
- inGroup
The window group for which the current reference count is to be obtained. For information on this data type, see
WindowGroupRef.
Availability
- Available in OS X v10.1 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hGetWindowGroupSibling
Obtains the next or previous group of a window group.
WindowGroupRef GetWindowGroupSibling ( WindowGroupRef inGroup, Boolean inNextGroup );
Parameters
- inGroup
The window group for which the next or previous group is to be obtained. For information on this data type, see
WindowGroupRef.- inNextGroup
Pass
trueto obtain the next sibling;falseto obtain the previous sibling.
Return Value
The next or previous group. For information on this data type, see WindowGroupRef.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hGetWindowIdealUserState
Obtains the size and position of a window in its user state.
OSStatus GetWindowIdealUserState ( WindowRef inWindow, Rect *outUserState );
Parameters
- inWindow
The window for which you want to obtain the user state.
- outUserState
On input, a pointer to a structure of type
Rect. On return, this rectangle specifies the current size and position of the window’s user state, in global coordinates.
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
Because the window definition function relies upon the WStateData structure, it is unaware of the ideal standard state, and this causes the user state data that it stores in the WStateData structure to be unreliable. While the Window Manager is reliably aware of the window’s zoom state, it cannot record the current user state in the WStateData structure, because the window definition function can overwrite that data. Therefore, the function ZoomWindowIdeal maintains the window’s user state independently of the WStateData structure. The GetWindowIdealUserState function gives your application access to the user state data maintained by ZoomWindowIdeal. However, your application should not typically need to use this function; it is supplied for completeness.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
See Also
Declared In
MacWindows.hGetWindowIndex
Obtains the index number of a specified window in a group.
OSStatus GetWindowIndex ( WindowRef inWindow, WindowGroupRef inStartGroup, WindowGroupContentOptions inOptions, ItemCount *outIndex );
Parameters
- inWindow
The window whose window group index number is to be obtained.
- inStartGroup
The window group to query.
- inOptions
Specifies how to enumerate the specified window;
kWindowGroupContentsReturnWindowsis implied and does not need to be specified explicitly.- outIndex
A pointer to a variable that, on return, contains the window’s z-order index. The frontmost window in a window group has an index of 1. Window indexes increase as the window gets lower in z-order (that is, visually further from the top of the window list and closer to the desktop.)
Return Value
A result code. See “Window Manager Result Codes.”
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hGetWindowKind
Returns a window’s window kind.
short GetWindowKind ( WindowRef window );
Parameters
- window
The window whose window kind is to be returned.
Return Value
An integer representing the window kind; see “Window Kinds.”
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hGetWindowList
Obtains the first window in a window list.
WindowRef GetWindowList ( void );
Return Value
A window reference for the first window in the list.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hGetWindowModality
Obtains the modality of a window.
OSStatus GetWindowModality ( WindowRef inWindow, WindowModality *outModalKind, WindowRef *outUnavailableWindow );
Parameters
- inWindow
The window whose modality is to be obtained.
- outModalKind
On return, contains the modality of the window.
- outUnavailableWindow
On return, if the window is window-modal, contains the target window of the specified window’s modality.
Return Value
A result code. See “Window Manager Result Codes.”
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hGetWindowPort
Gets the window’s color graphics port.
CGrafPtr GetWindowPort ( WindowRef window );
Parameters
- window
The window whose color graphics port is to be obtained.
Return Value
A pointer to the window’s color graphics port. See the QuickDraw Manager documentation for a description of the CGrafPtr data type.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hGetWindowPortBounds
Obtains the bounds of the window port.
Rect * GetWindowPortBounds ( WindowRef window, Rect *bounds );
Parameters
- window
The window whose port bounds you want.
- bounds
A pointer to a
Rectstructure. On return, theRectstructure contains the bounds of the window port.
Return Value
The same value (pointer to a Rect structure) that was passed to GetWindowPortBounds in the bounds parameter.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hGetWindowProperty
Obtains a piece of data that is associated with a window.
OSStatus GetWindowProperty ( WindowRef window, PropertyCreator propertyCreator, PropertyTag propertyTag, ByteCount bufferSize, ByteCount *actualSize, void *propertyBuffer );
Parameters
- window
The window to be examined for associated data.
- propertyCreator
The creator code (typically, the application’s signature) of the associated data to be obtained.
- propertyTag
The application-defined code identifying the associated data to be obtained.
- bufferSize
The size of the associated data to be obtained. If the size of the data is unknown, use the function
GetWindowPropertySizeto get the data’s size. If the size specified does not match the actual size of the property,GetWindowPropertyonly retrieves data up to the size specified or up to the actual size of the property, whichever is smaller, and an error is returned.- actualSize
On input, a pointer to a value. On return, the value specifies the actual size of the obtained data. You may pass
NULLfor theactualSizeparameter if you are not interested in this information.- propertyBuffer
On input, a pointer to a buffer. On return, this buffer contains a copy of the data that is associated with the specified window.
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
The data retrieved by the GetWindowProperty function must have been previously associated with the window with the function SetWindowProperty.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hGetWindowPropertyAttributes
Obtains the attributes of a window property.
OSStatus GetWindowPropertyAttributes ( WindowRef window, OSType propertyCreator, OSType propertyTag, OptionBits *attributes );
Parameters
- window
The window having a property whose attributes are to be obtained.
- propertyCreator
The property creator.
- propertyTag
The property tag.
- attributes
On return, the property’s attributes. Currently, the only valid property is
kWindowPropertyPersistent. For a description of this property, see “Window Property Persistent Constant.”
Return Value
A result code. See “Window Manager Result Codes.”
Carbon Porting Notes
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hGetWindowPropertySize
Obtains the size of a piece of data that is associated with a window.
OSStatus GetWindowPropertySize ( WindowRef window, PropertyCreator creator, PropertyTag tag, ByteCount *size );
Parameters
- window
The window to be examined for associated data.
- creator
The creator code (typically, the application’s signature) of the associated data whose size is to be obtained.
- tag
The application-defined code identifying the associated data whose size is to be obtained.
- size
A pointer to a value that, on return, specifies the size of the associated data.
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
If you want to retrieve a piece of associated data with the GetWindowProperty function, you typically need to use the GetWindowPropertySize function to determine the size of the data beforehand.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hGetWindowProxyAlias
Obtains an alias for the file that is associated with a window.
OSStatus GetWindowProxyAlias ( WindowRef window, AliasHandle *alias );
Parameters
- window
The window for which you want to determine the associated file.
- alias
On input, a pointer to a value of type
AliasHandle. On return, theAliasRecordstructure referenced by the alias handle contains a copy of the alias data for the file associated with the specified window. Your application must dispose of this handle.
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
Your application can call the GetWindowProxyAlias function to retrieve alias data for the file associated with a window.
See also the function SetWindowProxyAlias.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hGetWindowProxyIcon
Obtains a window’s proxy icon.
OSStatus GetWindowProxyIcon ( WindowRef window, IconRef *outIcon );
Parameters
- window
The window for which you want to obtain the proxy icon.
- outIcon
A pointer to a variable of type
IconRefthat, on return, identifies the window’s proxy icon. Your application must not dispose of this icon.
Return Value
A result code. If no proxy icon is found, this function returns errWindowDoesNotHaveProxy. For other possible return values, see “Window Manager Result Codes.”
Discussion
There are several different ways to associate a proxy icon with a window:
If you use the function
SetWindowProxyIcon,GetWindowProxyIconreturns the proxy icon you set.If you use the function
SetWindowProxyCreatorAndType, that function uses Icon Services to find and set the proxy icon corresponding to the creator and type.GetWindowProxyIconreturns that icon.If you use
SetWindowProxyAlias,SetWindowProxyFSSpec, orHIWindowSetProxyFSRef, thenGetWindowProxyIconattempts to resolve the alias (if available) and returns the icon associated with the specified file.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hGetWindowResizeLimits
Returns the minimum and maximum content sizes for a window.
OSStatus GetWindowResizeLimits ( WindowRef inWindow, HISize *outMinLimits, HISize *outMaxLimits );
Parameters
- inWindow
The window whose minimum and maximum content sizes are to be obtained.
- outMinLimits
On return, the window’s minimum content size. Pass
NULLif you don’t want this information. For information on theHISizedata type, see HIGeometry.h.- outMaxLimits
On return, the window’s maximum content size. Pass
NULLif you don’t want this information. For information on theHISizedata type, see HIGeometry.h.
Return Value
A result code. See “Window Manager Result Codes.”
Availability
- Available in OS X v10.2 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hGetWindowStandardState
Obtains a window’s standard zoom rectangle.
Rect * GetWindowStandardState ( WindowRef window, Rect *rect );
Parameters
- window
The window whose standard zoom rectangle is to be obtained.
- rect
On input, a pointer to a
Rectstructure. On return, theRectstructure contains the window’s standard zoom rectangle, in global coordinates. A window’s standard zoom rectangle is the window content bounds when the window is zoomed out to its greatest extent.
Return Value
The same value (pointer to a Rect structure) that was passed to GetWindowStandardState in the rect parameter.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hGetWindowStructurePort
Obtains a graphics port that is used when drawing a window’s structure.
CGrafPtr GetWindowStructurePort ( WindowRef inWindow );
Parameters
- inWindow
The window to query.
Return Value
The CGrafPtr that is used when drawing the window’s structure (window frame).
Availability
- Available in OS X v10.1 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hGetWindowStructureWidths
Obtains the width of the structure region on each edge of a window.
OSStatus GetWindowStructureWidths ( WindowRef inWindow, Rect *outRect );
Parameters
- inWindow
The window to query.
- outRect
On return, the
Rectstructure is filled in with the widths of the structure.
Return Value
A result code. See “Window Manager Result Codes.”
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hGetWindowToolbar
Obtains the toolbar associated with a window.
OSStatus GetWindowToolbar ( WindowRef inWindow, HIToolbarRef *outToolbar );
Parameters
- inWindow
The window whose toolbar is to be obtained.
- outToolbar
On return, the toolbar that is attached to the window, or
NULLif the window has no toolbar.
Return Value
A result code. See “Window Manager Result Codes.”
Availability
- Available in OS X v10.2 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hGetWindowUserState
Returns a window’s user zoom rectangle.
Rect * GetWindowUserState ( WindowRef window, Rect *rect );
Parameters
- window
The window whose user zoom rectangle is to be returned.
- rect
On input, a pointer to a
Rectstructure. On return, theRectstructure contains the window’s user zoom rectangle, in global coordinates. A window’s user zoom rectangle is the window content bounds when the window is zoomed back in.
Return Value
The same value (pointer to a Rect structure) that was passed to GetWindowUserState in the rect parameter.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hGetWindowWidgetHilite
Obtains the window part code of the window widget that is currently highlighted.
OSStatus GetWindowWidgetHilite ( WindowRef inWindow, WindowDefPartCode *outHilite );
Parameters
- inWindow
The window to query.
- outHilite
The highlight.
Return Value
A result code. See “Window Manager Result Codes.”
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hGetWRefCon
Returns the reference constant from a window.
SRefCon GetWRefCon ( WindowRef window );
Parameters
- window
The window whose reference constant is to be returned.
Return Value
The long integer data stored in the refCon field of the window structure specified in the window parameter.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hHideFloatingWindows
Hides an application’s floating windows.
OSStatus HideFloatingWindows ( void );
Return Value
A result code. For details, see “Window Manager Result Codes.”
Discussion
When an application receives a suspend event, its floating windows are hidden automatically. When the application receives a resume event, the floating windows are made visible automatically. Call this function if you want to hide your floating windows manually.
See also the function ShowFloatingWindows.
Special Considerations
The HideFloatingWindows function operates only upon windows created with the kFloatingWindowClass constant; see “Window Class Constants” for more details on this constant.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hHideSheetWindow
Hides a sheet window using appropriate visual effects.
OSStatus HideSheetWindow ( WindowRef inSheet );
Parameters
- inSheet
The window sheet that is to be hidden.
Return Value
A result code. See “Window Manager Result Codes.”
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hHideWindow
Makes a window invisible.
void HideWindow ( WindowRef window );
Parameters
- window
The window that is to be made invisible.
Discussion
The HideWindow function make a visible window invisible. If you hide the frontmost window, HideWindow removes the highlighting, brings the window behind it to the front, highlights the new frontmost window, and generates the appropriate activate events.
To reverse the actions of HideWindow, you must call both ShowWindow, to make the window visible, and SelectWindow, to select it.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hHiliteWindow
Sets a window’s highlighting status.
void HiliteWindow ( WindowRef window, Boolean fHilite );
Parameters
- window
On input, a pointer to the window structure.
- fHilite
On input, a Boolean value that specifies the highlighting status:
truehighlights a window;falseremoves highlighting.
Discussion
The HiliteWindow function sets a window’s highlighting status to the specified state. If the value of the fHilite parameter is true, HiliteWindow highlights the specified window; if the specified window is already highlighted, the function has no effect. If the value of fHilite is false, HiliteWindow removes highlighting from the specified window; if the window is not already highlighted, the function has no effect.
Your application doesn’t normally need to call HiliteWindow. To make a window active, you can call SelectWindow or ActivateWindow, which handle highlighting for you.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hHiliteWindowFrameForDrag
Sets the highlight state of the window’s structure region to reflect the window’s validity as a drag-and-drop destination.
OSStatus HiliteWindowFrameForDrag ( WindowRef window, Boolean hilited );
Parameters
- window
The window for which you want to set the highlight state.
- hilited
Passtrueif the window’s frame should be highlighted otherwise, passfalse.
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
Applications typically call the Drag Manager functions ShowDragHilite and HideDragHilite to indicate that a window is a valid drag-and-drop destination. If your application does not do this—that is, if your application implements any type of custom drag highlighting, such as highlighting more than one area of a window at a time—it must call the HiliteWindowFrameForDrag function.
The HiliteWindowFrameForDrag function highlights a window’s proxy icon when the user drags content inside the window that is a valid content type for that destination. The default behavior of system-defined windows is to highlight the proxy icon along with the window’s content area when the window is a valid drag-and-drop destination. If you call the Drag Manager functions ShowDragHilite and HideDragHilite, you don’t need to use HiliteWindowFrameForDrag.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hHIWindowChangeAttributes
Changes the attributes of a window.
OSStatus HIWindowChangeAttributes ( WindowRef inWindow, const int *inAttrToSet, const int *inAttrToClear );
Parameters
- inWindow
The window to change.
- inAttrToSet
A zero-terminated array of window attribute constants. Possible values are described in
“Window Attribute Identifiers”. Each array entry specifies an attribute of the window to set. You may passNULLif you do not wish to set any attributes.- inAttrToClear
A zero-terminated array of window attribute constants. Possible values are described in
“Window Attribute Identifiers”. Each array entry specifies an attribute of the window to clear. You may passNULLif you do not wish to clear any attributes.
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
This function takes two arrays of window attribute constants, as described in “Window Attribute Identifiers”. The first array specifies the attributes to set, and the second specifies the attributes to clear. For example, you might call this function as follows:
int setAttr[] = { kHIWindowBitCloseBox, kHIWindowBitZoomBox, 0 }; |
int clearAttr[] = { kHIWindowBitNoTitleBar, 0 }; |
HIWindowChangeAttributes (window, setAttr, clearAttr); |
Special Considerations
In Mac OS X v10.4 or earlier, you can use the function ChangeWindowAttributes to achieve similar results.
Availability
- Available in OS X v10.5 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hHIWindowChangeAvailability
Changes the availability of a window during Exposé or in Spaces.
OSStatus HIWindowChangeAvailability ( WindowRef inWindow, HIWindowAvailability inSetAvailability, HIWindowAvailability inClearAvailability );
Parameters
- inWindow
The window whose availability is to be changed.
- inSetAvailability
The availability bits to set. For details, see “Window Availability Constants.”
- inClearAvailability
The availability bits to clear. For details, see “Window Availability Constants.”
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
This function overrides the default behavior of the Window Manager in determining whether a window is visible during Exposé or in all Spaces workspaces. Most applications should not override the default behavior; these options should only be used in special cases. For example, accessibility assistance applications may need to create windows that are visible in all workspaces.
By default, newly created windows of class kDocumentWindowClass are given an availability of 0 (meaning that they are available during Exposé), and windows from all other window classes are given an availability of kHIWindowExposeHidden.
Availability
- Available in OS X v10.4 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hHIWindowChangeClass
Changes the appearance and behavior of a window.
OSStatus HIWindowChangeClass ( WindowRef inWindow, WindowClass inWindowClass );
Parameters
- window
The window whose class you want to change.
- inClass
The new class that is to be applied to the window. See “Window Class Constants” for a list of possible window classes.
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
This function changes the class of a window. Unlike SetWindowClass, HIWindowChangeClass effectively changes both the appearance and behavior of the window.
This function can convert a window between kDocumentWindowClass, kFloatingWindowClass, kUtilityWindowClass, and kMovableModalWindowClass only. It cannot, for example, change a document window into a plain window.
The attributes of the window are adjusted to contain only those that are allowed for the new class. It is the caller’s responsibility to adjust them further, as necessary, after HIWindowChangeClass returns.
Availability
- Available in OS X v10.3 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hHIWindowChangeFeatures
Changes a window’s features.
OSStatus HIWindowChangeFeatures ( WindowRef inWindow, UInt64 inSetThese, UInt64 inClearThese );
Parameters
- inWindow
The window whose features are to be changed.
- inSetThese
The feature bits to set. For details, see “Window Feature Bits.”
- inClearThese
The feature bits to clear. For details, see “Window Feature Bits.”
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
HIWindowChangeFeatures changes the features of a window on the fly. This function should only be used by custom window definitions or window frame views.
Availability
- Available in OS X v10.3 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hHIWindowConstrain
Moves and resizes a window to be within a specified bounding rectangle.
OSStatus HIWindowConstrain ( WindowRef inWindowRef, WindowRegionCode inRegionCode, WindowConstrainOptions inOptions, HICoordinateSpace inSpace, const HIRect *inScreenBounds, const HISize *inMinimumSize, HIRect *ioBounds );
Parameters
- inWindowRef
The window to constrain.
- inRegionCode
The window region to constrain. For a list of possible values, see
“Window Region Constants”.- inOptions
Flags controlling how the window is constrained. For a list of possible options, see
“Window Constrain Options”.- inSpace
The coordinate space in which the
inScreenBounds,inMinimumSize, andioBoundsparameters are expressed. This parameter must be eitherkHICoordSpaceScreenPixelsorkHICoordSpace72DPIGlobal.- inScreenBounds
A rectangle within which to constrain the window. You may pass
NULLif you don't need to specify a screen bounds. IfNULL, the window is constrained to the screen that has the greatest intersection with the specified window region.- inMinimumSize
A minimum size that should be kept within the specified screen bounds. This parameter is ignored if the
kWindowConstrainMoveMinimumoption is not set. Even if that option is set, you may still passNULLif you don't need to customize the minimum dimensions.- ioBounds
If the
inOptionsparameter containskWindowConstrainUseSpecifiedBounds, then this parameter should be a bounding rectangle of the specified window region. The bounding rectangle does not have to match the actual current bounds of the specified region; it may be a hypothetical bounds that you would like to constrain without actually moving the window to that location. On output, contains the new structure bounds of the window. You may passNULLif you don't need the window bounds returned.
Return Value
A result code. See “Window Manager Result Codes.”
Availability
- Available in OS X v10.5 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hHIWindowCopyAvailablePositioningShape
Copies the available window positioning shape on a display.
OSStatus HIWindowCopyAvailablePositioningShape ( CGDirectDisplayID inDisplay, HICoordinateSpace inSpace, HIShapeRef *outShape );
Parameters
- inDisplay
The display for which to find the available shape. May be
kCGNullDirectDisplayto request the shape of the main display.- inSpace
The coordinate space in which the positioning shape should be returned. This parameter must be either
kHICoordSpaceScreenPixelorkHICoordSpace72DPIGlobal.- outShape
A pointer to a shape (an HIShape object). On output, the shape describes the available bounds for the specified display. This shape is returned in the specified coordinate space. You should release the shape when you no longer need it.
Discussion
This function finds the area on the display in which a window may be positioned without intersecting or overlapping the menu bar, Dock, or other UI provided by the operating system. This function differs from HIWindowGetAvailablePositioningBounds in that the bounds version removes the entire area that may theoretically be covered by the Dock, even if the Dock does not currently reach from edge to edge of the display on which it is positioned. The shape version includes the area at the sides of the Dock that is not covered by the Dock.
Availability
- Available in OS X v10.5 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hHIWindowCopyDrawers
Obtains an array of the drawers that are attached to a window.
OSStatus HIWindowCopyDrawers ( WindowRef inWindow, CFArrayRef *outDrawers );
Parameters
- inWindow
The parent window to access.
- outDrawers
A pointer to a Core Foundation array. On output, each array entry is a drawer window attached to the parent window specified in the
inWindowparameter. The array will be valid, but empty, if the parent window has no drawers. You should release the array when you no longer need it.
Return Value
A result code. See “Window Manager Result Codes.”
Availability
- Available in OS X v10.5 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hHIWindowCopyShape
Retrieves a shape that describes a region of a window.
OSStatus HIWindowCopyShape ( WindowRef inWindow, WindowRegionCode inRegion, HICoordinateSpace inSpace, HIShapeRef *outShape );
Parameters
- inWindow
The window to access.
- inRegion
The window region whose shape you want to obtain. For a list of possible values, see “Window Region Constants.”
- inSpace
The coordinate space in which the shape should be returned. This parameter must be
kHICoordSpaceWindow,kHICoordSpaceScreenPixel, orkHICoordSpace72DPIGlobal.- outShape
A pointer to a shape (an HIShape object). On output, the shape describes the specified window region. The shape is returned in the specified coordinate space. You should release the shape when you no longer need it. If the window does not support the specified window region, no shape is returned.
Return Value
A result code. If the window does not support the specified window region, the result returned is errWindowRegionCodeInvalid. For other possible values, see “Window Manager Result Codes.”
Availability
- Available in OS X v10.5 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hHIWindowCreate
Creates a standard or custom window.
OSStatus HIWindowCreate ( WindowClass inClass, const int *inAttributes, const WindowDefSpec *inDefSpec, HICoordinateSpace inSpace, const HIRect *inBounds, WindowRef *outWindow );
Parameters
- inClass
The class of window to be created. For a list of possible classes, see
“Window Class Constants”.- inAttributes
A zero-terminated array of window attribute constants. Each array entry specifies an attribute of the window to set. You may pass
NULLif you don't need to set any attributes. For a list of possible attributes, see“Window Attribute Identifiers”.- inDefSpec
A pointer to a custom window proc ID or root view for the window. You may pass
NULLif you don't need to customize the window.- inSpace
The coordinate space in which the content bounds is expressed. This parameter must be either
kHICoordSpaceScreenPixelsorkHICoordSpace72DPIGlobal.- inBounds
A pointer to the bounds of the content area of the window in the coordinate space specified by the
inSpaceparameter. If you specify non-integral coordinates, they will be rounded to the nearest integral value in screen pixel space when the window is actually positioned or sized.- outWindow
A pointer to a window variable. On output, the variable contains the new window.
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
This function makes it possible to create windows with content bounds expressed in different coordinate spaces. In Mac OS X v10.5 and later, you can use this function in place of CreateNewWindow or CreateCustomWindow to create a window from a set of parameters.
Most developers will want to work primarily in the 72 DPI coordinate space. Doing so makes your code independent of the current user interface scale factor, and eases source compatibility with earlier versions of Mac OS X that do not support resolution independence. However, there are also certain cases where your application must express your window's bounds in pixel coordinates; primarily when you need to position your windows so they exactly align with each other or with some other fixed location, such as the edge of the display. For these cases, you should use the screen pixel coordinate space.
Availability
- Available in OS X v10.5 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hHIWindowCreateCollapsedDockTileContext
Creates a Quartz graphics context for drawing a collapsed window’s Dock tile.
OSStatus HIWindowCreateCollapsedDockTileContext ( WindowRef inWindow, CGContextRef *outContext, HISize *outContextSize );
Parameters
- inWindow
The collapsed window.
- outContext
A pointer to a
CGContextRefvariable. On output, the variable contains the graphics context for drawing the window’s Dock tile.- outContextSize
A pointer to a
HISizestructure. On output, the structure contains the width and height of the area in which to draw.
Return Value
A result code. If the window is not collapsed, the result code is windowWrongStateErr. For other possible values, see “Window Manager Result Codes.”
Discussion
When you are finished drawing in the graphics context, you should:
Call
CGContextFlushto ensure that your drawing appears onscreen.Call
HIWindowReleaseCollapsedDockTileContextto release the context. Do not callCFReleaseorCGContextReleaseto release the context, or you may leak system resources.
Availability
- Available in OS X v10.5 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hHIWindowFindAtLocation
Finds a window in the current process at a specified location.
OSStatus HIWindowFindAtLocation ( const HIPoint *inLocation, HICoordinateSpace inSpace, WindowRef inStartWindow, OptionBits inOptions, WindowRef *outWindow, WindowPartCode *outWindowPart, HIPoint *outWindowLocation );
Parameters
- inLocation
The location, in global coordinates, at which to search for a window.
- inSpace
The coordinate space in which the location is expressed. This parameter must be either
kHICoordSpaceScreenPixelorkHICoordSpace72DPIGlobal.- inStartWindow
The window at which to start the search, inclusive. Pass
kFirstWindowOfClassto start the search at the beginning of the window list. PassingNULLwill cause the search to start at the end of the window list, and therefore no window will be found.- inOptions
Reserved. Pass zero.
- outWindow
A pointer to a window variable. On output, the variable contains the window in the current process at the specified location, if any, or
NULLif no window is found.- outWindowPart
A pointer to a window part code variable. On output, the variable contains the window part that was hit. You may pass
NULLif you don't need this information.- outWindowLocation
A pointer to a point variable. On output, the variable contains the specified location transformed into window-relative coordinates, taking into account any window transform or magnification. You may pass
NULLif you don't need this information.
Return Value
A result code. If no window is found that satisfies the search criteria, this function returns errWindowNotFound. For other possible return values, see “Window Manager Result Codes.”
Discussion
This function searches the window list of the current process for a window that contains the specified location. If you need to determine whether the window is of a particular class, you can use the function GetWindowClass and compare the result to the desired class.
Availability
- Available in OS X v10.5 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hHIWindowFlush
Flushes any dirty areas a window might have.
OSStatus HIWindowFlush ( WindowRef inWindow );
Parameters
- window
The window to flush.
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
This function allows you to manually flush dirty areas of a window to the screen. This is the preferred way to flush window buffers in Mac OS X v10.3 and later. If called for a composited window, this function also renders any views in the window that are invalid.
Availability
- Available in OS X v10.3 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hHIWindowFromCGWindowID
Returns the window in the current process with a specified Quartz window ID.
WindowRef HIWindowFromCGWindowID ( CGWindowID inWindowID );
Parameters
- inWindowID
The window ID, as returned by
HIWindowGetCGWindowIDorCGWindowListCopyWindowInfo.
Return Value
The window to which the window ID is assigned. This function returns NULL if the window ID is invalid or if it refers to a window in another process.
Discussion
This function returns the window in the current process to which the specified window ID is assigned by the window server when the window is created.
Availability
- Available in OS X v10.5 and later.
- Not available to 64-bit applications.
See Also
Declared In
MacWindows.hHIWindowGetAvailability
Obtains the availability of a window during Exposé or in Spaces.
OSStatus HIWindowGetAvailability ( WindowRef inWindow, HIWindowAvailability *outAvailability );
Parameters
- inWindow
The window whose availability is to be obtained.
- outAvailability
On exit, the current setting of the window’s availability bits. For details, see “Window Availability Constants.”
Return Value
A result code. See “Window Manager Result Codes.”
Availability
- Available in OS X v10.4 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hHIWindowGetAvailablePositioningBounds
Gets the available window positioning bounds on a display.
OSStatus HIWindowGetAvailablePositioningBounds ( CGDirectDisplayID inDisplay, HICoordinateSpace inSpace, HIRect *outAvailableRect );
Parameters
- inDisplay
The display for which to find the available bounds. May be
kCGNullDirectDisplayto request the bounds of the main display.- inSpace
The coordinate space in which the positioning bounds should be returned. This must be either
kHICoordSpaceScreenPixelorkHICoordSpace72DPIGlobal.- outAvailableRect
A pointer to a rectangle provided by the caller. On output, the rectangle contains the available bounds for the specified display. This rectangle is returned in the specified coordinate space.
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
This function gets the bounds of the display not including the menu bar and Dock, if located on that display.
Availability
- Available in OS X v10.5 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hHIWindowGetBounds
Gets the bounds of a specified region of a window.
OSStatus HIWindowGetBounds ( WindowRef inWindow, WindowRegionCode inRegion, HICoordinateSpace inSpace, HIRect *outBounds );
Parameters
- inWindow
The window to access.
- inRegion
The window region. For a list of possible values, see
“Window Region Constants”.- inSpace
The coordinate space in which the bounds should be returned. This parameter must be
kHICoordSpaceWindow,kHICoordSpaceScreenPixel, orkHICoordSpace72DPIGlobal.- outBounds
A pointer to an
HIRectstructure. On output, the structure contains the origin and size of the bounding rectangle of the specified window region. If the window does not support the region, the structure is not modified.
Return Value
A result code. If the window does not support the specified window region, the result returned is errWindowRegionCodeInvalid.
Availability
- Available in OS X v10.5 and later.
- Not available to 64-bit applications.
See Also
Declared In
MacWindows.hHIWindowGetCGWindowID
Returns the Quartz window ID assigned to a window.
CGWindowID HIWindowGetCGWindowID ( WindowRef inWindow );
Parameters
- inWindow
The window to access.
Return Value
The window ID of the specified window, or zero if the window is invalid.
Discussion
This function returns the window ID assigned by the window server when a window is created. The window ID is not generally useful with any other Carbon function, but may be used with other Mac OS X functions that require a window ID, such as functions in OpenGL.
Availability
- Available in OS X v10.5 and later.
- Not available to 64-bit applications.
See Also
Declared In
MacWindows.hHIWindowGetGreatestAreaDisplay
Finds the display with the greatest area of intersection with a window region.
OSStatus HIWindowGetGreatestAreaDisplay ( WindowRef inWindow, WindowRegionCode inRegion, HICoordinateSpace inSpace, CGDirectDisplayID *outGreatestDisplay, HIRect *outGreatestDisplayRect );
Parameters
- inWindow
The window to compare against.
- inRegion
The window region to compare against. See “Window Region Constants” for a list of possible values.
- inSpace
The coordinate space in which the display bounds should be returned. This must be either
kHICoordSpaceScreenPixelorkHICoordSpace72DPIGlobal.- outGreatestDisplay
A pointer to a display ID provided by the caller, or
NULLif you don't need this information. On output, the display ID contains the display with the greatest intersection.- outGreatestDisplayRect
A pointer to a rectangle provided by the caller, or
NULLif you don't need this information. On output, the rectangle contains the bounds of the display with the greatest intersection. If the display with the greatest intersection also contains the menu bar, the rectangle excludes the menu bar area. This rectangle is returned in the specified coordinate space.
Return Value
A result code. See “Window Manager Result Codes.”
Availability
- Available in OS X v10.5 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hHIWindowGetIdealUserState
Gets the bounds of a window’s content region in its user state.
OSStatus HIWindowGetIdealUserState ( WindowRef inWindow, HICoordinateSpace inSpace, HIRect *outUserState );
Parameters
- inWindow
The window to access.
- inSpace
The coordinate space in which the user state bounds should be returned. This parameter must be
kHICoordSpaceScreenPixelorkHICoordSpace72DPIGlobal.- outUserState
A pointer to a structure of type
HIRect. On return, this rectangle contains the global coordinates of the window’s content region when zoomed in. If the window has not yet been zoomed, this rectangle contains the window’s current content bounds.
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
This function returns information about the window’s user state most recently recorded by the function ZoomWindowIdeal.
Availability
- Available in OS X v10.5 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hHIWindowGetProxyFSRef
Obtains the FSRef used to determine the proxy icon for a window.
OSStatus HIWindowGetProxyFSRef ( WindowRef window, FSRef *outRef );
Parameters
- inWindow
The window whose proxy
FSRefis to be obtained.- outRef
On exit, the
FSReffor the window’s proxy icon.
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
If the specified window’s proxy icon has been specified using HIWindowSetProxyFSRef or SetWindowProxyAlias, HIWindowGetProxyFSRef returns noErr and a valid FSRef for the window’s proxy icon. If the window has no proxy icon, or if the icon was specified by calling SetWindowProxyCreatorAndType or SetWindowProxyIcon, this function returns an error.
Availability
- Available in OS X v10.4 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hHIWindowGetThemeBackground
Gets the theme background brush for a window.
OSStatus HIWindowGetThemeBackground ( WindowRef inWindow, ThemeBrush *outThemeBrush );
Parameters
- inWindow
The window from which to get the brush.
- outThemeBrush
A pointer to a theme brush. On output, the brush is the window’s theme background brush.
Return Value
A result code. If no brush is found, themeNoAppropriateBrushErr is returned.
Discussion
This function gets the theme background brush previously set by calling the function SetThemeWindowBackground.
Availability
- Available in OS X v10.5 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hHIWindowInvalidateShadow
Recalculates a window’s shadow.
OSStatus HIWindowInvalidateShadow ( WindowRef inWindow );
Parameters
- inWindow
The window whose shadow is to be recalculated.
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
HIWindowInvalidateShadow is not typically used by applications. It is useful if your application has customized window frames that change shape dynamically. After you have drawn the new window shape, you should call HIWindowInvalidateShadow to recalculate the shadow so that it follows the new window shape.
Availability
- Available in OS X v10.4 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hHIWindowIsAttributeAvailable
Returns a Boolean value indicating whether a window attribute is valid for a specified window class.
Boolean HIWindowIsAttributeAvailable ( WindowClass inClass, int inAttr );
Parameters
- inClass
The window class to test.
- inAttr
The window attribute to test. You must specify one of the window attributes described in
“Window Attribute Identifiers”.
Return Value
If true, the window class supports the specified attribute. Otherwise, false.
Availability
- Available in OS X v10.5 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hHIWindowIsDocumentModalTarget
Determines if a window is currently the target window of another document modal window, such as a sheet.
Boolean HIWindowIsDocumentModalTarget ( WindowRef inWindow, WindowRef *outOwner );
Parameters
- inWindow
The window to query.
- outOwner
If this function returns
true,inWindowis the target of a document modal window andoutOwneris set to the document modal window. If this function does not returntrue,outOwneris undefined. PassNULLif you don’t want the owner’s window reference.
Return Value
A Boolean whose value is true if the window specified by inWindow is currently the target of a document modal window; otherwise, false.
Availability
- Available in OS X v10.3 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hHIWindowIsInStandardState
Returns a Boolean value indicating whether a window is zoomed out to its standard state.
Boolean HIWindowIsInStandardState ( WindowRef inWindow, const HISize *inIdealSize, HICoordinateSpace inSpace, HIRect *outIdealStandardState );
Parameters
- inWindow
The window whose zoom state is to be determined.
- inIdealSize
The ideal width and height of the window’s content region, regardless of the actual screen device dimensions. If you set
inIdealSizetoNULL, this function examines the dimensions stored in thestdStatefield of theWStateDatastructure.- inSpace
The coordinate space in which the ideal size is expressed and in which the standard state bounds should be returned. This parameter must be either
kHICoordSpaceScreenPixelorkHICoordSpace72DPIGlobal.- outIdealStandardState
A pointer to an
HIRectvariable. On return, the variable contains the bounds of the content region of the window in its standard state, based on the data supplied in theinIdealSizeparameter. You may passNULLif you do not need this information.
Return Value
If true, the window is currently in its standard state. If false, the window is currently in its user state.
Discussion
This function compares the window’s current dimensions to those in the inIdealSize parameter to determine if the window is currently in its standard state. You can use this function to decide whether a user’s click in the zoom box is a request to zoom to the user state or the standard state, as described in the function ZoomWindowIdeal. You can also use this function to determine the size and position of the standard state that the Window Manager would calculate for a window, given a specified ideal size; this value is returned in the outIdealStandardState parameter.
Availability
- Available in OS X v10.5 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hHIWindowReleaseCollapsedDockTileContext
Releases a Quartz graphics context for drawing a collapsed window’s Dock tile.
OSStatus HIWindowReleaseCollapsedDockTileContext ( WindowRef inWindow, CGContextRef inContext );
Parameters
- inWindow
The collapsed window.
- inContext
The graphics context to release. On return, the context is invalid and should no longer be used.
Return Value
A result code. If the window is not collapsed, the result code is windowWrongStateErr. For other possible values, see “Window Manager Result Codes.”
Discussion
To ensure that your drawing appears onscreen, you should call CGContextFlush before calling this function to release the context. Do not call CFRelease or CGContextRelease to release the context, or you may leak system resources.
Availability
- Available in OS X v10.5 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hHIWindowSetBounds
Sets the bounds of a window based on either the structure or content region.
OSStatus HIWindowSetBounds ( WindowRef inWindow, WindowRegionCode inRegion, HICoordinateSpace inSpace, HIRect *inBounds );
Parameters
- inWindow
The window to access.
- inRegion
The window region on which to base the window's new bounds. This parameter must be either
kWindowStructureRgnorkWindowContentRgn.- inSpace
The coordinate space in which the bounds are expressed. This parameter must be
kHICoordSpaceWindow,kHICoordSpaceScreenPixel, orkHICoordSpace72DPIGlobal.- inBounds
A pointer to an
HIRectstructure that specifies the origin and size of the bounding rectangle of the specified window region. If the coordinate space iskHICoordSpaceWindow, then the origin of the bounds is a window-relative value. Therefore, you can use this coordinate space to resize a window without first getting its current bounds by setting the origin to (0,0), or you can offset a window from its current position by setting the origin to the offset amount and the size to the window's current size.
Return Value
A result code. See “Window Manager Result Codes.”
Availability
- Available in OS X v10.5 and later.
- Not available to 64-bit applications.
See Also
Declared In
MacWindows.hHIWindowSetIdealUserState
Sets the bounds of a window’s content region in its user state.
OSStatus HIWindowSetIdealUserState ( WindowRef inWindow, HICoordinateSpace inSpace, const HIRect *inUserState );
Parameters
- inWindow
The window to access.
- inSpace
The coordinate space in which the user state bounds are expressed. This parameter must be either
kHICoordSpaceScreenPixelorkHICoordSpace72DPIGlobal.- inUserState
The new bounds (position and size) of the window’s content region in its user state.
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
A window’s ideal user state is used by the function ZoomWindowIdeal when zooming in.
Availability
- Available in OS X v10.5 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hHIWindowSetProxyFSRef
Sets the proxy icon for a window using an FSRef to a file system object.
OSStatus HIWindowSetProxyFSRef ( WindowRef window, const FSRef *inRef );
Parameters
- inWindow
The window whose proxy icon is to be set.
- inRef
The file system object the window represents.
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
This function determines the window’s proxy icon by asking Icon Services for the icon for the object specified by inRef.
Availability
- Available in OS X v10.4 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hHIWindowSetToolbarView
Sets a custom toolbar view for a window.
OSStatus HIWindowSetToolbarView ( WindowRef inWindow, HIViewRef inView );
Parameters
- inWindow
The window whose toolbar view to set.
- inView
The custom toolbar view for the window. You may pass
NULLto remove the custom view from the window. Setting a custom view will also remove any HIToolbar that is associated with the window.After a custom toolbar view has been set, the window owns the view and will release it automatically when the window is destroyed, or when a different custom view or standard HIToolbar is set for the window.
Return Value
A result code.
Discussion
This function is provided for use by applications that cannot use the HIToolbar API. For best compatibility with future versions of Mac OS X, you should use HIToolbar if possible. However, if HIToolbar is not sufficient for your needs, you can use this function to provide a custom toolbar view that will be placed at the standard location inside the window frame.
You are responsible for defining the appearance and behavior of the view. You cannot use this function to customize the view that is associated with an HIToolbar; a window with an HIToolbar uses a standard view that cannot be customized. When using a custom toolbar view, no function that takes an HIToolbar will work with that window. For more information about custom toolbar views, see MacWindows.h.
Availability
- Available in OS X v10.4 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hHIWindowShowsFocus
Returns a Boolean value indicating whether a window's content should show focus indicators such as focus rings.
Boolean HIWindowShowsFocus ( WindowRef inWindow );
Parameters
- inWindow
The window to access.
Return Value
If true, a window's content should show focus indicators; otherwise false.
Discussion
This function returns true if the window is either the modeless focus or the effective focus.
Availability
- Available in OS X v10.5 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hHIWindowTestAttribute
Returns a Boolean value indicating whether a window has a specified attribute.
Boolean HIWindowTestAttribute ( WindowRef inWindow, int inAttr );
Parameters
- inWindow
The window to test.
- inAttr
The window attribute to test. You must specify one of the window attributes described in
“Window Attribute Identifiers”.
Return Value
If true, the window has the specified attribute. Otherwise, false.
Availability
- Available in OS X v10.5 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hHIWindowTrackProxyDrag
Tracks the drag of a window proxy icon.
OSStatus HIWindowTrackProxyDrag ( WindowRef inWindow, EventRef inEvent, DragRef inDrag );
Parameters
- inWindow
The window whose proxy icon to drag.
- inEvent
The event that resulted in starting a drag. This will most commonly be
kEventControlTrack, but any event withkEventParamMouseLocationandkEventParamKeyModifiersparameters is all that is required.- inDrag
The proxy icon drag reference. You may pass
NULLif you want the Window Manager to create and populate the drag reference. The Window Manager will add its own drag flavors to the drag even if you pass a pre-created drag reference.
Discussion
You can use this function to manage the dragging of the proxy icon in your application's windows. If you use the standard window event handler and you do not need to customize the proxy icon drag process, you may rely on the standard handler to call this function.
If you want to allow the Window Manager to create the drag reference and populate it with drag flavors, you should pass NULL in the inDrag parameter. If you want to create the drag reference yourself and add your own drag flavors, you should call BeginWindowProxyDrag to create the drag reference, add your own flavors, call HIWindowTrackProxyDrag to track the proxy icon drag, and then call EndWindowProxyDrag to release the drag reference.
A proxy icon may only be dragged if the window represented by the proxy icon is not modified, as indicated by the IsWindowModified function. This restriction exists because a proxy icon is a representation of a physical file system object, and dragging the proxy icon may result in the Finder making a copy of the file system object. If the window is modified, then it contains user data that has not yet been saved to disk; making a copy of the file system object would result in a stale copy that did not contain the user’s current data.
By default, all newly created windows are considered to be dirty. The application must pass false to SetWindowModified before the proxy icon will be draggable. In Mac OS X v10.3 and later, the proxy icon is also draggable in dirty windows if the proxy icon was provided using the SetWindowProxyIcon or SetWindowProxyCreatorAndType functions. Dragging is allowed in this case because the window does not represent an actual file system object, and therefore there is no risk of user data loss.
Availability
- Available in OS X v10.5 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hInvalWindowRect
Adds a rectangle to a window’s update region.
OSStatus InvalWindowRect ( WindowRef window, const Rect *bounds );
Parameters
- window
The window containing the rectangle you want to be updated.
- bounds
Set this structure to specify, in local coordinates, a rectangle to be added to the window’s update region.
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
The InvalWindowRect function informs the Window Manager that an area of a window should be redrawn.
See also the functions ValidWindowRect and InvalWindowRgn.
Special Considerations
This function should not be used on composited windows. Modifying a composited window's update region does not affect the area of the window to be drawn. A composited window does not use its window update region to control drawing. Instead, a composited window determines what to draw by looking at the invalid regions of the views contained in the window.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hInvalWindowRgn
Adds a region to a window’s update region.
OSStatus InvalWindowRgn ( WindowRef window, RgnHandle region );
Parameters
- window
The window containing the region that you want to update.
- region
Set this region to specify, in local coordinates, the area to be added to the window’s update region.
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
The InvalWindowRgn function informs the Window Manager that an area of a window should be redrawn.
See also the functions InvalWindowRect and ValidWindowRgn.
Special Considerations
This function should not be used on composited windows. Modifying a composited window's update region does not affect the area of the window to be drawn. A composited window does not use its window update region to control drawing. Instead, a composited window determines what to draw by looking at the invalid regions of the views contained in the window.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hIsValidWindowClass
Determines whether a given window class is valid.
Boolean IsValidWindowClass ( WindowClass inClass );
Parameters
- inClass
The window class to query.
Return Value
A Boolean whose value is true if the window class is valid; otherwise, false.
Availability
- Available in OS X v10.1 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hIsValidWindowPtr
Reports whether a pointer is a valid window pointer.
Boolean IsValidWindowPtr ( WindowRef possibleWindow );
Parameters
- possibleWindow
The window to query.
Return Value
A Boolean whose value is true if the specified pointer is a valid window pointer; otherwise, false.
Discussion
This function is primarily intended for use with debugging your application.
Special Considerations
The IsValidWindowPtr function is a processor-intensive call.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hIsWindowActive
Indicates whether the specified window is active.
Boolean IsWindowActive ( WindowRef inWindow );
Parameters
- inWindow
The window to query.
Return Value
Returns true if the window is active, false otherwise.
Discussion
Whether a window is considered active is determined by its activation scope, highlighting, and z-order. For windows that have an activation scope of kWindowActivationScopeAll, a window is active if it is the window returned by the ActiveNonFloatingWindow function or if it is in the same window group as the window returned by ActiveNonFloatingWindow and the window group has the kWindowGroupAttrSharedActivation attribute. For windows that have some other activation scope, the window is active if its window frame is highlighted and the window is the frontmost window in its window group.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hIsWindowCollapsable
Determines whether a window can be collapsed.
Boolean IsWindowCollapsable ( WindowRef window );
Parameters
- window
The window to be examined.
Return Value
If true, the window can be collapsed; otherwise, false.
Discussion
You can call the IsWindowCollapsable function to determine if a given window can be collapsed by the CollapseWindow function. In Mac OS X, the presence or absence of the kWindowCollapseBoxAttribute is the primary way of determining whether a window can be collapsed. If that attribute is not present, the Window Manager checks for the kWindowCanCollapse feature bit.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hIsWindowCollapsed
Determines whether a window is currently collapsed.
Boolean IsWindowCollapsed ( WindowRef window );
Parameters
- window
The window to be examined.
Return Value
If true, the window is collapsed. If false, the window is expanded.
Discussion
On Mac OS 9, only window definition functions that return the feature bit kWindowCanCollapse in response to a kWindowGetFeatures message support this function; for more information, see GetWindowFeatures. Typically, a window’s content region is empty in a collapsed state. In Mac OS X, the presence or absence of the kWindowCollapseBoxAttribute attribute determines whether a window can be collapsed.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hIsWindowContainedInGroup
Determines if a window is a member of a window group or any of its subgroups.
Boolean IsWindowContainedInGroup ( WindowRef inWindow, WindowGroupRef inGroup );
Parameters
- inWindow
The window to query.
- inGroup
The window group to query.
Return Value
A Boolean whose value is true if inWindow is a member of the window group specified by inGroup, or if inWindow is a member of a window group that is a member of the window group specified by inGroup. Otherwise, this function returns false.
Discussion
This function returns true if group A contains window A. It also returns true if group A contains group B and group B contains window A.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hIsWindowHilited
Indicates whether the window frame is currently highlighted.
Boolean IsWindowHilited ( WindowRef window );
Parameters
- window
The window to query.
Return Value
A Boolean value indicating whether or not the window frame is highlighted. If true, the window is visible. If false, the window frame is not highlighted.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hIsWindowInStandardState
Determines whether a window is currently zoomed in to the user state or zoomed out to the standard state.
Boolean IsWindowInStandardState ( WindowRef inWindow, const Point *inIdealSize, Rect *outIdealStandardState );
Parameters
- inWindow
The window whose zoom state is to be determined.
- inIdealSize
Set the
Pointstructure to contain the ideal width and height of the window’s content region, regardless of the actual screen device dimensions. If you setinIdealSizetoNULL,IsWindowInStandardStateexamines the dimensions stored in thestdStatefield of theWStateDatastructure.- outIdealStandardState
On input, a pointer to a structure of type
Rect. On return, the rectangle contains the global coordinates for the content region of the window in its standard state, based on the data supplied in theinIdealSizeparameter. You may passNULLif you do not want to receive this data.
Return Value
A Boolean whose value is true if the window is currently in its standard state; false if the window is currently in the user state.
Discussion
The IsWindowInStandardState function compares the window’s current dimensions to those referred to by the inIdealSize parameter to determine if the window is currently in the standard state. Your application may use IsWindowInStandardState to decide whether a user’s click of the zoom box is a request to zoom to the user state or the standard state, as described in the function ZoomWindowIdeal. Your application may also use IsWindowInStandardState to determine the size and position of the standard state that the Window Manager would calculate for a window, given a specified ideal size; this value is produced in the outIdealStandardState parameter.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
See Also
Declared In
MacWindows.hIsWindowLatentVisible
Indicates whether a window is visible onscreen or is latently visible but not currently onscreen.
Boolean IsWindowLatentVisible ( WindowRef inWindow, WindowLatentVisibility *outLatentVisible );
Parameters
- inWindow
The window to query.
- outLatentVisible
If the window is onscreen, the latent visibility is zero. If the window is offscreen, this parameter returns the latent visibility flags of the window. If any of the flags are set, the window is latently visible.
Return Value
A Boolean whose value is true if the window is currently onscreen; otherwise, false.
Discussion
All windows are either onscreen or offscreen. A window that is offscreen may still be latently visible. This occurs, for example, when a floating window is hidden as an application is suspended. The floating window is not visible onscreen, but it is latently visible and is only hidden due to the suspended state of the application. When the application becomes active again, the floating window will be placed back onscreen.
Availability
- Available in OS X v10.1 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hIsWindowModified
Obtains the modification state of the specified window.
Boolean IsWindowModified ( WindowRef window );
Parameters
- window
The window whose modification state is to be obtained.
Return Value
true if the content of the window has been modified; otherwise, false. Newly created windows start out with their modification state automatically set to true.
Discussion
Your application can use the functions IsWindowModified and SetWindowModified instead of maintaining its own separate record of the modification state of the content of a window.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hIsWindowPathSelectEvent
Determines whether a Carbon event describing a click on a window’s title should cause a path selection menu to be displayed.
Boolean IsWindowPathSelectEvent ( WindowRef window, EventRef inEvent );
Parameters
- window
The window to query.
- inEvent
The event. In CarbonLib and in Mac OS X v10.2 and earlier, the function only returns
trueforkEventClassMouse/kEventMouseDownevents. In Mac OS X v10.3 and later, this function returnstruefor any event that has suitablekEventParamMouseLocationandkEventParamModifiersparameters.
Return Value
A Boolean whose value is true if the click should cause a path selection menu to be displayed; otherwise, false. If this function returns true, the application should call WindowPathSelect.
Discussion
Windows that have a proxy icon provided using an FSRef or alias can support a path selection menu, which displays the file system path to the object, one menu item per directory. Making a selection from this item automatically opens the corresponding object in the Finder.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hIsWindowToolbarVisible
Determines whether a window’s toolbar is visible.
Boolean IsWindowToolbarVisible ( WindowRef inWindow );
Parameters
- inWindow
The window to query.
Return Value
A Boolean whose value is true if the window’s toolbar is visible; otherwise, false.
Availability
- Available in OS X v10.2 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hIsWindowUpdatePending
Determines whether a window update is pending.
Boolean IsWindowUpdatePending ( WindowRef window );
Parameters
- window
The non-composited window to query.
Return Value
A Boolean whose value is true if an update is pending; otherwise, false.
Special Considerations
Modifying a composited window's update region does not affect the area of the window to be drawn. A composited window does not use its window update region to control drawing. Instead, a composited window determines what to draw by looking at the invalid regions of the views contained in the window.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hIsWindowVisible
Indicates whether the window frame is currently visible.
Boolean IsWindowVisible ( WindowRef window );
Parameters
- window
The window to query.
Return Value
A Boolean value indicating whether or not the window is visible. If true, the window is visible. If false, the window is invisible.
Availability
- Available in Mac OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hMoveWindow
Moves a window on the desktop.
void MoveWindow ( WindowRef window, short hGlobal, short vGlobal, Boolean front );
Parameters
- window
The window that is to be moved on the desktop.
- hGlobal
On input, the new location, in global coordinates, of the left edge of the window’s port rectangle.
- vGlobal
On input, the new location, in global coordinates, of the top edge of the window’s port rectangle.
- front
On input, a Boolean value specifying whether the window is to become the frontmost, active window. If the value of the front parameter is
false,MoveWindowdoes not change its plane or status. If the value of the front parameter istrueand the window isn’t active,MoveWindowmakes it active by calling theSelectWindowfunction.
Discussion
The MoveWindow function moves the specified window to the location specified by the hGlobal and vGlobal parameters, without changing the window’s size. The upper-left corner of the window’s port rectangle is placed at the point (vGlobal, hGlobal). The local coordinates of the upper-left corner are unaffected.
Your application doesn’t normally call MoveWindow. When the user drags a window by dragging its title bar, you can call DragWindow which in turn calls MoveWindow when the user releases the mouse button.
Availability
- Available in Mac OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hMoveWindowStructure
Positions a window relative to its structure region.
OSStatus MoveWindowStructure ( WindowRef window, short hGlobal, short vGlobal );
Parameters
- window
The window that is to be moved.
- hGlobal
A value specifying the horizontal position, in global coordinates, to which the left edge of the window’s structure region is to be moved.
- vGlobal
A value specifying the vertical position, in global coordinates, to which the top edge of the window’s structure region is to be moved.
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
The MoveWindowStructure function moves the specified window, but does not change the window’s size. When your application calls MoveWindowStructure, the positioning of the specified window is determined by the positioning of its structure region. This is in contrast to the MoveWindow function, where the positioning of the window’s content region determines the positioning of the window. After moving the window, MoveWindowStructure displays the window in its new position.
Note that your application should not call the MoveWindowStructure function to position a window when the user drags the window by its drag region. When the user drags the window, your application should call the pre–Mac OS 8.5 Window Manager function DragWindow.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hOpenDrawer
Opens a drawer.
OSStatus OpenDrawer ( WindowRef inDrawerWindow, OptionBits inEdge, Boolean inAsync );
Parameters
- inDrawerWindow
The drawer window to open.
- inEdge
The parent window edge on which to open the drawer. Pass
kWindowEdgeDefaultto use the drawer’s preferred edge. If there is not enough room on the preferred edge,OpenDrawertries the opposite edge. If there is insufficient room on both edges, the drawer will open on the preferred edge but may extend offscreen, under the Dock, or under the menu bar.- inAsync
Indicates whether to open the drawer synchronously (the drawer is entirely opened before the function call returns) or asynchronously (the drawer opens using an event loop timer after the function call returns). Specify
truefor asynchronous andfalsefor synchronous.
Return Value
A result code. See “Window Manager Result Codes.”
Availability
- Available in OS X v10.2 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hPinRect
Returns the point within the specified rectangle that is closest to the specified point.
long PinRect ( const Rect *theRect, Point thePt );
Parameters
- theRect
On input, a pointer to a rectangle in which the point is to be contained.
- thePt
On input, a pointer to the point to be contained.
Return Value
A long integer that specifies a point within the specified rectangle that is as close as possible to the specified point. (The high-order word of the returned long integer is the vertical coordinate; the low-order word is the horizontal coordinate.
Discussion
DragGrayRgn uses the PinRect function to contain a point within a specified rectangle. If the specified point is within the rectangle, PinRect returns the point itself. If not, then
if the horizontal position is to the left of the rectangle,
PinRectreturns the left edge as the horizontal coordinateif the horizontal position is to the right of the rectangle,
PinRectreturns the right edge minus 1 as the horizontal coordinateif the vertical position is above the rectangle,
PinRectreturns the top edge as the vertical coordinateif the vertical position is below the rectangle,
PinRectreturns the bottom edge minus 1 as the vertical coordinate
The 1 is subtracted when the point is below or to the right of the rectangle so that a pixel drawn at that point lies within the rectangle.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hRegisterWindowDefinition
Registers a binding between a resource ID and a window definition function.
OSStatus RegisterWindowDefinition ( SInt16 inResID, const WindowDefSpec *inDefSpec );
Parameters
- inResID
A WDEF proc ID, as used in a
'WIND'resource.- inDefSpec
Specifies the
WindowDefUPPthat should be used for windows with the given WDEF proc ID. PassNULLto unregister a given WDEF proc ID.
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
In the Mac OS 8.x Window Manager, a 'WIND' resource can contain an embedded WDEF procID that is used by the Window Manager as the resource ID of a 'WDEF' resource to lay out and draw the window. The 'WDEF' resource is loaded by the Window Manager when you load the window with GetNewWindow. Since WDEFs can no longer be packaged as code resources on Carbon, the procID can no longer refer directly to a WDEF resource. However, using RegisterWindowDefinition you can instead specify a UniversalProcPtr pointing to code in your application code fragment.
To unregister a window definition, pass NULL in the inDefSpec parameter for a given WDEF proc ID.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hReleaseWindowGroup
Decrements the reference count for a window group.
OSStatus ReleaseWindowGroup ( WindowGroupRef inGroup );
Parameters
- inGroup
The window group whose reference count is to be queried.
Return Value
A result code. See “Window Manager Result Codes.”
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hRemoveWindowProperty
Removes a piece of data that is associated with a window.
OSStatus RemoveWindowProperty ( WindowRef window, PropertyCreator propertyCreator, PropertyTag propertyTag );
Parameters
- window
The window whose data is to be removed.
- propertyCreator
The creator code (typically, the application’s signature) of the associated data to be removed.
- propertyTag
The application-defined code identifying the associated data to be removed.
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
The data removed by the RemoveWindowProperty function must have been previously associated with the window with the function SetWindowProperty.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hRemoveWindowProxy
Dissociates a file from a window.
OSStatus RemoveWindowProxy ( WindowRef window );
Parameters
- window
The window for which you want to remove the associated file.
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
The RemoveWindowProxy function redraws the window title bar after removing all data associated with a given file, including the proxy icon, path menu, and file data.
Special Considerations
On Mac OS 8.x and Mac OS 9.x, you must save and restore the current graphics port—by calling the QuickDraw functions GetPort and SetPort—around each call to the RemoveWindowProxy function.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hRepositionWindow
Positions a window relative to another window or a display screen.
OSStatus RepositionWindow ( WindowRef window, WindowRef parentWindow, WindowPositionMethod method );
Parameters
- window
The window whose position you want to set.
- parentWindow
A pointer to the “parent” window, as defined by your application. In cases where the window positioning method does not require a parent window, you should set the
parentWindowparameter toNULL.- method
A constant specifying the window positioning method to be used; see “Window Position Constants” for descriptions of possible values.
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
Your application may call the RepositionWindow function to position any window, relative to another window or to a display screen. After positioning the window, RepositionWindow displays the window in its new position.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hReshapeCustomWindow
Notifies the Window Manager that a custom window’s shape has changed.
OSStatus ReshapeCustomWindow ( WindowRef window );
Parameters
- window
The window whose shape has changed.
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
If the shape of a custom window needs to change dynamically, outside of the context of normal Window Manager operations, you must use ReshapeCustomWindow to notify the Window Manager so that it can recalculate the window regions and update the screen. The Window Manager queries your custom window definition for the new structure and content regions and updates the screen with the new window shape.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hResizeWindow
Handles all user interaction while a window is being resized.
Boolean ResizeWindow ( WindowRef inWindow, Point inStartPoint, const Rect *inSizeConstraints, Rect *outNewContentRect );
Parameters
- window
The window that is to be resized.
- inStartPoint
Set the
Pointstructure to contain the location, specified in global coordinates, where the mouse-down event occurred. Your application may retrieve this value from thewherefield of theEventRecordstructure.- inSizeConstraints
Set the rectangle to specify the limits on the vertical and horizontal measurements of the content rectangle, in pixels. Although this parameter gives the address of a structure that is in the form of the
Rectdata type, the four numbers in the structure represent limits, not screen coordinates. Thetop,left,bottom, andrightfields of the structure specify the minimum vertical measurement (top), the minimum horizontal measurement (left), the maximum vertical measurement (bottom), and the maximum horizontal measurement (right). The minimum dimensions should be large enough to allow a manageable rectangle; 64 pixels on a side is typical. The maximum dimensions can be no greater than 32,767. You can passNULLto allow the user to resize the window to any size that is contained onscreen.- outNewContentRect
On input, a pointer to a structure of type
Rect. On return, the structure contains the new dimensions of the window’s content region, in global coordinates.
Return Value
true if the window was successfully resized; otherwise, false.
Discussion
The ResizeWindow function moves either an outline of the window’s edges (Mac OS 9.x and earlier) or the actual window (Mac OS X) around the screen, following the user’s cursor movements, and handles all user interaction until the mouse button is released. Unlike with the function GrowWindow, there is no need to follow this call with a call to the function SizeWindow, because once the mouse button is released, ResizeWindow resizes the window if the user has changed the window size. Once the resizing is complete, ResizeWindow draws the window in the new size.
Your application should call ResizeWindow instead of the earlier Window Manager functions SizeWindow and GrowWindow. The ResizeWindow function informs your application of the new window bounds, so that your application can respond to any changes in the window’s position.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hRetainWindowGroup
Increments the reference count for a window group.
OSStatus RetainWindowGroup ( WindowGroupRef inGroup );
Parameters
- inGroup
The window group whose reference count is to be incremented. For information on this data type, see
WindowGroupRef.
Return Value
A result code. See “Window Manager Result Codes.”
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hScrollWindowRect
Scroll any area of a window.
OSStatus ScrollWindowRect ( WindowRef inWindow, const Rect *inScrollRect, SInt16 inHPixels, SInt16 inVPixels, ScrollWindowOptions inOptions, RgnHandle outExposedRgn );
Parameters
- inWindow
The window to scroll in.
- inScrollRect
The rectangle to scroll, in local coordinates.
- inHPixels
The number of pixels to scroll horizontally.
- inVPixels
The number of pixels to scroll vertically.
- inOptions
Options for the scroll. See “Window Scrolling Options” for a list of possible options.
- outExposedRgn
A valid region handle for the area newly revealed by the scroll (can be
NULL). IfNULL, the exposed region is added to the window’s update region, regardless of the state of thekScrollWindowInvalidateoption. This prevents updates from being lost in multiple monitor situations where the Window Manager can’t copy the entire region due to differing color tables.
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
Scrolls pixels that are inside the specified region of the input window. No other pixels or the bits they represent are affected. The pixels are shifted a distance of inHPixels horizontally and inVPixels vertically. The positive directions are to the right and down. The pixels that are shifted out of the specified window are not displayed, and the bits they represent are not saved. The exposed empty area created by the scrolling is returned in the update region parameter and optionally added to the window’s update region.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hScrollWindowRegion
Scrolls a window’s region.
OSStatus ScrollWindowRegion ( WindowRef inWindow, RgnHandle inScrollRgn, SInt16 inHPixels, SInt16 inVPixels, ScrollWindowOptions inOptions, RgnHandle outExposedRgn );
Parameters
- inWindow
The window to scroll in.
- inScrollRgn
The region to scroll, in local coordinates.
- inHPixels
The number of pixels to scroll horizontally.
- inVPixels
The number of pixels to scroll vertically.
- inOptions
Options for the scroll. See “Window Scrolling Options” for a list of possible options.
- outExposedRgn
A valid region handle for the area newly revealed by the scroll (can be
NULL). IfNULL, the exposed region is added to the window’s update region, regardless of the state of thekScrollWindowInvalidateoption. This prevents updates from being lost in multiple monitor situations where the Window Manager can’t copy the entire region due to differing color tables.
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
Scrolls pixels that are inside the specified region of the input window. No other pixels or the bits they represent are affected. The pixels are shifted a distance of inHPixels horizontally and inVPixels vertically. The positive directions are to the right and down. The pixels that are shifted out of the specified window are not displayed, and the bits they represent are not saved. The exposed empty area created by the scrolling is returned in the update region parameter and optionally added to the window’s update region
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hSelectWindow
Makes a window active.
void SelectWindow ( WindowRef window );
Parameters
- window
The window that is to be made active.
Discussion
The SelectWindow function removes highlighting from the previously active window, brings the specified window to the front, highlights it, and generates the activate events to deactivate the previously active window and activate the specified window. If the specified window is already active, SelectWindow has no effect. Call SelectWindow when the user presses the mouse button while the cursor is in the content region of an inactive window.
Even if the specified window is invisible, SelectWindow brings the window to the front, activates the window, and deactivates the previously active window. Note that in this case, no active window is visible on the screen. If you do select an invisible window, be sure to call ShowWindow immediately to make the window visible (and accessible to the user).
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hSendBehind
Moves one window behind another.
void SendBehind ( WindowRef window, WindowRef behindWindow );
Parameters
- window
The window to be moved.
- behindWindow
On input, a pointer to the window that is to be in front of the moved window.
Discussion
The SendBehind function moves the window pointed to by the parameter window behind the window pointed to by the parameter behindWindow. If the move exposes previously obscured windows or parts of windows, SendBehind redraws the frames as necessary and generates the appropriate update events to have any newly exposed content areas redrawn.
If the value of behindWindow is NULL, SendBehind sends the window to be moved behind all other windows on the desktop. If the window to be moved is the active window, SendBehind removes its highlighting, highlights the newly exposed frontmost window, and generates the appropriate activate events.
Do not use SendBehind to deactivate a window after you’ve made a new window active with the function SelectWindow. The SelectWindow function automatically deactivates the previously active window.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hSendWindowGroupBehind
Orders one window group behind another.
OSStatus SendWindowGroupBehind ( WindowGroupRef inGroup, WindowGroupRef behindGroup );
Parameters
- inGroup
The window group.
- behindGroup
The “behind” window group.
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
A window group can contain multiple window groups. You can use this function to order nested groups.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hSetDrawerOffsets
Sets the positioning offsets for the drawer with respect to its parent window.
OSStatus SetDrawerOffsets ( WindowRef inDrawerWindow, CGFloat inLeadingOffset, CGFloat inTrailingOffset );
Parameters
- inDrawerWindow
The drawer window whose positioning offsets are to be set.
- inLeadingOffset
The new leading offset, in pixels. Pass
kWindowOffsetUnchangedif you don’t want to change the leading offset.- inTrailingOffset
The new trailing offset, in pixels. Pass
kWindowOffsetUnchangedif you don’t want to change the trailing offset.
Return Value
A result code. See “Window Manager Result Codes.”
Availability
- Available in OS X v10.2 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hSetDrawerParent
Sets the parent window for a drawer.
OSStatus SetDrawerParent ( WindowRef inDrawerWindow, WindowRef inParent );
Parameters
- inDrawerWindow
The drawer window whose parent window is to be set.
- inParent
The window that is to be set as the parent of the window specified by
inDrawerWindow.
Return Value
A result code. See “Window Manager Result Codes.”
Availability
- Available in OS X v10.2 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hSetDrawerPreferredEdge
Set the preferred window edge from which the drawer should appear.
OSStatus SetDrawerPreferredEdge ( WindowRef inDrawerWindow, OptionBits inEdge );
Parameters
- inDrawerWindow
The drawer window whose preferred window edge is to be set.
- inEdge
The preferred edge. See “Window Edge Constants” for a list of possible values.
Return Value
A result code. See “Window Manager Result Codes.”
Availability
- Available in OS X v10.2 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hSetPortWindowPort
Sets the current graphics port to the window’s port.
void SetPortWindowPort ( WindowRef window );
Parameters
- window
The window whose graphics port is to be set.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hSetThemeTextColorForWindow
Sets a text color that contrasts with a theme brush.
OSStatus SetThemeTextColorForWindow ( WindowRef inWindow, Boolean inActive, SInt16 inDepth, Boolean inColorDev );
Parameters
- inWindow
The window whose text color is to be set.
- inActive
A Boolean whose value is
trueto indicate an active state orfalseto indicate an inactive state.- inDepth
The bit depth of the window’s port. In Mac OS X, this parameter is ignored and should always be set to
32.- inColorDev
A Boolean whose value is
trueto indicate that the window’s port is color orfalseto indicate that the port is black and white. In Mac OS X, this parameter is ignored and should always be set totrue.
Return Value
A result code. See “Window Manager Result Codes” for a list of possible values.
Discussion
SetThemeTextColorForWindow sets a text color in the specified window’s port that contrasts with the brush specified by SetThemeWindowBackground and also matches the inActive parameter.
Only a subset of the theme brushes have theme text colors. As of Mac OS 9 and Mac OS X v10.4 and later, the Alert, Dialog, Modeless Dialog, and Notification brushes have corresponding text colors. For any other brush, SetThemeTextColorForWindow returns themeNoAppropriateBrushErr and does not modify the text color.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hSetThemeWindowBackground
Sets a window’s background theme.
OSStatus SetThemeWindowBackground ( WindowRef inWindow, ThemeBrush inBrush, Boolean inUpdate );
Parameters
- inWindow
The window whose background theme is to be set.
- inBrush
The theme brush that determines how the window background is painted. For information on theme brushes, see the Appearance Manager documentation.
- inUpdate
A Boolean whose value is
trueif you want the window to be redrawn immediately using the new background brush; otherwise,false.
Return Value
A result code. See “Window Manager Result Codes” for a list of possible values.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hSetUserFocusWindow
Designates a window to receive user focus.
OSStatus SetUserFocusWindow ( WindowRef inWindow );
Return Value
A result code.
Discussion
You can use this function to assign user focus to a specified window. This tells the Carbon Event Manager to route events that should go to the user focus (for example, commands and keyboard events) to the specified window. This can be used, for example, to route keyboard events to a floating palette, since floating palettes do not normally receive user focus.
Setting focus automatically defocuses whatever element formerly had user focus. If the focus changes to a new window, the kEventWindowFocusAcquired Carbon event will be sent to the newly focused window, and the kEventWindowFocusRelinquish Carbon event will be sent to the previously focused window.
If you pass kUserFocusAuto in the inWindow parameter, the system picks the best candidate for user focus (typically, this will be the active window). If you temporarily change the focus to a special window, you should use this option to restore the focus rather than setting the focus to an explicit window.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hSetWindowActivationScope
Sets a window’s activation scope.
OSStatus SetWindowActivationScope ( WindowRef inWindow, WindowActivationScope inScope );
Parameters
- inWindow
The window whose activation scope is to be set.
- inScope
The new activation scope.
Return Value
A result code. See “Window Manager Result Codes.”
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hSetWindowAlpha
Sets the window’s alpha channel value.
OSStatus SetWindowAlpha ( WindowRef inWindow, CGFloat inAlpha );
Parameters
- inWindow
The window whose alpha channel value is to be set.
- inAlpha
The alpha value to set. This value can range from 0.0 (completely transparent) to 1.0 (opaque).
Return Value
A result code. See “Window Manager Result Codes.”
Availability
- Available in OS X v10.2 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hSetWindowAlternateTitle
Sets an alternate window title.
OSStatus SetWindowAlternateTitle ( WindowRef inWindow, CFStringRef inTitle );
Parameters
- inWindow
The window for which to set the alternate title.
- inTitle
The alternate title for the window. Passing
NULLfor this parameter will remove any alternate title that might be present.
Return Value
A result code. See “Window Manager Result Codes.” An operating system status code.
Discussion
This API sets an alternate title for a window. The alternate title overrides what is displayed in the Window menu. If you do not set an alternate title, the normal window title is used. You would normally use this if the window title was not expressive enough to be used in the Window menu (or similar text-only situation).
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hSetWindowBounds
Sets a window’s size and position from the bounding rectangle of the specified window region.
OSStatus SetWindowBounds ( WindowRef window, WindowRegionCode regionCode, const Rect *globalBounds );
Parameters
- window
The window whose bounds are to be set.
- regionCode
A constant specifying the region to be used in determining the window’s size and position. The only region codes allowed for this parameter are
kWindowStructureRgnandkWindowContentRgn.- globalBounds
Set the rectangle to specify the dimensions and position, in global coordinates, of the window region specified in the
regionCodeparameter.
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
The SetWindowBounds function sets a window’s size and position to that specified by the rectangle that your application passes in the globalBounds parameter. After doing so, SetWindowBounds redraws the window, if the window is visible.
When you call the SetWindowBounds function, your application specifies whether the window’s content region or its structure region is more important in determining the window’s ultimate size and position. This distinction can be important with versions of the Mac OS running the Appearance Manager, since the total dimensions of a window—and, therefore, its spatial relationship to the rest of the screen—may vary from appearance to appearance. In general, you should specify kWindowStructureRgn for the regionCode parameter if how the window as a whole relates to a given monitor is more important than the exact positioning of its content on the screen. On the other hand, if you specify kWindowContentRgn for the regionCode parameter because the positioning of your application’s content is of greatest concern, then it is important to note that with some appearances some part of the window’s structure region or “frame” may extend past the edge of a monitor and not be displayed.
See also the function GetWindowBounds.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
See Also
Declared In
MacWindows.hSetWindowCancelButton
Specifies a Cancel button for a window.
OSStatus SetWindowCancelButton ( WindowRef inWindow, ControlRef inControl );
Parameters
- inWindow
The window whose Cancel button you want to set.
- inControl
The control to designate as the Cancel button.
Return Value
A result code.
Discussion
You can use this function to specify a control (normally a button) to be the Cancel button for a given window. This button would be considered to have been clicked if the user instead presses Command-period or the Escape key.
The standard window event handler looks for keystrokes that correspond to the cancel button and generates events of type kEventControlHit when it detects the correct key being pressed. This is similar to the way the Dialog Manager responds to cancel buttons, except that instead of returning an item index for which button is pressed, the Carbon Event Manager generates a control hit event.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hSetWindowContentColor
Sets the color to which a window’s content region is redrawn.
OSStatus SetWindowContentColor ( WindowRef window, const RGBColor *color );
Parameters
- window
The window whose content color is to be set.
- color
Set this structure to specify the content color to be used.
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
If your application uses the SetWindowContentColor function, the window’s content region is redrawn to the color you specify, without affecting the value specified in the window’s CGrafPort structure for the current background color.
See also the function GetWindowContentColor.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hSetWindowContentPattern
Sets the pattern to which a window’s content region is redrawn.
OSStatus SetWindowContentPattern ( WindowRef window, PixPatHandle pixPat );
Parameters
- window
A pointer to the window whose content pattern is being set.
- pixPat
Set this structure to specify the content pattern to be used. This handle is copied by the Window Manager, and your application continues to own the original. Therefore there may be higher RAM requirements for applications with numerous identically patterned windows.
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
If your application uses the SetWindowContentPattern function, the window’s content region is redrawn to the pattern you specify, without affecting the value specified in the window’s CGrafPort structure for the current background pattern.
See also the function GetWindowContentPattern.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hSetWindowDefaultButton
Specifies a default button for a window.
OSStatus SetWindowDefaultButton ( WindowRef inWindow, ControlRef inControl );
Parameters
- inWindow
The window whose default button you want to set.
- inControl
The control to designate as the default.
Return Value
A result code.
Discussion
You can use this function to specify a control (normally a button) to be the default for a given window. This button would be considered to have been clicked if the user instead presses the Return or Enter keys on the keyboard.
The standard window event handler looks for keystrokes that correspond to the default button and generates events of type kEventControlHit when it detects the correct key being pressed. This is similar to the way the Dialog Manager responds to default buttons, except that instead of returning an item index for which button is pressed, the Carbon Event Manager generates a control hit event.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hSetWindowDockTileMenu
Associates a pop-up menu with a window.
OSStatus SetWindowDockTileMenu ( WindowRef inWindow, MenuRef inMenu );
Parameters
- inWindow
The window with which a pop-up menu is to be associated.
- inMenu
The pop-up menu that is to be associated with the window specified by
inWindow
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
You specify a dock tile menu if you want to be able to present special selections when the user activates the pop-up menu associated with the window’s minimized dock tile.
Availability
- Available in OS X v10.2 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hSetWindowGroup
Assigns a window to a window group.
OSStatus SetWindowGroup ( WindowRef inWindow, WindowGroupRef inNewGroup );
Parameters
- inWindow
The window that is to be assigned to a window group.
- inNewGroup
The window group. For information on this data type, see
WindowGroupRef.
Return Value
A result code. See “Window Manager Result Codes.”
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hSetWindowGroupLevel
Sets the level of group in the window class hierarchy.
OSStatus SetWindowGroupLevel ( WindowGroupRef inGroup, SInt32 inLevel );
Parameters
- inGroup
The window group.
- inLevel
The new level for the windows in this group.
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
The window group’s level is only used to set the level of its windows if the window group is a child of the root group. If there is another group in the group hierarchy between this group and the root group, this group’s level is ignored.
In Mac OS X v10.4 and later, SetWindowGroupLevel sets all three window levels associated with a window group: active, inactive, and promoted. It then immediately determines if the active level needs to be promoted to a larger value, and if so, sets the promoted level to that value.
See the Core Graphics frameworks header CGWindowLevel.h for a listing of window levels.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hSetWindowGroupLevelOfType
Sets the window level of a window group.
OSStatus SetWindowGroupLevelOfType ( WindowGroupRef inGroup, UInt32 inLevelType, CGWindowLevel inLevel );
Parameters
- inGroup
The window group whose Core Graphics window level is to be set.
- inLevelType
The level type to set. Specify
kWindowGroupLevelActiveorkWindowGroupLevelInactive. For details, see “Window Group Level Constants.”- inLevel
The new level that is to be set for the windows in this group.
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
In Mac OS X v10.4 and later, multiple window levels may be associated with a window group: one level for when the application is active and another for when the application is inactive. The Window Manager automatically switches each group’s level as the application becomes active or inactive. Call SetWindowGroupLevelOfType to set the active and inactive window level for a window group. The window group’s level is only used to set the level of its windows if the window group is a child of the root group. If there is another group in the group hierarchy between this group and the root group, this group’s level is ignored.
You can also use SetWindowGroupLevelOfType to set the promoted window level that is actually used for windows in the group. Doing so is not recommended, however, because the promoted window level is reset by the Window Manager whenever the window group hierarchy structure changes. Any changes that you make to the promoted level may, therefore, be overwritten. In general, you should only use SetWindowGroupLevelOfType to set the active and inactive window levels. When setting the active level of a group with the fixed-level window group attribute, this function also automatically sets the promoted level to the same value and updates the promoted level of any non-fixed-level groups above the group being modified.
Availability
- Available in OS X v10.4 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hSetWindowGroupName
Assigns a name to a window group.
OSStatus SetWindowGroupName ( WindowGroupRef inGroup, CFStringRef inName );
Parameters
- inGroup
The window group. For information on this data type, see
WindowGroupRef.- inName
Return Value
A result code. See “Window Manager Result Codes.”
Carbon Porting Notes
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hSetWindowGroupOwner
Sets a window as the owner of a window group.
OSStatus SetWindowGroupOwner ( WindowGroupRef inGroup, WindowRef inWindow );
Parameters
- inGroup
The window group that is to be set as the owner of the window group specified by
inWindow.- inWindow
The window group whose owner is to be set.
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
This function is rarely needed and is known to be problematic, so calling this function is not recommended.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hSetWindowGroupParent
Sets a window group to be the parent of another window group.
OSStatus SetWindowGroupParent ( WindowGroupRef inGroup, WindowGroupRef inNewGroup );
Parameters
- inGroup
The window group whose parent window group is to be set. The specified window group cannot contain any windows at the time of this call.
- inNewGroup
The window group that is to be the parent of
inGroup. For information on this data type, seeWindowGroupRef.
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
You can nest groups within each other using this function.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hSetWindowIdealUserState
Sets the size and position of a window in its user state.
OSStatus SetWindowIdealUserState ( WindowRef inWindow, const Rect *inUserState );
Parameters
- inWindow
The window whose size and position in its user state is to be set.
- inUserState
Set this rectangle to specify the new size and position of the window’s user state, in global coordinates.
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
Because the window definition function relies upon the WStateData structure, it is unaware of the ideal standard state, and this causes the user state data that it stores in the WStateData structure to be unreliable. While the Window Manager is reliably aware of the window’s zoom state, it cannot record the current user state in the WStateData structure, because the window definition function can overwrite that data. Therefore, the function SetWindowIdealUserState maintains the window’s user state independently of the WStateData structure. The SetWindowIdealUserState function gives your application access to the user state data maintained by ZoomWindowIdeal. However, your application does not typically need to use this function; it is supplied for completeness.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
See Also
Declared In
MacWindows.hSetWindowKind
Sets a window’s window kind.
void SetWindowKind ( WindowRef window, short kind );
Parameters
- window
The window whose window kind is to be set.
- kind
An integer representing the window kind.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hSetWindowModality
Sets the modality of a window.
OSStatus SetWindowModality ( WindowRef inWindow, WindowModality inModalKind, WindowRef inUnavailableWindow );
Parameters
- inWindow
The window whose modality to set.
- inModalKind
The new modality for the window. See “Window Modality Options” for a list of possible options.
- inUnavailableWindow
If the window is becoming document-modal, this parameter specifies the window to which the
inWindowparameter is modal. The window specified by this parameter will not be available whileinWindowis in window-modal state.
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
The modality of a window is used by the Carbon event manager to automatically determine appropriate event handling.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hSetWindowModified
Sets the modification state of the specified window.
OSStatus SetWindowModified ( WindowRef window, Boolean modified );
Parameters
- window
The window whose modification state is to be set.
- modified
Pass
trueif the content of the window has been modified; otherwise, passfalse.
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
Your application can use the functions SetWindowModified and IsWindowModified instead of maintaining its own separate record of the modification state of the content of a window. The modification state of a window is visually represented by a dot in the window’s close box. If the dot is present, the window is modified; if the dot is absent, the window is not modified.
Your application should distinguish between the modification state of the window and the modification state of the window’s contents, typically a document. The modification state of the window contents are what should affect SetWindowModified. For example, in the case of a word processing document, you call SetWindowModified (passing true in the modified parameter) whenever the user types new characters into the document. However, you do not call SetWindowModified when the user moves the window, because that change does not affect the document contents. If you need to track whether the window position has changed, you need to do this with your own flag.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hSetWindowProperty
Associates an arbitrary piece of data with a window.
OSStatus SetWindowProperty ( WindowRef window, PropertyCreator propertyCreator, PropertyTag propertyTag, ByteCount propertySize, const void *propertyBuffer );
Parameters
- window
The window with which data is to be associated.
- propertyCreator
The creator code (typically, the application’s signature) of the data to be associated.
- propertyTag
A value identifying the data to be associated. You define the tag your application uses to identify the data; this code is not to be confused with the file type for the data.
- propertySize
The size of the data to be associated.
- propertyBuffer
A pointer to the data to be associated.
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
Data set with the SetWindowProperty function may be obtained with the function GetWindowProperty and removed with the function RemoveWindowProperty.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hSetWindowProxyAlias
Associates a file with a window.
OSStatus SetWindowProxyAlias ( WindowRef inWindow, AliasHandle inAlias );
Parameters
- inWindow
The window with which the specified file is to be associated.
- inAlias
A handle to a structure of type
AliasRecordfor the file to associate with the specified window. You can obtain an alias handle by calling the functionGetWindowProxyAlias. The Window Manager copies the alias data, so you can dispose of the alias afterSetWindowProxyAliasreturns.
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
Your application should call the SetWindowProxyAlias function to establish a proxy icon for a given window. The creator code and file type of the file associated with a window determine the proxy icon that is displayed for the window.
Because the SetWindowProxyAlias function won’t work without a saved file, you must establish the initial proxy icon for a new, untitled window with the function SetWindowProxyCreatorAndType, which requires that you know the file type and creator code for the file, but does not require that the file have been saved.
Special Considerations
On Mac OS 8.x and Mac OS 9.x, you must save and restore the current graphics port—by calling the QuickDraw functions GetPort and SetPort—around each call to the SetWindowProxyAlias function.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hSetWindowProxyCreatorAndType
Sets the proxy icon for a window that lacks an associated file.
OSStatus SetWindowProxyCreatorAndType ( WindowRef window, OSType fileCreator, OSType fileType, SInt16 vRefNum );
Parameters
- window
The window for which you want to set the proxy icon.
- fileCreator
A code that is to be used, together with the
fileTypeparameter, to determine the proxy icon. This typically is the creator code of the file that would be created, were the user to save the contents of the window.- fileType
A code that is to be used, together with the
fileCreatorparameter, to determine the proxy icon. This typically is the file type of the file that would be created, were the user to save the contents of the window.- vRefNum
A value identifying the volume containing the default desktop database to search for the icon associated with the file type and creator code specified in the
fileCreatorandfileTypeparameters. PasskOnSystemDiskif the volume is unknown.
Return Value
A result code. See “Window Manager Result Codes.”
Special Considerations
On Mac OS 8.x and Mac OS 9.x, you must save and restore the current graphics port—by calling the QuickDraw functions GetPort and SetPort—around each call to the SetWindowProxyCreatorAndType function.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hSetWindowProxyIcon
Overrides the default proxy icon for a window.
OSStatus SetWindowProxyIcon ( WindowRef window, IconRef icon );
Parameters
- window
The window for which you want to set the proxy icon.
- icon
An icon reference identifying the icon to be used for the window’s proxy icon. If there is already a proxy icon in use of the type desired, an
IconRefvalue may be obtained for that icon by calling the functionGetWindowProxyIcon. Otherwise, your application must call the Icon Services functionGetIconRefFromFileto get a value of typeIconRef. The Window Manager retains theIconRef, so you can releaseiconafterSetWindowProxyIconreturns. See the Icon Services and Utilities documentation for a description of theIconRefdata type.
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
If you want to override the proxy icon that the Window Manager displays by default for a given file, your application should call the SetWindowProxyIcon function.
More typically, when you do not want to override a window’s default proxy icon, your application would call one of the following functions: HIWindowSetProxyFSRef, SetWindowProxyAlias, or SetWindowProxyCreatorAndType.
On Mac OS 8.x and Mac OS 9.x, you must save and restore the current graphics port—by calling the QuickDraw functions GetPort and SetPort—around each call to the SetWindowProxyIcon function.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hSetWindowResizeLimits
Sets the maximum and minimum resize limits for windows.
OSStatus SetWindowResizeLimits ( WindowRef inWindow, const HISize *inMinLimits, const HISize *inMaxLimits );
Parameters
- inWindow
The window whose maximum and minimum resize limits are to be set.
- inMinLimits
The minimum limits. Pass
NULLif you don’t want to set this limit. For information on theHISizedata type, see HIGeometry.h.- inMaxLimits
The maximum limits. Pass
NULLif you don’t want to set this limit. For information on theHISizedata type, see HIGeometry.h.
Return Value
A result code. See “Window Manager Result Codes.”
Availability
- Available in OS X v10.2 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hSetWindowStandardState
Sets a window’s standard zoom rectangle.
void SetWindowStandardState ( WindowRef window, const Rect *rect );
Parameters
- window
The window whose standard zoom rectangle is to be set.
- rect
On input, a rectangle (in global coordinates) representing the window’s standard zoom rectangle. A window’s standard zoom rectangle is the window content bounds when the window is zoomed out to its largest extent.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hSetWindowTitleWithCFString
Sets the window title to the contents of a Core Foundation string.
OSStatus SetWindowTitleWithCFString ( WindowRef inWindow, CFStringRef inString );
Parameters
- inWindow
The window whose title is to be set.
- inString
The title to set.
Return Value
A result code. See “Window Manager Result Codes.”
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hSetWindowToolbar
Associates a toolbar with a window.
OSStatus SetWindowToolbar ( WindowRef inWindow, HIToolbarRef inToolbar );
Parameters
- inWindow
The window with which the toolbar specified by
inToolbaris to be associated.- inToolbar
The toolbar that is to be associated with the window specified by
inWindow.
Return Value
A result code. See “Window Manager Result Codes.”
Availability
- Available in OS X v10.2 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hSetWindowUserState
Sets a window’s user zoom rectangle.
void SetWindowUserState ( WindowRef window, const Rect *rect );
Parameters
- window
The window whose user zoom rectangle is to be set.
- rect
On input, a pointer to a rectangle (in global coordinates) representing the user zoom rectangle that is to be set. The window’s user zoom rectangle is the window content bounds when the window is zoomed back in.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hSetWRefCon
Sets the refCon field of a window.
void SetWRefCon ( WindowRef window, SRefCon data );
Parameters
- window
The window whose
refConfield is to be set.- data
On input, the data to be placed in the
refConfield.
Discussion
The SetWRefCon function places the specified data in the refCon field of the specified window structure. The refCon field is available to your application for any window-related data it needs to store.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hShowFloatingWindows
Shows an application’s floating windows.
OSStatus ShowFloatingWindows ( void );
Return Value
A result code. For details, see “Window Manager Result Codes.”
Discussion
When an application receives a suspend event, its floating windows are hidden automatically. When the application receives a resume event, the floating windows are made visible automatically. Call this function if you want to make your floating windows visible manually.
See also the function HideFloatingWindows.
Special Considerations
The ShowFloatingWindows function operates only upon windows created with the kFloatingWindowClass constant; see “Window Class Constants” for more details on this constant.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hShowHide
Sets a window’s visibility.
void ShowHide ( WindowRef window, Boolean showFlag );
Parameters
- window
On input, a pointer to the window structure.
- showFlag
On input, a Boolean value that specifies its visibility:
truemakes a window visible;falsemakes it invisible.
Discussion
The ShowHide function sets a window’s visibility to the status specified by the showFlag parameter. If the value of showFlag is true, ShowHide makes the window visible if it’s not already visible and has no effect if it’s already visible. If the value of showFlag is false, ShowHide makes the window invisible if it’s not already invisible and has no effect if it’s already invisible.
The ShowHide function never changes the highlighting or front-to-back ordering of windows and generates no activate events.
Use ShowHide only where you need to manually control window activation. Otherwise, use ShowWindow or HideWindow instead.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hShowHideWindowToolbar
Shows or hides the toolbar.
OSStatus ShowHideWindowToolbar ( WindowRef inWindow, Boolean inShow, Boolean inAnimate );
Parameters
- inWindow
The window whose toolbar is to be shown or hidden.
- inShow
Pass
trueto show the toolbar,falseotherwise.- inAnimate
Pass
trueto animate the transition, passfalsefor no animation.
Return Value
A result code. See “Window Manager Result Codes.”
Availability
- Available in OS X v10.2 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hShowSheetWindow
Shows a sheet window using appropriate visual effects.
OSStatus ShowSheetWindow ( WindowRef inSheet, WindowRef inParentWindow );
Parameters
- inSheet
The window sheet that is to be shown.
- inParentWindow
The parent of the window specified by
inSheet.
Return Value
A result code. See “Window Manager Result Codes.”
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hShowWindow
Makes an invisible window visible.
void ShowWindow ( WindowRef window );
Parameters
- window
The window that is to be made visible.
Discussion
The ShowWindow function makes an invisible window visible. If the specified window is already visible, ShowWindow has no effect. Your application typically creates a new window in an invisible state, performs any necessary setup of the content region, and then calls ShowWindow to make the window visible.
When you call ShowWindow to display a window that is invisible, the Window Manager draws the window frame and sends an event to request the application to draw the content region before the window becomes visible. For compositing windows, the Window Manager sends a kEventControlDraw event to each HIView in the window. For non-compositing windows, the Window Manager sends a kEventWindowDrawContent event. If a non-compositing window does not handle the kEventWindowDrawContent, the Window Manager shows the window and generates an update event to request your application to draw the content region.
If the newly visible window is the frontmost window, ShowWindow highlights it if it’s not already highlighted and generates an activate event to make it active. The ShowWindow function does not activate a window that is not frontmost on the desktop.
Because ShowWindow does not change the front-to-back ordering of windows, it is not the inverse of HideWindow. If you make the frontmost window invisible with HideWindow, andHideWindow has activated another window, you must call both ShowWindow and SelectWindow to bring the original window back to the front.
Availability
- Available in Mac OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hSizeWindow
Sets the size of a window.
void SizeWindow ( WindowRef window, short w, short h, Boolean fUpdate );
Parameters
- window
The window whose size is to be set.
- w
On input, the new window width, in pixels.
- h
On input, the new window height, in pixels.
- fUpdate
On input, a Boolean value that specifies whether any newly created area of the content region is to be accumulated into the update region (
true) or not (false). You ordinarily pass a value oftrueto ensure that the area is updated. If you passfalse, you’re responsible for maintaining the update region yourself. For a composited window, this parameter is ignored, and any views that intersect the newly exposed area of the window are automatically invalidated. For more information on adding rectangles to and removing rectangles from the update region, seeInvalWindowRectandValidWindowRect.
Discussion
The SizeWindow function changes the size of the window’s graphics port rectangle to the dimensions specified by the w and h parameters, or does nothing if the values of w and h are both 0. The Window Manager redraws the window in the new size, recentering the title and truncating it if necessary.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hToggleDrawer
Toggles the drawer state.
OSStatus ToggleDrawer ( WindowRef inDrawerWindow );
Parameters
- inDrawerWindow
The drawer window whose drawer state is to be toggled.
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
If the drawer is currently open or opening, this function closes the drawer. If the drawer is currently closed or closing, this function opens the drawer.
Availability
- Available in OS X v10.2 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hTrackBox
Tracks clicks in the collapse, close, size, and zoom boxes, and clicks of the toolbar button.
Boolean TrackBox ( WindowRef window, Point thePt, WindowPartCode partCode );
Parameters
- window
The window in which the mouse button was pressed.
- thePt
On input, the location of the cursor when the mouse button was pressed. Your application receives this point from the
wherefield in the event structure.- partCode
On input, the part code (
inZoomIn,inZoomOut,inGoAway,inGrow,inCollapseBox, orinToolbarButton) returned byFindWindow; see “Part Identifier Constants.”
Return Value
A Boolean whose value is true if the specified part was clicked; otherwise, false. If TrackBox returns true, it also removes highlighting from the specified part.
Discussion
The TrackBox function tracks the cursor when the user presses the mouse button while the cursor is in the specified part, retaining control until the mouse button is released. While the button is down, TrackBox highlights the part while the cursor is in the part’s region.
When the mouse button is released, TrackBox removes the highlighting from the part and returns true if the cursor is within the part’s region and false if it is not.
If TrackBox returns true after tracking the close box, your application should close the window. If TrackBox returns true after tracking the grow box, your application should call ResizeWindow. If TrackBox returns true after tracking the collapse box, your application should call CollapseWindow. When tracking the toolbar button, your application should call ShowHideWindowToolbar.
Your application calls the TrackBox function when it receives a result code of inZoomIn or inZoomOut from the function FindWindow. If TrackBox returns true, your application calculates the standard state, if necessary, and calls the function ZoomWindow to zoom the window. If TrackBox returns false, your application does nothing.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hTrackGoAway
Tracks the cursor when the user presses the mouse button while the cursor is in the close box.
Boolean TrackGoAway ( WindowRef window, Point thePt );
Parameters
- window
On input, the window in which the mouse-down event occurred.
- thePt
On input, the location of the cursor at the time the mouse button was pressed. Your application receives this point from the
wherefield of the event structure.
Return Value
When the mouse button is released, TrackGoAway removes the highlighting from the close box and returns true if the cursor is within the close region and false if it is not.
Discussion
The TrackGoAway function tracks cursor activity when the user presses the mouse button while the cursor is in the close box, retaining control until the user releases the mouse button. While the button is down, TrackGoAway highlights the close box as long as the cursor is in the close region.
Your application calls the TrackGoAway function when it receives a result code of inGoAway from FindWindow. If TrackGoAway returns true, your application calls its own function for closing a window, which can call DisposeWindow to remove the window from the screen. If TrackGoAway returns false, your application does nothing.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hTrackWindowProxyDrag
Handles all aspects of the drag process when the user drags a proxy icon.
OSStatus TrackWindowProxyDrag ( WindowRef window, Point startPt );
Parameters
- window
The window whose proxy icon is being dragged.
- startPt
Set the
Pointstructure to contain the point, specified in global coordinates, where the mouse-down event that began the drag occurred. Your application may retrieve this value from thewherefield of theeventstructure.
Return Value
A result code. See “Window Manager Result Codes.” If you receive the error errUserWantsToDragWindow (–5607), your application should respond by calling the Window Manager function DragWindow. Errors are also returned from the Drag Manager, including userCanceledErr (–128).
Discussion
If your application uses proxy icons to represent a type of object (currently, file system entities such as files, folders, and volumes) supported by the Window Manager, your application should call the TrackWindowProxyDrag function, and the Window Manager can handle all aspects of the drag process for you. If your application calls the TrackWindowProxyDrag function, it does not have to call the Drag Manager function WaitMouseMoved before starting to track the drag, as the Window Manager handles this automatically. However, if a proxy icon represents a type of data that the Window Manager does not support, or if you want to implement custom dragging behavior, your application should call the function TrackWindowProxyFromExistingDrag.
Your application detects that a user is dragging one of its proxy icons when the function FindWindow returns the inProxyIcon result code; see “Window Part Code Constants” for more details.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
See Also
Declared In
MacWindows.hTrackWindowProxyFromExistingDrag
Allows custom handling of the drag process when the user drags a proxy icon.
OSStatus TrackWindowProxyFromExistingDrag ( WindowRef window, Point startPt, DragRef drag, RgnHandle inDragOutlineRgn );
Parameters
- window
The window whose proxy icon is being dragged.
- startPt
Set the
Pointstructure to contain the point, specified in global coordinates, where the mouse-down event that began the drag occurred. Your application may retrieve this value from thewherefield of theeventstructure.- drag
A value that refers to the current drag process. Pass in the value produced in the
outNewDragparameter of the functionBeginWindowProxyDrag. If you are not usingBeginWindowProxyDragin conjunction withTrackWindowProxyFromExistingDrag, you must create the drag reference yourself with the Drag Manager functionNewDrag.- inDragOutlineRgn
A region handle representing an outline of the icon being dragged. You may obtain a handle to this region from the
outDragOutlineRgnparameter ofBeginWindowProxyDrag. If you are not usingBeginWindowProxyDragin conjunction withTrackWindowProxyFromExistingDrag, you must create the region yourself.
Return Value
A result code. See “Window Manager Result Codes.” Errors are also returned from the Drag Manager, including userCanceledErr (-128).
Discussion
Typically, if the proxy icon represents a type of object (currently, file system entities such as files, folders, and volumes) supported by the Window Manager, the Window Manager can handle all aspects of the drag process itself, and your application should call the function TrackWindowProxyDrag. However, if the proxy icon represents a type of data that the Window Manager does not support, or if you want to implement custom dragging behavior, your application should call the TrackWindowProxyFromExistingDrag function.
The TrackWindowProxyFromExistingDrag function accepts an existing drag reference and adds file data if the window contains a file proxy. If your application uses TrackWindowProxyFromExistingDrag, you then have the choice of using this function in conjunction with the functions BeginWindowProxyDrag and EndWindowProxyDrag or simply calling TrackWindowProxyFromExistingDrag and handling all aspects of creating and disposing of the drag yourself.
Your application detects a drag when the function FindWindow returns the inProxyIcon result code; see “Window Part Code Constants” for more details.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
See Also
Declared In
MacWindows.hTransitionWindow
Shows, hides, moves, or resizes a window with appropriate animation and sound.
OSStatus TransitionWindow ( WindowRef inWindow, WindowTransitionEffect inEffect, WindowTransitionAction inAction, const Rect *inRect );
Parameters
- inWindow
The window on which to act.
- inEffect
The type of visual effect to use.
TransitionWindowsupports the Zoom, Slide, Fade, and Genie transition effects. The Slide effect is supported in Mac OS X and in CarbonLib 1.5 and later. The Fade and Genie effects are supported in Mac OS X v10.3 and later. See “Window Transition Effect Constants” for constants and descriptions of these effects.- inAction
The action to take.
TransitionWindowsupports the Show, Hide, Move, and Resize actions. The Move and Resize actions are supported in Mac OS X and in CarbonLib 1.5 and later. See “Window Transition Action Constants” for possible values.- inRect
A screen rect in global coordinates, or
NULLfor some transition actions. The interpretation of the rect is dependent on the transition action. For details, see the documentation for each action.If you pass
kWindowShowTransitionActionin theactionparameter then, before callingTransitionWindow, set the rectangle to specify the dimensions and position, in global coordinates, of the area from which the zoom is to start. If you passNULL,TransitionWindowuses the center of the display screen as the source rectangle.If you pass
kWindowHideTransitionActionin theactionparameter then, before callingTransitionWindow, set the rectangle to specify the dimensions and position, in global coordinates, of the area at which the zoom is to end.If you pass
NULL,TransitionWindowuses the center of the display screen as the destination rectangle.
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
The TransitionWindow function displays an animation of a window’s transition between the open and closed states, such as that displayed by the Finder. TransitionWindow uses the rectangle specified in the rect parameter for one end of the animation (the source or the destination of the zoom, depending upon whether the window is being shown or hidden, respectively) and the window’s current size and position for the other end of the animation. TransitionWindow also plays sounds appropriate to the current theme for the opening and closing actions.
Your application may use TransitionWindow instead of the functions ShowWindow and HideWindow. Like these pre–Mac OS 8.5 Window Manager functions, TransitionWindow generates the appropriate update and active events when it shows and hides windows.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hTransitionWindowAndParent
Shows or hides a window, potentially also moving a second window, with animation and sound.
OSStatus TransitionWindowAndParent ( WindowRef inWindow, WindowRef inParentWindow, WindowTransitionEffect inEffect, WindowTransitionAction inAction, const Rect *inRect );
Parameters
- inWindow
The window that is to be shown or hidden.
- inParentWindow
The window to which inWindow is related. For the Sheet effect, this parameter must be a valid window reference; for other effects, this parameter should be
NULL.- inEffect
The type of visual effect to use. This function is most commonly used to perform the Sheet transition effect, but it also supports the Zoom, Slide, Fade, and Genie effects. See “Window Transition Effect Constants” for constants and descriptions of these effects.
- inAction
The action to take on the window. The Show, Hide, Move, and Resize actions are supported. See “Window Transition Action Constants” for the appropriate constants.
- inRect
A screen rect in global coordinates. The interpretation of the rect is dependent on the transition action; see the documentation for each action for details. May be
NULLfor some transition actions.
Return Value
A result code. See “Window Manager Result Codes.”
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hTransitionWindowWithOptions
Transitions a window from one state to another with appropriate animation and sound.
OSStatus TransitionWindowWithOptions ( WindowRef inWindow, WindowTransitionEffect inEffect, WindowTransitionAction inAction, const HIRect *inBounds, Boolean inAsync, TransitionWindowOptions *inOptions );
Parameters
- inWindow
The window to transition.
- inEffect
The type of visual effect to use. For possible values, see “Window Transition Effect Constants” for a description of this value.
- inAction
The action to take. For possible values, see “Window Transition Action Constants.”
- inBounds
A screen rect in global coordinates. The interpretation of the rect is dependent on the transition action; see “Window Transition Action Constants” for the details of each action. This parameter may be
NULLfor the Show and Hide actions for the Zoom and Sheet effects. This parameter is ignored and must beNULLfor the Show and Hide actions for the Fade effect.- inAsync
A Boolean whose value indicates whether the transition should run synchronously or asynchronously. If
inAsyncistrue, this function returns immediately, and the transition runs using an event loop timer. You must run your event loop for the transition to occur. IfinAsyncisfalse, this function blocks until the transition completes. In either case, thekEventWindowTransitionStartedandkEventWindowTransitionCompletedCarbon events are sent to the transitioning window at the start and end of the transition.- inOptions
Extra information that are required for some transitions. This parameter may be
NULLif the specified transition effect does not require extra information.
Return Value
A result code. See “Window Manager Result Codes.”
Availability
- Available in OS X v10.3 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hUpdateCollapsedWindowDockTile
Updates the image of a window in the dock to the current contents of the window.
OSStatus UpdateCollapsedWindowDockTile ( WindowRef inWindow );
Parameters
- inWindow
The window whose image is to be updated.
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
Use this function for periodic updates, not for animation purposes. If you want animation, use CreateQDContextForCollapsedWindowDockTile.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hValidWindowRect
Removes a rectangle from a window’s update region.
OSStatus ValidWindowRect ( WindowRef window, const Rect *bounds );
Parameters
- window
The window containing the rectangle you want to remove from the update region.
- bounds
Set this structure to specify, in local coordinates, a rectangle to be removed from the window’s update region.
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
The ValidWindowRect function informs the Window Manager that an area of a window no longer needs to be redrawn. The ValidWindowRect function is similar to the ValidRect function, but ValidWindowRect allows the window that it operates upon to be explicitly specified, instead of operating on the current graphics port, so ValidWindowRect does not require the graphics port to be set before its use.
See also the functions InvalWindowRect and ValidWindowRgn.
Special Considerations
This function should not be used on composited windows. Modifying a composited window's update region does not affect the area of the window to be drawn. A composited window does not use its window update region to control drawing. Instead, a composited window determines what to draw by looking at the invalid regions of the views contained in the window.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hValidWindowRgn
Removes a region from a window’s update region.
OSStatus ValidWindowRgn ( WindowRef window, RgnHandle region );
Parameters
- window
The window containing the region you want to remove from the update region.
- region
Set this region to specify, in local coordinates, the area to be removed from the window’s update region.
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
The ValidWindowRgn function informs the Window Manager that an area of a window no longer needs to be redrawn. The ValidWindowRgn function is similar to the ValidRgn function, but ValidWindowRgn allows the window that it operates upon to be explicitly specified, instead of operating on the current graphics port, so ValidWindowRgn does not require the graphics port to be set before its use.
See also the functions InvalWindowRgn and ValidWindowRect.
Special Considerations
This function should not be used on composited windows. Modifying a composited window's update region does not affect the area of the window to be drawn. A composited window does not use its window update region to control drawing. Instead, a composited window determines what to draw by looking at the invalid regions of the views contained in the window.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hWindowPathSelect
Displays a window path pop-up menu.
OSStatus WindowPathSelect ( WindowRef window, MenuRef menu, SInt32 *outMenuResult );
Parameters
- window
The window for which a window path pop-up menu is to be displayed.
- menu
The menu to be displayed for the specified window or
NULL. If you passNULLin this parameter, the Window Manager provides a default menu and sends a Reveal Object Apple event to the Finder if a menu item is selected. Note that in order to passNULL, a file must currently be associated with the window [callHIWindowSetProxyFSRefto associate a file with the window]. If you pass a menu, this menu supersedes the default window path pop-up menu. There does not have to be a file currently associated with the window if you pass in your own menu.- outMenuResult
A pointer to a value that, on return, contains the menu and menu item the user chose. The high-order word of the value produced contains the menu ID, and the low-order word contains the item number of the menu item. If the user does not select a menu item, 0 is produced in the high-order word, and the low-order word is undefined. For file menus that have not been overridden, 0 is always produced in this parameter. Pass
NULLin this parameter if you do not want this information.
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
Your application should call the WindowPathSelect function when it detects a Command-click in the title of a window, that is, when the IsWindowPathSelectClick or IsWindowPathSelectEvent function returns a value of true. Calling WindowPathSelect causes the Window Manager to display a window path pop-up menu for your window.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hZoomWindow
Zooms the window when the user has pressed and released the mouse button with the cursor in the zoom box.
void ZoomWindow ( WindowRef window, WindowPartCode partCode, Boolean front );
Parameters
- window
The window that is to be zoomed.
- partCode
On input, the part code (either
inZoomInorinZoomOut) returned by theFindWindowfunction; see “Part Identifier Constants.”- front
On return, a Boolean value that determines whether the window is to be brought to the front. If the value of
frontistrue, the window necessarily becomes the frontmost, active window. If the value offrontisfalse, the window’s position in the window list does not change. Note that if a window was active before it was zoomed, it remains active even if the value offrontisfalse.
Discussion
The ZoomWindow function zooms a window in or out, depending on the value of the partCode parameter. Your application calls ZoomWindow, passing it the part code returned by FindWindow, when it receives a result of true from TrackBox. The ZoomWindow function then changes the window’s port rectangle to either the user state (if the part code is inZoomIn) or the standard state (if the part code is inZoomOut), as stored in the window state structure, described in the section WStateData.
If the part code is inZoomOut, your application ordinarily calculates and sets the standard state before calling ZoomWindow.
For best results, call the QuickDraw function EraseRect, passing the window’s graphics port as the port rectangle, before calling ZoomWindow.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hZoomWindowIdeal
Zooms a window in accordance with human interface guidelines.
OSStatus ZoomWindowIdeal ( WindowRef inWindow, WindowPartCode inPartCode, Point *ioIdealSize );
Parameters
- inWindow
The window that is to be zoomed.
- inPartCode
A value specifying the direction of the zoom being requested. Your application passes in the relevant value (either the
inZoomInor theinZoomOutconstant).- ioIdealSize
When you specify
inZoomInin thepartCodeparameter, you pass a pointer to thePointstructure, but do not fill the structure with data. On return, thePointstructure contains the new height and width of the window’s content region, andZoomWindowIdealrestores the previous user state.When you specify
inZoomOutin thepartCodeparameter, you pass the ideal height and width of the window’s content region in thePointstructure. On return, thePointstructure contains the new height and width of the window’s content region.ZoomWindowIdealsaves the user state of the window and zooms the window to its ideal size for the standard state.
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
Applications should use the ZoomWindowIdeal function instead of the older function ZoomWindow. When your application calls ZoomWindowIdeal, it automatically conforms to the human interface guidelines for determining a window’s standard state.
The ZoomWindowIdeal function calculates a window’s ideal standard state and updates a window’s ideal user state independently of the WStateData structure. Previously, the window definition function was responsible for updating the user state, but because it relies upon the WStateData structure, the window definition function is unaware of the ideal standard state and can no longer track the window’s zoom state reliably.
While the Window Manager is reliably aware of the window’s zoom state, it cannot record the current user state in the WStateData structure, because the window definition function can overwrite that data. Therefore, if your application uses ZoomWindowIdeal, the WStateData structure is superseded, and the result of the FindWindow function should be ignored when determining whether a particular user click of the zoom box is a request to zoom in or out. When you adopt ZoomWindowIdeal and your application receives a result of either inZoomIn or inZoomOut from FindWindow, your application must use the function IsWindowInStandardState to determine the appropriate part code to pass in the partCode parameter.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hCallbacks
WindowDefProcPtr
Defines a pointer to a window definition callback function. Your window definition callback function determines how a window looks and behaves.
typedef long (*WindowDefProcPtr) ( short varCode, WindowRef window, short message, long param );
If you name your function MyWindowDefProc, you would declare it like this:
long MyWindowDefProc ( short varCode, WindowRef window, short message, long param );
Parameters
- varCode
The window’s variation code.
- window
A pointer to the window’s window structure.
- message
A value indicating the task to be performed. The
messageparameter contains one of the values defined in “Window Definition Message Constants.” Other messages are reserved for internal use by the system. The list in the discussion section that follows explains each of these tasks in detail.- param
Data associated with the task specified by the
messageparameter. If the task requires no data, this parameter is ignored.
Return Value
Your window definition function should perform whatever task is specified by the message parameter and return a function result, if appropriate. If the task performed requires no result code, return 0.
Discussion
Various Window Manager functions call a window definition function whenever they need to perform a window-dependent action, such as drawing the window on the screen. If you want to define new, nonstandard windows for your application, you must write a window definition function, compile it in your application, and either use RegisterWindowDefinition to register it with the system or call CreateCustomWindow to create the custom window directly.
Note that Carbon does not allow you to store custom window definitions in a 'WDEF' resource file as you could in pre-Carbon systems.
If you use RegisterWindowDefinition, the Window Manager calls the Resource Manager to access your window definition function with the given resource ID; see “Pre-Appearance Window Definition IDs” inWindow Manager Legacy Reference for a description of how window definition IDs are derived from resource IDs and variation codes.
The Resource Manager reads your window definition function into memory and returns a handle to it. The Window Manager stores this handle in the windowDefProc field of the window structure. Later, when it needs to perform an action on the window, the Window Manager calls the window definition function and passes it the variation code as a parameter.
Your window definition function is responsible for
drawing the window frame
reporting the region where mouse-down events occur
calculating the window’s structure region and content region
drawing the size box
resizing the window frame when the user drags the size box
reporting the window’s features or the location of a specific window region
performing any customized initialization or disposal tasks
The Window Manager defines the data type WindowDefUPP to identify the universal procedure pointer for this application-defined function:
typedef UniversalProcPtr WindowDefUPP; |
You typically use the NewWindowDefProc macro like this:
WindowDefUPP myWindowDefUPP; |
myWindowDefUPP = NewWindowDefProc(MyWindow); |
You typically use the CallWindowDefProc macro like this:
CallWindowDefProc (myWindowDefUPP, varCode, theWindow, message, param); |
The message parameter contains a value specifying the task to be performed by your window definition function. These tasks are:
Drawing the Window Frame
When the Window Manager passes
wDrawin themessageparameter, your window definition function should respond by drawing the window frame in the current graphics port (which is the Window Manager port). The window part code to be drawn will be passed in theparamparameter of your window definition function. Your window definition function should perform the following steps:Change the current port from the
WMgrPortto theWMgrCPortto allow the system to draw in the full range of RGB colors.Update the pen attributes, text attributes, and
bkPatfields in theWMgrCPortto the values of the corresponding fields in theWMgrPort. The Window Manager automatically transfers thevisandclipregions.
The parallelism of the
WMgrPortand theWMgrCPortis maintained only by the window definition functions. All window definition functions that draw in theWMgrPortshould follow the steps listed above even if the changed fields do not affect their operation.You must make certain checks to determine exactly how to draw the frame. If the value of the
visiblefield in the window structure isfalse, you should do nothing; otherwise, you should examine theparamparameter and the status flags in the window structure:If the value of
paramis 0, draw the entire window frame (including the size box, if your window definition function incorporates the size box into the frame).If the value of
paramis 0 and thehilitedfield in the window structure istrue, highlight the frame to show that the window is active. If the value of thegoAwayFlagfield in the window structure is alsotrue, draw a close box in the window frame. If the value of thespareFlagfield in the window structure is alsotrue, draw a zoom box in the window frame.If the value of the
paramparameter iswInGoAway, redraw the window’s close box, with or without highlighting as appropriate.If the value of the
paramparameter iswInZoom, redraw the window’s zoom box, with or without highlighting as appropriate.If the value of the
paramparameter iswInCollapseBox, redraw the window’s collapse box, with or without highlighting as appropriate.
You can call
GetWindowWidgetHiliteto determine whether the close, zoom, or collapse box is currently highlighted. This function returns the part code of the currently highlighted part, or zero if no part is highlighted. You should draw the indicated part with highlighting, and draw other parts with no highlighting.The window frame typically, but not necessarily, includes the window’s title, which should be displayed in the system font and system font size. The Window Manager port is already set to use the system font and system font size.
Nothing drawn outside the window’s structure region will be visible.
Your window definition function should return 0 as the function result for this message.
Reporting the Region of a Mouse-Down Event
When the Window Manager passes
wHitin themessageparameter, your window definition function should respond by reporting the region of the specified mouse-down event. The mouse location (in global coordinates) of the window frame will be passed into theparamparameter of your window definition function. The vertical coordinate is in the high-order word of the parameter, and the horizontal coordinate is in the low-order word.In response to the
wHitmessage, your window definition function should return one of the constants defined in “Window Definition Hit Test Result Code Constants.”In Mac OS 9, return the constants
wInGrow,wInGoAway,wInZoomIn,wInZoomOut, andwInCollapseBoxonly if the window is active—by convention, the size box, close box, zoom box, and collapse box aren’t drawn if the window is inactive. In an inactive document window, for example, a mouse-down event in the part of the title bar that would contain the close box if the window were active is reported aswInDrag. In Mac OS X, your WDEF can return these part codes for inactive windows because these boxes are drawn even if the window is inactive.Calculating Regions
When the Window Manager passes
wCalcRgnsin themessageparameter, your window definition function should respond by calculating the window’s structure and content regions based on the current graphics port’s port rectangle. These regions, whose handles are in thestrucRgnandcontRgnfields of the window structure, are in global coordinates. The Window Manager requests this operation only if the window is visible. The mouse location (in global coordinates) of the window frame will be passed into theparamparameter of your window definition function.Your window definition function should call
IsWindowCollapsedto determine its collapse state. Then your window definition function can modify its structure and content regions as appropriate. Typically, a window’s content region is empty in a collapsed state.When you calculate regions for your own type of window, do not alter the clip region or the visible region of the Window Manager port. The Window Manager and QuickDraw take care of this for you. Altering the Window Manager port’s clip region or visible region may damage other windows.
Your window definition function should return 0 as the function result for this message.
Performing Additional Window Initialization
When the Window Manager passes
wNewin themessageparameter, your window definition function should respond by performing any initialization that it may require. If the content region has an unusual shape, for example, you might allocate memory for the region and store the region handle in thedataHandlefield of the window structure. The initialization function for a standard document window creates thewStateDatastructure for storing zooming data.Your window definition function should ignore the
paramparameter and return 0 as the function result for this message.Performing Additional Window Disposal Actions
When the Window Manager passes
wDisposein themessageparameter, your window definition function should respond by performing any additional tasks necessary for disposing of a window. You might, for example, release memory that was allocated by the initialization function. The dispose function for a standard document window disposes of thewStateDatastructure.Your window definition function should ignore the
paramparameter and return 0 as the function result for this message.Drawing the Window’s Grow Image
When the Window Manager passes
wGrowin themessageparameter, your window definition function should respond to being resized by drawing a dotted outline of the window in the current graphics port in the pen pattern and mode. (The pen pattern and mode are set up—asgrayandnotPatXor—to conform to Appearance-compliant human interface guidelines.)A rectangle (in global coordinates) whose upper-left corner is aligned with the port rectangle of the window’s graphics port is passed into the
paramparameter of your window definition function. Your grow image should be sized appropriately for the specified rectangle. As the user drags the mouse, the Window Manager sends repeatedwGrowmessages, so that you can change your grow image to match the changing mouse location.Your window definition function should return 0 as the function result for this message.
Drawing the Size Box
When the Window Manager passes
wDrawGIconin themessageparameter, your window definition function should respond by drawing the size box in the content region if the window is active. If the window is inactive, your window definition function should draw whatever is appropriate to show that the window cannot currently be sized. Your window definition function may also draw scroll bar delimiter lines. Your window definition function should ignore theparamparameter.If the size box is located in the window frame, draw the size box in response to a
wDrawmessage, not awDrawGIconmessage.Your window definition function should return 0 as the function result for this message.
Reporting Window Features
When the Window Manager passes
kWindowMsgGetFeaturesin themessageparameter, your window definition function should respond by setting theparamparameter to reflect the features that your window supports. The value passed back in theparamparameter should be comprised of one or more of the values defined in “Window Feature Bits.”Your window definition function should return 1 as the function result for this message.
Returning the Location of Window Regions
When the Window Manager passes
kWindowMsgGetRegionin themessageparameter, your window definition function should respond by returning the location (in global coordinates) of the specified window region. A pointer to a window region structure will be passed in theparamparameter.The window region structure is a structure of type
GetWindowRegionRec. Your window definition function should return an operating system status (OSStatus) message as the function result for this message. The result codeerrWindowRegionCodeInvalidindicates that the window region passed in was not valid.Application-defined window definition functions are changed with Appearance Manager 1.0 to support collapse boxes and feature reporting.
Availability
- Available in OS X v10.0 and later.
- Not available to 64-bit applications.
Declared In
MacWindows.hWindowPaintProcPtr
Defines a pointer to a custom content region painting function.
typedef OSStatus (*WindowPaintProcPtr) ( GDHandle device, GrafPtr qdContext, WindowRef window, RgnHandle inClientPaintRgn, RgnHandle outSystemPaintRgn, void * refCon );
If you name your function MyWindowPaintProc, you would declare it like this:
OSStatus MyWindowPaintProc ( GDHandle device, GrafPtr qdContext, WindowRef window, RgnHandle inClientPaintRgn, RgnHandle outSystemPaintRgn, void * refCon );
Parameters
- device
The current graphics device (
GDevice).- qdContext
The graphics port to draw into. Note that you should draw into this port, not the one associated with the window; the painting region
inClientPaintRgnis defined relative to this port. The port may be an offscreen graphics world.- window
The window to paint in.
- inClientPaintRgn
The region to be painted. Treat as a const. This region is clipped to the intersection of the current graphics device and the
clobberedRgnparameter passed toPaintBehind.- outSystemPaintRgn
The region for the system to paint. Initially empty. If your paint procedure sets this region before returning, the Window Manager will erase this region using the system’s window content paint function.
- refCon
Application-defined data that you passed to
InstallWindowContentPaintProc.
Return Value
A result code. See “Window Manager Result Codes.”
Discussion
Each window in the system contains a reference to a content paint proc. This proc is called to erase the window’s content region during PaintBehind or PaintOne operations. The client application can override the system paint proc by calling InstallWindowContentPaintProc. A window may only have one paint proc installed at any one time, and the paint proc cannot be retrieved by the client application.
If your content region painting callback returns any value other than noErr, outSystemPaintRgn is ignored and the entire area of inClientPaintRgn is painted using the system paint proc.
When a previously obscured portion of a window is exposed, the window manager will iterate over active displays and call the window’s content paint proc once for each device intersecting the region.
Availability
- Available in OS X v10.0 and later.
Declared In
MacWindows.hData Types
BasicWindowDescription
Describes basic window characteristics for use in a collection item.
struct BasicWindowDescription {
UInt32 descriptionSize
Rect windowContentRect
Rect windowZoomRect
UInt32 windowRefCon
UInt32 windowStateFlags
WindowPositionMethod windowPositionMethod
UInt32 windowDefinitionVersion
union {
struct {
SInt16 windowDefProc;
Boolean windowHasCloseBox;
} versionOne;
struct {
WindowClass windowClass;
WindowAttributes windowAttributes;
} versionTwo;
} windowDefinition;
};
typedef struct BasicWindowDescription BasicWindowDescription;
Fields
descriptionSizeA value specifying the size of the entire
BasicWindowDescriptionstructure.windowContentRectA structure of type
Rect, specifying the initial size and screen location of the window’s content area.windowZoomRectReserved.
windowRefConThe window’s reference value field, which is simply storage space available to your application for any purpose. The value contained in this field persists when the
'WIND'resource is stored, so you should avoid saving pointers in this field, as they may become stale.windowStateFlagsA 32-bit value whose bits you set to indicate the status of transient window states. See “Basic Window Description State Constant” for possible values.
windowPositionMethodThe specification last used in the function
RepositionWindowto position this window, if any. See “Window Position Constants” for a description of possible values for this field.windowDefinitionVersionThe version of the window definition used for the window. Set this field to a value of 1 if your application is creating a pre–Mac OS 8.5 window, that is, a window lacking class and attribute information. Set this field to a value of 2 if your application is creating a window using class and attribute information. See “Basic Window Description Version Constants” for descriptions of these values.
windowDefinitionA union of the
versionOneandversionTwostructures. Your application must either specify the window’s class and attributes, or it must supply a window definition ID and specify whether or not the window has a close box. See “Window Class Constants” and “Window Attributes” for descriptions of class and attribute values.
Discussion
The BasicWindowDescription structure is a default collection item for a resource of type ‘wind’. You use the BasicWindowDescription structure to describe the statically-sized base characteristics of a window.
Availability
- Available in OS X v10.0 and later.
Declared In
MacWindows.hGetGrowImageRegionRec
Defines a region to be XOR’d during a window grow or resize operation.
struct GetGrowImageRegionRec {
Rect growRect;
RgnHandle growImageRegion;
};
typedef struct GetGrowImageRegionRec GetGrowImageRegionRec;
Fields
growRectThe window’s new bounds in global coordinates.
growImageRegionThe grow image region.
Availability
- Available in OS X v10.0 and later.
Declared In
MacWindows.hGetWindowRegionRec
Passed to window definitions in the kWindowMsgGetRegion message.
struct GetWindowRegionRec {
RgnHandle winRgn;
WindowRegionCode regionCode;
};
typedef struct GetWindowRegionRec GetWindowRegionRec;
typedef GetWindowRegionRec * GetWindowRegionPtr;
Fields
winRgnA handle to a window region based on the value specified in the
regionCodefield. Modify this region.regionCodeA value representing a given window region; see “Window Region Constants.”
Special Considerations
Availability
- Available in OS X v10.0 and later.
Declared In
MacWindows.hHIWindowRef
Represents a window.
typedef WindowRef HIWindowRef;
Availability
- Available in OS X v10.3 and later.
Declared In
MacWindows.hMeasureWindowTitleRec
Defines specifications of the window title.
struct MeasureWindowTitleRec {
SInt16 fullTitleWidth;
SInt16 titleTextWidth;
Boolean isUnicodeTitle;
Boolean unused;
};
typedef struct MeasureWindowTitleRec MeasureWindowTitleRec;
typedef MeasureWindowTitleRec * MeasureWindowTitleRecPtr;
Fields
fullTitleWidthYour window definition function sets this field to a value specifying the total width in pixels of the window title text and any proxy icon that may be present, ignoring any compression or truncation that might be required when the title is actually drawn. That is, the specified width should be the ideal width that would be used if the window were sufficiently wide to draw the entire title along with a proxy icon. You should measure the title width using the current system font. If no proxy icon is present, this field should have the same value as the
titleTextWidthfield.titleTextWidthYour window definition function sets this field to a value specifying the width in pixels of the window title text, ignoring any compression or truncation that might be required when the title is actually drawn. That is, the specified width should be the ideal width that would be used if the window were sufficiently wide to draw the entire title. You should measure the title width using the current system font.
isUnicodeTitleYour window definition function may ignore this field; it is reserved for future use.
unusedYour window definition function may ignore this field; it is reserved for future use.
Discussion
If you implement a custom window definition function, when the Window Manager passes the message kWindowMsgMeasureTitle in your window definition function’s message parameter it also passes a pointer to a structure of type MeasureWindowTitleRec in the param parameter. Your window definition function is responsible for setting the contents of the MeasureWindowTitleRec structure to contain data describing the ideal title width.
See “Window Definition Message Constants” and “Window Feature Bits” for more details on the kWindowMsgMeasureTitle message and the corresponding kWindowCanMeasureTitle feature flag.
Availability
- Available in OS X v10.0 and later.
Declared In
MacWindows.hPropertyCreator
Defines the creator of a window property.
typedef OSType PropertyCreator;
Availability
- Available in OS X v10.0 and later.
Declared In
MacWindows.hPropertyTag
Defines a window property tag.
typedef OSType PropertyTag;
Availability
- Available in OS X v10.0 and later.
Declared In
MacWindows.hPicHandle
Defines a picture handle.
typedef PicPtr * PicPatHandle;
PixPatHandle
Pixel pattern handle.
typedef PixPatPtr * PixPatHandle;
Availability
- Available in OS X v10.0 and later.
Declared In
Quickdraw.hRGBColor
RGB color.
struct RGBColor {
unsigned short red;
unsigned short green;
unsigned short blue;
};
typedef struct RGBColor;
typedef RGBColor * RGBColorPtr;
Fields
redAn unsigned short integer specifying the red value of the color.
greenAn unsigned short integer specifying the green value of the color.
blueAn unsigned short integer specifying the red value of the color.
Availability
- Available in OS X v10.0 and later.
Declared In
IOMacOSTypes.hRgnHandle
Region handle.
typedef struct OpaqueRgnHandle * RgnHandle;
Availability
- Available in OS X v10.0 and later.
Declared In
Quickdraw.hSetupWindowProxyDragImageRec
Defines a window proxy drag image.
struct SetupWindowProxyDragImageRec {
GWorldPtr imageGWorld;
RgnHandle imageRgn;
RgnHandle outlineRgn;
};
typedef struct SetupWindowProxyDragImageRec SetupWindowProxyDragImageRec;
Fields
imageGWorldA pointer to the offscreen graphics world containing the drag image. The window definition function must allocate the offscreen graphics world, since the Window Manager has no way of knowing the appropriate size for the drag image. The Window Manager disposes of the offscreen graphics world.
imageRgnA handle to a region containing the drag image. Only this portion of the offscreen graphics world referred to by the
imageGWorldfield is actually drawn. The Window Manager allocates and disposes of this region.outlineRgnA handle to a region containing an outline of the drag image, for use on monitors incapable of displaying the drag image itself. The Window Manager allocates and disposes of this region.
Discussion
If you implement a custom window definition function, when the function TrackWindowProxyDrag is called, the Window Manager passes the message kWindowMsgSetupProxyDragImage in your window definition function’s message parameter and passes a pointer to a structure of type SetupWindowProxyDragImageRec in the param parameter. Your window definition function is responsible for setting the contents of the SetupWindowProxyDragImageRec structure to contain data describing the proxy icon’s drag image.
See “Window Definition Message Constants”and “Window Feature Bits” for more details on the kWindowMsgSetupProxyDragImage message and the corresponding kWindowCanSetupProxyDragImage feature flag.
Availability
- Available in OS X v10.0 and later.
Declared In
MacWindows.hTransitionWindowOptions
Defines transition options used when calling TransitionWindowWithOptions.
struct TransitionWindowOptions {
UInt32 version;
EventTime duration;
WindowRef window;
void * userData;
};
typedef struct TransitionWindowOptions TransitionWindowOptions;
Fields
versionThe structure version. You must put
0in this field.durationThe duration of the fade, in seconds. For use with the Sheet, Slide, Fade, and Genie transition effects; ignored for other effects. You may pass 0 to use the default duration. The effect is not guaranteed to last precisely this long, but should be a close approximation.
windowThe parent window of the sheet; for use with
kWindowSheetTransitionEffect.userDataA value that is sent as the
kEventParamUserDataparameter for thekEventWindowTransitionStartedandkEventWindowTransitionCompletedevents.
Availability
- Available in OS X v10.3 and later.
Declared In
MacWindows.hWindowDefSpec
Defines a window definition.
struct WindowDefSpec {
WindowDefType defType
union {
WindowDefUPP defProc;
void * classRef;
short procID;
void * rootView;
} u;
};
typedef struct WindowDefSpec WindowDefSpec;
typedef WindowDefSpec * WindowDefSpecPtr;
Fields
defTypeThe window definition type. See “Window Definition Type Constants” for a list of possible values.
uA pointer to the window definition, depending on the constant passed into the
defTypefield.
Availability
- Available in OS X v10.0 and later.
Declared In
MacWindows.hWindowDefUPP
Defines a UPP to a specified window definition.
typedef WindowDefProcPtr WindowDefUPP;
Discussion
For more information, see WindowDefProcPtr.
Availability
- Available in OS X v10.0 and later.
Declared In
MacWindows.hWindowGroupRef
Represents a window group.
typedef struct OpaqueWindowGroupRef * WindowGroupRef;
Availability
- Available in OS X v10.0 and later.
Declared In
MacWindows.hWindowPaintUPP
Defines a UPP to the specified region painting callback.
typedef WindowPaintProcPtr WindowPaintUPP;
Discussion
For more information, see WindowPaintProcPtr.
Availability
- Available in OS X v10.0 and later.
Declared In
MacWindows.hWindowRef
An opaque type that represents a window.
typedef WindowPtr WindowRef;
Availability
- Available in OS X v10.0 and later.
Declared In
Quickdraw.hWStateData
Stores the user state and the standard state of a window.
struct WStateData {
Rect userState;
Rect stdState;
};
typedef struct WStateData WStateData;
typedef WStateData * WStateDataPtr;
Fields
userStateA rectangle that describes the window size and location established by the user.
The Window Manager initializes the user state to the size and location of the window when it is first displayed, and then updates the
userStatefield whenever the user resizes a window. Although the user state specifies both the size and location of the window, the Window Manager updates the window state data structure only when the user resizes a window—not when the user merely moves a window.stdStateThe rectangle describing the window size and location that your application considers the most convenient, considering the function and contents of the document, the screen space available, and the position of the window in its user state. If your application does not define a standard state, the Window Manager automatically sets the standard state to the entire gray region on the main screen, minus a three-pixel border on all sides. The user cannot change a window’s standard state.
Discussion
When the Appearance Manager is available, you should not extend the window state data structure. Instead use the refCon field of the color window structure or extend the window record structure.
The zoom box allows the user to alternate quickly between two window positions and sizes: the user state and the standard state. The Window Manager stores the user state and your application stores the standard state in the window state data structure of type WStateData. The handle to this structure appears in the dataHandle field of the window structure.
The ZoomWindow function changes the size of a window according to the values in the window state data structure.
Availability
- Available in OS X v10.0 and later.
Declared In
MacWindows.hConstants
Window Class Constants
Constants that specify the standard window classes.
typedef UInt32 WindowClass;
enum {
kAlertWindowClass = 1,
kMovableAlertWindowClass = 2,
kModalWindowClass = 3,
kMovableModalWindowClass = 4,
kFloatingWindowClass = 5,
kDocumentWindowClass = 6,
kUtilityWindowClass = 8,
kHelpWindowClass = 10,
kSheetWindowClass = 11,
kToolbarWindowClass = 12,
kPlainWindowClass = 13,
kOverlayWindowClass = 14,
kSheetAlertWindowClass = 15,
kAltPlainWindowClass = 16,
kDrawerWindowClass = 20,
kAllWindowClasses = 0xFFFFFFFF
};
Constants
kAlertWindowClassIdentifies an alert box window. An alert window is used when the application needs the user's attention immediately. On Mac OS 9 and earlier, a visible alert window will prevent the user from switching to any other application. Use
kThemeBrushAlertBackgroundActiveto draw the background of alert windows. Alert windows are initially placed in the modal window group, given a modality ofkWindowModalityAppModal, and given an activation scope ofkWindowActivationScopeAll.Available in OS X v10.0 and later.
Declared in
MacWindows.h.kMovableAlertWindowClassIdentifies a movable alert box window. Generally, you should use this window class rather than
kAlertWindowClass. UsekThemeBrushAlertBackgroundActiveto draw the background of alert windows. Alert windows are initially placed in the modal window group, given a modality ofkWindowModalityAppModal, and given an activation scope ofkWindowActivationScopeAll.Available in OS X v10.0 and later.
Declared in
MacWindows.h.kModalWindowClassIdentifies a modal dialog box window. Use
kThemeBrushDialogBackgroundActiveto draw the background of modal dialog windows. Modal dialog windows are initially placed in the modal window group, given a modality ofkWindowModalityAppModal, and given an activation scope ofkWindowActivationScopeAll.Available in OS X v10.0 and later.
Declared in
MacWindows.h.kMovableModalWindowClassIdentifies a movable modal dialog box window. In Mac OS X and CarbonLib 1.3 and later, use
kThemeBrushMovableModalBackgroundto draw the background of alert windows. Alert windows are initially placed in the modal window group, given a modality ofkWindowModalityAppModal, and given an activation scope ofkWindowActivationScopeAll.Available in OS X v10.0 and later.
Declared in
MacWindows.h.kFloatingWindowClassIdentifies a window that floats above all document windows. If your application assigns this constant to a window, the Window Manager ensures that the window has the proper floating behavior. Use
kThemeBrushUtilityWindowBackgroundActiveorkThemeBrushDocumentWindowBackgroundto draw the background of floating windows. Floating windows are initially placed in the floating window group, given a modality ofkWindowModalityNone, and given an activation scope ofkWindowActivationScopeIndependent.Available in OS X v10.0 and later.
Declared in
MacWindows.h.kDocumentWindowClassIdentifies a document window or modeless dialog box window. Use
kThemeBrushDocumentWindowBackgroundor your own custom drawing to draw the background of a document window. Document windows are initially placed in the document window group, given a modality ofkWindowModalityNone, and given an activation scope ofkWindowActivationScopeAll.The Window Manager assigns this class to pre–Mac OS 8.5 Window Manager windows.Available in OS X v10.0 and later.
Declared in
MacWindows.h.kUtilityWindowClassIdentifies a utility window. A utility window is similar to a floating window, but it floats above the windows of all applications rather than just above the windows of the application that creates it. Use
kThemeBrushUtilityWindowBackgroundActiveorkThemeBrushDocumentWindowBackgroundto draw the background of utility windows. Utility windows are initially placed in the utility window group, given a modality ofkWindowModalityNone, and given an activation scope ofkWindowActivationScopeIndependent.Available in OS X v10.0 and later.
Declared in
MacWindows.h.kHelpWindowClassIdentifies a window used for help tags. It has no window frame. Typically you should use the Help Manager to display help tags, rather than creating a help tag window yourself. Help windows are initially placed in the help window group, given a modality of
kWindowModalityNone, and given an activation scope ofkWindowActivationScopeNone.Available in OS X v10.0 and later.
Declared in
MacWindows.h.kSheetWindowClassIdentifies a sheet. (Mac OS X only.) Use
kThemeBrushSheetBackgroundOpaqueto draw an opaque background for sheet windows, orkThemeBrushSheetBackgroundTransparentto draw a transparent background. Sheet windows are initially placed in the document window group, given a modality ofkWindowModalityNone, and given an activation scope ofkWindowActivationScopeAll.Available in OS X v10.0 and later.
Declared in
MacWindows.h.kToolbarWindowClassIdentifies a toolbar window, which is used to display a palette of controls. A toolbar window is similar to a floating window, and like a floating window, is layered above all application windows except for alert and modal windows, but is layered beneath floating windows. Toolbar windows are initially placed in the toolbar window group, given a modality of
kWindowModalityNone, and given an activation scope ofkWindowActivationScopeNone.Available in OS X v10.0 and later.
Declared in
MacWindows.h.kPlainWindowClassIdentifies a plain window, which has a single-pixel window frame. Plain windows are initially placed in the document window group, given a modality of
kWindowModalityNone, and given an activation scope ofkWindowActivationScopeAll.Available in OS X v10.0 and later.
Declared in
MacWindows.h.kOverlayWindowClassIdentifies an overlay window, which is a completely transparent window. Overlay windows are positioned by default above all other windows, but you can group an overlay window with any other window, at any z-order. Overlay windows are intended as a replacement for the pre-Carbon practice of drawing directly into the Window Manager port. By creating a full-screen overlay window and drawing into it, you can draw over any window in any application without disturbing the contents of the windows beneath your drawing. Overlay windows have a default handler for
kEventWindowPaintthat usesCGContextClearRectto clear the overlay window's alpha channel to zero. This ensures the initial transparency of the window. You can install your ownkEventWindowPainthandler to do your own drawing; typically, you would call through to the default handler withCallNextEventHandlerfirst, and then useQDBeginCGContextto create your own context for drawing. You can use either QuickDraw or Core Graphics to draw into an overlay window, but you must use Core Graphics to draw if you need any of your drawing to be non-opaque, since QuickDraw always sets the alpha channel of any pixels that it touches to 1.0. (QuickDraw is also deprecated in Mac OS X v10.4 and later.) You can also use the standard window event handler together with regular controls in an overlay window. When using the standard window event handler, you will probably want yourkEventWindowPainthandler to returneventNotHandledErr(after calling the default handler withCallNextEventHandlerfirst) so that after the Paint handler returns, the Window Manager will send akEventWindowDrawContentevent which the standard window event handler can respond to by drawing the controls in the window. Overlay windows are initially placed in the overlay window group, given a modality ofkWindowModalityNone, and given an activation scope ofkWindowActivationScopeNone.Available in OS X v10.0 and later.
Declared in
MacWindows.h.kSheetAlertWindowClassIdentifies an alert sheet. Use
kThemeBrushSheetBackgroundOpaqueto draw an opaque background for sheet alert windows, orkThemeBrushSheetBackgroundTransparentto draw a transparent background. Sheet alert windows are initially placed in the document window group, given a modality ofkWindowModalityNone, and given an activation scope ofkWindowActivationScopeAll.Available in OS X v10.1 and later.
Declared in
MacWindows.h.kAltPlainWindowClassIdentifies an alternate plain window, which is similar to a plain window but has a solid black shadow on its right and bottom sides. It is rarely used in modern Mac OS applications. Alternate plain windows are initially placed in the document window group, given a modality of
kWindowModalityNone, and given an activation scope ofkWindowActivationScopeAll.Available in OS X v10.1 and later.
Declared in
MacWindows.h.kDrawerWindowClassIdentifies a drawer. Use
kThemeBrushDrawerBackgroundorkThemeBrushDocumentWindowBackgroundto draw the background of drawer windows. Drawer windows are initially placed in the document window group, given a modality ofkWindowModalityNone, and given an activation scope ofkWindowActivationScopeAll. Drawer windows should always be created using the compositing window attribute.Available in OS X v10.2 and later.
Declared in
MacWindows.h.kAllWindowClassesSpecifier used to designate all window classes. Used with
GetFrontWindowOfClass,FindWindowOfClass, andGetNextWindowOfClassto indicate that there should be no restriction on the class of the returned window. Also used withGetWindowGroupOfClassto get the root window group.Available in OS X v10.0 and later.
Declared in
MacWindows.h.
Discussion
The WindowClass constants categorize windows into groups of like types. The grouping of windows facilitates the appropriate display (that is, both the look and the front-to-back ordering) and tracking of windows.
You can define a window’s class using the function CreateNewWindow and obtain a window’s class using the function GetWindowClass. You can change the class of certain windows by calling HIWindowChangeClass.
Window Attribute Identifiers
Constants that specify standard window attributes.
enum {
kHIWindowBitCloseBox = 1,
kHIWindowBitZoomBox = 2,
kHIWindowBitCollapseBox = 4,
kHIWindowBitResizable = 5,
kHIWindowBitSideTitlebar = 6,
kHIWindowBitToolbarButton = 7,
kHIWindowBitUnifiedTitleAndToolbar = 8,
kHIWindowBitTextured = 9,
kHIWindowBitNoTitleBar = 10,
kHIWindowBitTexturedSquareCorners = 11,
kHIWindowBitNoTexturedContentSeparator = 12,
kHIWindowBitDoesNotCycle = 16,
kHIWindowBitNoUpdates = 17,
kHIWindowBitNoActivates = 18,
kHIWindowBitOpaqueForEvents = 19,
kHIWindowBitCompositing = 20,
kHIWindowBitFrameworkScaled = 21,
kHIWindowBitNoShadow = 22,
kHIWindowBitCanBeVisibleWithoutLogin = 23,
kHIWindowBitAsyncDrag = 24,
kHIWindowBitHideOnSuspend = 25,
kHIWindowBitStandardHandler = 26,
kHIWindowBitHideOnFullScreen = 27,
kHIWindowBitInWindowMenu = 28,
kHIWindowBitLiveResize = 29,
kHIWindowBitIgnoreClicks = 30,
kHIWindowBitNoConstrain = 32,
kHIWindowBitDoesNotHide = 33,
kHIWindowBitAutoViewDragTracking = 34,
kHIWindowBitDoesNotShowBadgeInDock = 35
};
Constants
kHIWindowBitCloseBoxThe window has a close box. This attribute is available for windows of class
kDocumentWindowClass,kFloatingWindowClass, andkUtilityWindowClass.Available in OS X v10.5 and later.
Declared in
MacWindows.h.kHIWindowBitZoomBoxThe window has a zoom box. This attribute is available for windows of class
kDocumentWindowClass,kFloatingWindowClass, andkUtilityWindowClass. When this attribute is set on a window, both thekWindowHorizontalZoomAttributeandkWindowVerticalZoomAttributebits are set automatically.Available in OS X v10.5 and later.
Declared in
MacWindows.h.kHIWindowBitCollapseBoxThe window has a collapse box. This attribute is available for windows of class
kDocumentWindowClass,kFloatingWindowClass, andkUtilityWindowClass. For floating and utility window classes, this attribute must be added to the window after the window is created; it may not be added to the window at creation time.Available in OS X v10.5 and later.
Declared in
MacWindows.h.kHIWindowBitResizableThe window has a resize tab or box and is resizable. This attribute is available for windows of class
kDocumentWindowClass,kMovableModalWindowClass,kFloatingWindowClass,kUtilityWindowClass, andkSheetWindowClass.Available in OS X v10.5 and later.
Declared in
MacWindows.h.kHIWindowBitSideTitlebarThe window has a vertical title bar on the side of the window. This attribute is available for windows of the
kFloatingWindowClassandkUtilityWindowClassclass.Available in OS X v10.5 and later.
Declared in
MacWindows.h.kHIWindowBitToolbarButtonThe window has a toolbar button. This oblong clear button shows and hides the toolbar. This attribute is available for windows of class
kDocumentWindowClass.Available in OS X v10.5 and later.
Declared in
MacWindows.h.kHIWindowBitUnifiedTitleAndToolbarThe window draws its window title and toolbar using a unified appearance that has no separator between the two areas. A window may not have both this attribute and the
kHIWindowBitTexturedattribute.Available in OS X v10.5 and later.
Declared in
MacWindows.h.kHIWindowBitTexturedThe window uses the textured or brushed-metal appearance. Drawers can also be textured, but dynamically adjust their appearance based on their parent window’s appearance; it is not necessary to specify this attribute for a textured drawer. This attribute is available for windows of class
kDocumentWindowClassandkFloatingWindowClass.Available in OS X v10.5 and later.
Declared in
MacWindows.h.kHIWindowBitNoTitleBarThe window’s title bar can be hidden. This attribute is available for windows of class
kDocumentWindowClass,kFloatingWindowClass, andkUtilityWindowClass.Available in OS X v10.5 and later.
Declared in
MacWindows.h.kHIWindowBitTexturedSquareCornersIndicates that a textured window should have square corners. By default, a textured window has round corners. When this attribute is set on a window, the window frame view automatically makes the grow box view opaque, and when this attribute is cleared, the window frame view automatically makes the grow box view transparent. You can change the grow box view transparency after modifying this attribute with the function
HIGrowBoxViewSetTransparent. Relevant only for textured windows; ignored in non-textured windows.Available in OS X v10.5 and later.
Declared in
MacWindows.h.kHIWindowBitNoTexturedContentSeparatorIndicates that no border is drawn between the toolbar and window content. This attribute is relevant only in textured windows; it is ignored in non-textured windows.
Available in OS X v10.5 and later.
Declared in
MacWindows.h.kHIWindowBitDoesNotCycleThe window does not participate in window cycling invoked by Command-~ or keyboard shortcuts defined in the Keyboard & Mouse preference pane.
Available in OS X v10.5 and later.
Declared in
MacWindows.h.kHIWindowBitNoUpdatesThe window does not receive update events. This attribute is available for all windows.
Available in OS X v10.5 and later.
Declared in
MacWindows.h.kHIWindowBitNoActivatesThe window does not receive activate events. This attribute is available for all windows.
Available in OS X v10.5 and later.
Declared in
MacWindows.h.kHIWindowBitOpaqueForEventsThe window receives mouse events even for areas of the window that are transparent (that is, have an alpha channel component of zero).
Available in OS X v10.5 and later.
Declared in
MacWindows.h.kHIWindowBitCompositingThe window uses HIView-based compositing, which means that the entire window is comprised of HIViews, and can be treated thusly. This attribute must be specified at window creation; you may not add this attribute after the window has been created.
Available in OS X v10.5 and later.
Declared in
MacWindows.h.kHIWindowBitFrameworkScaledThe window’s content is scaled to match the display scale factor. This attribute can only be used when
kHIWindowBitCompositingis also enabled. When this attribute is enabled, you may not draw with QuickDraw in the window. If this attribute is enabled and if the scale factor is something other than 1.0, the window’s scale mode iskHIWindowScaleModeFrameworkScaled. If you specify this attribute andkHIWindowBitApplicationScaled, thekHIWindowBitApplicationScaledattribute is ignored. You may only specify this attribute at window creation time.Available in OS X v10.5 and later.
Declared in
MacWindows.h.kHIWindowBitNoShadowThe window has no shadow. This attribute is available for all windows, and is given automatically to windows of class
kOverlayWindowClass.Available in OS X v10.5 and later.
Declared in
MacWindows.h.kHIWindowBitCanBeVisibleWithoutLoginThe window can be made visible prior to user login. By default, in Mac OS X 10.5 and later no windows can be visible before a user logs into the system; this protects the user against certain types of malicious use of insecure applications. However, some software, such as input methods or other accessibility software, may need to deliberately make windows available prior to user login. Such software should add this window attribute to its windows.
Available in OS X v10.5 and later.
Declared in
MacWindows.h.kHIWindowBitAsyncDragThe window server drags the window automatically. Your application should not call
DragWindowfor this window because this function would fight with the Window Server for control. This attribute is ignored if the window is grouped with other windows in a window group that has thekWindowGroupAttrMoveTogetherattribute.Available in OS X v10.5 and later.
Declared in
MacWindows.h.kHIWindowBitHideOnSuspendThe window is hidden automatically on suspend and shown on resume. This attribute available for all windows and is given automatically to windows of class
kFloatingWindowClass,kHelpWindowClass, andkToolbarWindowClass.Available in OS X v10.5 and later.
Declared in
MacWindows.h.kHIWindowBitStandardHandlerThe window supports the standard window event handler. The standard event handler provides standard actions for common window events. See Carbon Event Manager Programming Guide for details. This attribute is available for all windows.
Available in OS X v10.5 and later.
Declared in
MacWindows.h.kHIWindowBitHideOnFullScreenThe window is automatically hidden during full-screen mode (when the menubar is invisible) and shown afterwards. Available for all windows. This attribute is automatically given to windows of class
kUtilityWindowClass.Available in OS X v10.5 and later.
Declared in
MacWindows.h.kHIWindowBitInWindowMenuThe window title appears in the system-generated Window menu. This attribute is only available for windows of class
kDocumentWindowClassand is automatically given to windows of that class.Available in OS X v10.5 and later.
Declared in
MacWindows.h.kHIWindowBitLiveResizeThe window supports live resizing. This attribute is available for all windows.
Available in OS X v10.5 and later.
Declared in
MacWindows.h.kHIWindowBitIgnoreClicksThe window never receives mouse events, even in areas that are opaque. Instead, clicks on the window are passed through to windows beneath it.
Available in OS X v10.5 and later.
Declared in
MacWindows.h.kHIWindowBitNoConstrainThe window is not repositioned by the default
kEventWindowConstrainhandler in response to changes in monitor size, Dock position, and so on.Available in OS X v10.5 and later.
Declared in
MacWindows.h.kHIWindowBitDoesNotHideThe window does not hide when the application is hidden.
Available in OS X v10.5 and later.
Declared in
MacWindows.h.kHIWindowBitAutoViewDragTrackingThe window automatically installs Drag Manager callbacks to detect drag actions, and automatically sends HIView drag Carbon events. Setting this attribute is equivalent to calling the function
SetAutomaticControlDragTrackingEnabledForWindow(and calling that function will set this attribute).Available in OS X v10.5 and later.
Declared in
MacWindows.h.kHIWindowBitDoesNotShowBadgeInDockIndicates that the Dock should not add a badge to this window's icon when the window is minimized to the Dock.
Discussion
In Mac OS X version 10.5 and later, you may use these constants to set or test the attributes of a window. For example, you may use them with the function HIWindowCreate to define the attributes of a new window, the function HIWindowChangeAttributes to change a window’s attributes, and the function HIWindowTestAttribute to test whether a window has a specific attribute.
Window Attributes
Bit masks that specify standard window attributes. In Mac OS X v10.5 and later, you may use “Window Attribute Identifiers” instead.
typedef UInt32 WindowAttributes;
enum {
kWindowNoAttributes = 0,
kWindowCloseBoxAttribute = (1L << 0),
kWindowHorizontalZoomAttribute = (1L << 1),
kWindowVerticalZoomAttribute = (1L << 2),
kWindowFullZoomAttribute = (kWindowVerticalZoomAttribute | kWindowHorizontalZoomAttribute),
kWindowCollapseBoxAttribute = (1L << 3),
kWindowResizableAttribute = (1L << 4),
kWindowSideTitlebarAttribute = (1L << 5),
kWindowToolbarButtonAttribute = (1L << 6),
kWindowUnifiedTitleAndToolbarAttribute = (1L << 7),
kWindowMetalAttribute = (1L << 8),
kWindowNoTitleBarAttribute = (1L << 9),
kWindowTexturedSquareCornersAttribute = (1L << 10),
kWindowMetalNoContentSeparatorAttribute = (1L << 11),
kWindowDoesNotCycleAttribute = (1L << 15),
kWindowNoUpdatesAttribute = (1L << 16),
kWindowNoActivatesAttribute = (1L << 17),
kWindowOpaqueForEventsAttribute = (1L << 18),
kWindowCompositingAttribute = (1L << 19),
kWindowFrameworkScaledAttribute = (1L << 20),
kWindowNoShadowAttribute = (1L << 21),
kWindowCanBeVisibleWithoutLoginAttribute = (1L << 22),
kWindowAsyncDragAttribute = (1L << 23),
kWindowHideOnSuspendAttribute = (1L << 24),
kWindowStandardHandlerAttribute = (1L << 25),
kWindowHideOnFullScreenAttribute = (1L << 26),
kWindowInWindowMenuAttribute = (1L << 27),
kWindowLiveResizeAttribute = (1L << 28),
kWindowIgnoreClicksAttribute = (1L << 29),
kWindowNoConstrainAttribute = (1L << 31),
kWindowStandardDocumentAttributes = (kWindowCloseBoxAttribute | kWindowFullZoomAttribute | kWindowCollapseBoxAttribute | kWindowResizableAttribute),
kWindowStandardFloatingAttributes = (kWindowCloseBoxAttribute | kWindowCollapseBoxAttribute)
};
Constants
kWindowNoAttributesIf no bits are set, the window has none of the standard attributes.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowCloseBoxAttributeIf the bit specified by this mask is set, the window has a close box. See
kHIWindowBitCloseBox.Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowHorizontalZoomAttributeIf the bit specified by this mask is set, the window changes width when zooming. See
kHIWindowBitZoomBox.Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowVerticalZoomAttributeIf the bit specified by this mask is set, the window changes height when zooming. See
kHIWindowBitZoomBox.Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowFullZoomAttributeIf the bits specified by this mask are set, the window changes both width and height when zooming. See
kHIWindowBitZoomBox.Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowCollapseBoxAttributeIf the bit specified by this mask is set, the window has a collapse box. See
kHIWindowBitCollapseBox.Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowResizableAttributeIf the bit specified by this mask is set, the window has a resize tab or box and is resizable. See
kHIWindowBitResizable.Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowSideTitlebarAttributeIf the bit specified by this mask is set, the window has a side title bar. See
kHIWindowBitSideTitlebar.Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowToolbarButtonAttributeIf the bit specified by this mask is set, the window has a toolbar button. See
kHIWindowBitToolbarButton.Available in OS X v10.1 and later.
Declared in
MacWindows.h.kWindowUnifiedTitleAndToolbarAttributeIf the bit specified by this mask is set, the window draws its window title and toolbar using a unified appearance that has no separator between the two areas. A window may not have both this attribute and the
kWindowMetalAttributeattribute.Available in OS X v10.5 and later.
Declared in
MacWindows.h.kWindowMetalAttributeIf the bit specified by this mask is set, the window has a textured or brushed-metal appearance. See
kHIWindowBitTextured.Available in OS X v10.2 and later.
Declared in
MacWindows.h.kWindowNoTitleBarAttributeIf the bit specified by this mask is set, the window’s title bar can be hidden. See
kHIWindowBitNoTitleBar.Available in OS X v10.4 and later.
Declared in
MacWindows.h.kWindowTexturedSquareCornersAttributeSee
kHIWindowBitTexturedSquareCorners.Available in OS X v10.5 and later.
Declared in
MacWindows.h.kWindowMetalNoContentSeparatorAttributeIf the bit specified by this mask is set, no border is drawn between the toolbar and window content. See
kHIWindowBitNoTexturedContentSeparator.Available in OS X v10.4 and later.
Declared in
MacWindows.h.kWindowDoesNotCycleAttributeIf the bit specified by this mask is set, the window does not participate in window cycling. See
kHIWindowBitDoesNotCycle.Available in OS X v10.3 and later.
Declared in
MacWindows.h.kWindowNoUpdatesAttributeIf the bit specified by this mask is set, the window does not receive update events. See
kHIWindowBitNoUpdates.Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowNoActivatesAttributeIf the bit specified by this mask is set, the window does not receive activate events. See
kHIWindowBitNoActivates.Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowOpaqueForEventsAttributeIf the bit specified by this mask is set, the window receives mouse events even for areas of the window that are transparent. See
kHIWindowBitOpaqueForEvents.Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowCompositingAttributeIf the bit specified by this mask is set, the window uses HIView-based compositing. See
kHIWindowBitCompositing.Available in OS X v10.2 and later.
Declared in
MacWindows.h.kWindowFrameworkScaledAttributeIf the bit specified by this mask is set, this window’s content is scaled to match the display scale factor. See
kHIWindowBitFrameworkScaled.Available in OS X v10.4 and later.
Declared in
MacWindows.h.kWindowNoShadowAttributeIf the bit specified by this mask is set, the window has no shadow. See
kHIWindowBitNoShadow.Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowCanBeVisibleWithoutLoginAttributeIf the bit specified by this mask is set, the window can be made visible prior to user login. See
kHIWindowBitCanBeVisibleWithoutLogin.Available in OS X v10.5 and later.
Declared in
MacWindows.h.kWindowAsyncDragAttributeIf the bit specified by this mask is set, the window server drags the window automatically. See
kHIWindowBitAsyncDrag.Available in OS X v10.3 and later.
Declared in
MacWindows.h.kWindowHideOnSuspendAttributeIf the bit specified by this mask is set, the window is hidden automatically on suspend and shown on resume. See
kHIWindowBitHideOnSuspend.Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowStandardHandlerAttributeIf the bit specified by this mask is set, the window supports the standard window event handler. See
kHIWindowBitStandardHandler.Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowHideOnFullScreenAttributeIf the bit specified by this mask is set, the window is automatically hidden during fullscreen mode (when the menubar is invisible) and shown afterwards. See
kHIWindowBitHideOnFullScreen.Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowInWindowMenuAttributeIf the bit specified by this mask is set, the window title appears in the system-generated Window menu. See
kHIWindowBitInWindowMenu.Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowLiveResizeAttributeIf the bit specified by this mask is set, the window supports live resizing. See
kHIWindowBitLiveResize.Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowIgnoreClicksAttributeIf the bit specified by this mask is set, the window never receives mouse events, even in areas that are opaque. See
kHIWindowBitIgnoreClicks.Available in OS X v10.2 and later.
Declared in
MacWindows.h.kWindowNoConstrainAttributeIf the bit specified by this mask is set, the window is not repositioned by the default
kEventWindowConstrainhandler. SeekHIWindowBitNoConstrain.Available in OS X v10.1 and later.
Declared in
MacWindows.h.kWindowStandardDocumentAttributesIf the bits specified by this mask are set, the window has the attributes of a standard document window—that is, a close box, full zoom box, collapse box, and size box.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowStandardFloatingAttributesIf the bits specified by this mask are set, the window has the attributes of a standard floating window—that is, a close box and collapse box.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.
Discussion
The WindowAttributes enumeration defines masks your application can use to set or test the bits in a window attributes parameter. You can use these masks with the function CreateNewWindow to define a window’s attributes, and with the function ChangeWindowAttributes to change a window’s attributes. You can also use these masks to test the attributes parameter produced by the function GetWindowAttributes, thereby obtaining a window’s attributes.
User Focus Auto-Select Constant
Defines a constant that tells the system to pick the best user focus window.
#define kUserFocusAuto ((WindowRef)(-1))
Constants
kUserFocusAutoPass this constant to the function
SetUserFocusWindowto have the system choose the most appropriate window for user focus.Available in OS X v10.2 and later.
Declared in
MacWindows.h.
Appearance-Compliant Window Resource IDs
Define window resources for Appearance-compliant applications.
enum {
kWindowDocumentDefProcResID = 64,
kWindowDialogDefProcResID = 65,
kWindowUtilityDefProcResID = 66,
kWindowUtilitySideTitleDefProcResID = 67,
kWindowSheetDefProcResID = 68,
kWindowSimpleDefProcResID = 69,
kWindowSheetAlertDefProcResID = 70
};
Constants
kWindowDocumentDefProcResIDDefines Appearance-compliant standard document windows with a size box. Standard document windows created with this resource ID can use variation codes to create windows with vertical and horizontal zoom boxes.
Available with Appearance 1.0 and later.
Declared in
MacWindows.h.kWindowDialogDefProcResIDDefines Appearance-compliant dialog and alert boxes. Modal and movable modal dialog boxes created with this resource ID are displayed with no space between their content and structure region. Alert boxes created with this resource ID are displayed with a red-tinged border.
Declared in
MacWindows.h.Available with Appearance 1.0 and later.
kWindowUtilityDefProcResIDDefines Appearance-compliant utility (floating) windows with a top title bar and a size box.
Available with Appearance 1.0 and later.
Declared in
MacWindows.h.kWindowUtilitySideTitleDefProcResIDDefines Appearance-compliant utility (floating) windows with a side title bar and a size box.
Available with Appearance 1.0 and later.
Declared in
MacWindows.h.kWindowSheetDefProcResIDDefines a window sheet.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowSimpleDefProcResIDDefines a simple window with no window frame.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowSheetAlertDefProcResIDDefines a sheet window that is displayed as an alert (rather than a dialog) on Mac OS 9.
Available in OS X v10.1 and later.
Declared in
MacWindows.h.
Discussion
Window resource IDs are changed with Appearance Manager 1.0. The Window Manager now provides many new standard, Appearance-compliant window resource IDs for your application.
You can use a window resource ID constant to create a window definition ID; see “Pre-Appearance Window Definition IDs” inWindow Manager Legacy Reference for more details.
Note that the standard Appearance-compliant resource ID constants kWindowDocumentDefProcResID, kWindowUtilityDefProcResID, and kWindowUtilitySideTitleDefProcResID specify windows with collapse boxes.
Resource IDs 0 through 127 are reserved for use by the system.
Appearance-Compliant Window Definition ID Constants
Define different window kinds.
enum {
kWindowDocumentProc = 1024,
kWindowGrowDocumentProc = 1025,
kWindowVertZoomDocumentProc = 1026,
kWindowVertZoomGrowDocumentProc = 1027,
kWindowHorizZoomDocumentProc = 1028,
kWindowHorizZoomGrowDocumentProc = 1029,
kWindowFullZoomDocumentProc = 1030,
kWindowFullZoomGrowDocumentProc = 1031
};
enum {
kWindowPlainDialogProc = 1040,
kWindowShadowDialogProc = 1041,
kWindowModalDialogProc = 1042,
kWindowMovableModalDialogProc = 1043,
kWindowAlertProc = 1044,
kWindowMovableAlertProc = 1045
};
enum {
kWindowMovableModalGrowProc = 1046
};
enum {
kWindowFloatProc = 1057,
kWindowFloatGrowProc = 1059,
kWindowFloatVertZoomProc = 1061,
kWindowFloatVertZoomGrowProc = 1063,
kWindowFloatHorizZoomProc = 1065,
kWindowFloatHorizZoomGrowProc = 1067,
kWindowFloatFullZoomProc = 1069,
kWindowFloatFullZoomGrowProc = 1071
};
enum {
kWindowFloatSideProc = 1073,
kWindowFloatSideGrowProc = 1075,
kWindowFloatSideVertZoomProc = 1077,
kWindowFloatSideVertZoomGrowProc = 1079,
kWindowFloatSideHorizZoomProc = 1081,
kWindowFloatSideHorizZoomGrowProc = 1083,
kWindowFloatSideFullZoomProc = 1085,
kWindowFloatSideFullZoomGrowProc = 1087
};
enum {
kWindowSheetProc = 1088,
kWindowSheetAlertProc = 1120
};
enum {
kWindowSimpleProc = 1104,
kWindowSimpleFrameProc = 1105
};
Constants
kWindowDocumentProcAppearance-compliant movable window with no size box or zoom box. Available with Appearance 1.0 and later. The corresponding pre-Appearance window definition ID is
noGrowDocProc.Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowGrowDocumentProcAppearance-compliant standard document window (movable window with size box). Available with Appearance 1.0 and later. The corresponding pre-Appearance window definition ID is
documentProc.Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowVertZoomDocumentProcAppearance-compliant window with vertical zoom box and no size box. Available with Appearance 1.0 and later. There is no corresponding pre-Appearance window definition ID.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowVertZoomGrowDocumentProcAppearance-compliant window with vertical zoom box and size box. Available with Appearance 1.0 and later. There is no corresponding pre-Appearance window definition ID.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowHorizZoomDocumentProcAppearance-compliant window with horizontal zoom box and no size box. Available with Appearance 1.0 and later. There is no corresponding pre-Appearance window definition ID.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowHorizZoomGrowDocumentProcAppearance-compliant window with horizontal zoom box and size box. Available with Appearance 1.0 and later. There is no corresponding pre-Appearance window definition ID.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowFullZoomDocumentProcAppearance-compliant window with full zoom box and no size box. Available with Appearance 1.0 and later. The corresponding pre-Appearance window definition ID is
zoomNoGrow.Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowFullZoomGrowDocumentProcAppearance-compliant window with full zoom box and size box. Available with Appearance 1.0 and later. The corresponding pre-Appearance window definition ID is
zoomDocProc.Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowPlainDialogProcAppearance-compliant modeless dialog box. Available with Appearance 1.0 and later. The corresponding pre-Appearance window definition ID is
plainDBox.Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowShadowDialogProcAppearance-compliant modeless dialog box with shadow. Available with Appearance 1.0 and later. The corresponding pre-Appearance window definition ID is
altDBoxProc.Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowModalDialogProcAppearance-compliant modal dialog box. Available with Appearance 1.0 and later. The corresponding pre-Appearance window definition ID is
dBoxProc.Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowMovableModalDialogProcAppearance-compliant movable modal dialog box. Available with Appearance 1.0 and later. The corresponding pre-Appearance window definition ID is
movableDBoxProc.Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowAlertProcAppearance-compliant alert box. Available with Appearance 1.0 and later. There is no corresponding pre-Appearance window definition ID.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowMovableAlertProcAppearance-compliant movable alert box. Available with Appearance 1.0 and later. There is no corresponding pre-Appearance window definition ID.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowMovableModalGrowProcAppearance-compliant movable modal dialog box with size box. Available with Appearance 1.0.1 and later. There is no corresponding pre-Appearance window definition ID.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowFloatProcAppearance-compliant utility (floating) window with no size box or zoom box. Available with Appearance 1.0 and later. The corresponding pre-Appearance window definition ID is
floatProc.Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowFloatGrowProcAppearance-compliant utility (floating) window with a size box. Available with Appearance 1.0 and later. The corresponding pre-Appearance window definition ID is
floatGrowProc.Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowFloatVertZoomProcAppearance-compliant utility (floating) window with a vertical zoom box. Available with Appearance 1.0 and later. There is no corresponding pre-Appearance window definition ID.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowFloatVertZoomGrowProcAppearance-compliant utility (floating) window with a vertical zoom box and size box. Available with Appearance 1.0 and later. There is no corresponding pre-Appearance window definition ID.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowFloatHorizZoomProcAppearance-compliant utility (floating) window with a horizontal zoom box. Available with Appearance 1.0 and later. There is no corresponding pre-Appearance window definition ID.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowFloatHorizZoomGrowProcAppearance-compliant utility (floating) window with a horizontal zoom box and size box. Available with Appearance 1.0 and later. There is no corresponding pre-Appearance window definition ID.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowFloatFullZoomProcAppearance-compliant utility (floating) window with full zoom box. Available with Appearance 1.0 and later. The corresponding pre-Appearance window definition ID is
floatZoomProc.Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowFloatFullZoomGrowProcAppearance-compliant utility (floating) window with full zoom box and size box. Available with Appearance 1.0 and later. The corresponding pre-Appearance window definition ID is
floatZoomGrowProc.Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowFloatSideProcAppearance-compliant utility (floating) window with side title bar. Available with Appearance 1.0 and later. The corresponding pre-Appearance window definition ID is
floatSideProc.Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowFloatSideGrowProcAppearance-compliant utility (floating) window with side title bar and size box. Available with Appearance 1.0 and later. The corresponding pre-Appearance window definition ID is
floatSideGrowProc.Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowFloatSideVertZoomProcAppearance-compliant utility (floating) window with side title bar and vertical zoom box. Available with Appearance 1.0 and later. There is no corresponding pre-Appearance window definition ID.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowFloatSideVertZoomGrowProcAppearance-compliant utility (floating) window with side title bar, vertical zoom box, and size box. Available with Appearance 1.0 and later. There is no corresponding pre-Appearance window definition ID.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowFloatSideHorizZoomProcAppearance-compliant utility (floating) window with side title bar and horizontal zoom box. Available with Appearance 1.0 and later. There is no corresponding pre-Appearance window definition ID.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowFloatSideHorizZoomGrowProcAppearance-compliant utility (floating) window with side title bar, horizontal zoom box, and size box. Available with Appearance 1.0 and later. There is no corresponding pre-Appearance window definition ID.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowFloatSideFullZoomProcAppearance-compliant utility (floating) window with side title bar and full zoom box. Available with Appearance 1.0 and later. The corresponding pre-Appearance window definition ID is
floatSideZoomProc.Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowFloatSideFullZoomGrowProcAppearance-compliant utility (floating) window with side title bar, full zoom box, and size box. Available with Appearance 1.0 and later. The corresponding pre-Appearance window definition ID is
floatSideZoomGrowProc.Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowSheetProcA standard document sheet.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowSheetAlertProcAn alert sheet.
Available in OS X v10.1 and later.
Declared in
MacWindows.h.kWindowSimpleProcA window that has no structure region; the content covers the entire window.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowSimpleFrameProcA window that has a 1-pixel black frame as its structure.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.
Basic Window Description State Constant
Define the window description state constant.
enum {
kWindowIsCollapsedState = (1 << 0L)
};
Constants
kWindowIsCollapsedStateIf the bit specified by this mask is set, the window is currently collapsed.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.
Discussion
You can use this mask to set a bit in the windowStateFlags field of a structure of type BasicWindowDescription, thereby specifying a transient window state.
Window Frame View Part Codes
HIView part codes used by window frame views.
enum {
kHIWindowTitleBarPart = 2,
kHIWindowDragPart = 3,
kHIWindowTitleProxyIconPart = 2
};
Constants
kHIWindowTitleBarPartIdentifies the title bar part of a window frame view. This part code is used by the functions
GetWindowBoundsandGetWindowRegionwhen called withkWindowTitleBarRgn.Available in OS X v10.5 and later.
Declared in
HIWindowViews.h.kHIWindowDragPartIdentifies the draggable part of a window frame view. This part code is used by
GetWindowBoundsandGetWindowRegionwhen called withkWindowDragRgn.Available in OS X v10.5 and later.
Declared in
HIWindowViews.h.kHIWindowTitleProxyIconPartIdentifies the proxy icon part of a window frame title view. The title view is a subview of the window frame view and is identified by an HIViewID of
kHIViewWindowTitleID. This part code is not used by the window frame view itself, but only by the title view. This part code is used byGetWindowBoundsandGetWindowRegionwhen called withkWindowTitleProxyIconRgn.Available in OS X v10.5 and later.
Declared in
HIWindowViews.h.
Discussion
These part codes are used by an HIView that implements the frame of a window. They may be used with the standard document windows provided by the Window Manager. A custom window frame view may optionally (but is not required to) implement these part codes in its event handlers for kEventControlGetPartRegion and kEventControlGetPartBounds.
Window Feature Bits
Specify features available in a window.
enum {
kWindowCanGrow = (1 << 0),
kWindowCanZoom = (1 << 1),
kWindowCanCollapse = (1 << 2),
kWindowIsModal = (1 << 3),
kWindowCanGetWindowRegion = (1 << 4),
kWindowIsAlert = (1 << 5),
kWindowHasTitleBar = (1 << 6),
kWindowSupportsDragHilite = (1 << 7),
kWindowSupportsModifiedBit = (1 << 8),
kWindowCanDrawInCurrentPort = (1 << 9),
kWindowCanSetupProxyDragImage = (1 << 10),
kWindowCanMeasureTitle = (1 << 11),
kWindowWantsDisposeAtProcessDeath = (1 << 12),
kWindowSupportsGetGrowImageRegion = (1 << 13),
kWindowIsOpaque = (1 << 14),
kWindowDefSupportsColorGrafPort = 0x40000002
};
Constants
kWindowCanGrowIf this bit (bit 0) is set, the window has a grow box (may not be visible).
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowCanZoomIf this bit (bit 1) is set, the window has a zoom box (may not be visible).
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowCanCollapseIf this bit (bit 2) is set, the window has a collapse box.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowIsModalIf this bit (bit 3) is set, the window should behave as modal.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowCanGetWindowRegionIf this bit (bit 4) is set, the window supports a call to
GetWindowRegion.Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowIsAlertIf this bit (bit 5) is set, the window is an alert box (may be movable or not). When this constant is added to
kWindowIsModal, the user should be able to switch out of the application and move the alert box.Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowHasTitleBarIf this bit (bit 6) is set, the window has a title bar.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowSupportsDragHiliteIf the bit specified by this mask is set, the window supports the
kWindowMsgDragHilitemessage. (Mac OS 8.5 and later.)Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowSupportsModifiedBitIf the bit specified by this mask is set, the window supports the
kWindowMsgModifiedmessage. (Mac OS 8.5 and later.)Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowCanDrawInCurrentPortIf the bit specified by this mask is set, the window supports the
kWindowMsgDrawInCurrentPortmessage. (Mac OS 8.5 and later.)Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowCanSetupProxyDragImageIf the bit specified by this mask is set, the window supports the
kWindowMsgSetupProxyDragImagemessage. (Mac OS 8.5 and later.)Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowCanMeasureTitleIf the bit specified by this mask is set, the window supports the
kWindowMsgMeasureTitlemessage. (Mac OS 8.5 and later.)Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowWantsDisposeAtProcessDeathIf the bit specified by this mask is set, the window definition function wants to receive a
wDisposemessage for the window if it still exists when the application quits.Previously, the Window Manager would send a
wDisposemessage only if the application explicitly closed the window with calls to theCloseWindoworDisposeWindowfunctions. The Window Manager would delete a window that still existed when the application calledExitToShellwithout notifying the window definition function, as part of the destruction of the process.Note that if a window has the
kWindowWantsDisposeAtProcessDeathfeature bit set, the Window Manager sends your window definition function awDisposemessage for the window when the application exits for any cause, including if your application crashes.A window might want to set this feature flag if it allocates data when it is initialized that lives outside of the application heap and that is not automatically disposed when the application quits. The
wDisposemessage is sent very early in the termination process, so it is still safe for the window definition function to call the system back (for example, you may want to do this in order to dispose of any auxiliary data). However, to ensure compatibility and to create the minimum performance impact, the window definition function should try to do as little as possible after receiving awDisposemessage sent during the termination process. (Mac OS 8.5 and later.)This feature is only available in Mac OS 8 and 9. It is not supported in Mac OS X.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowSupportsGetGrowImageRegion(Mac OS 8.5 and later.)
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowIsOpaqueIndicates that the window is entirely opaque. If this feature bit is set, the window will use less memory because no alpha channel information will be stored for the window's pixels.
Available in OS X v10.1 and later.
Declared in
MacWindows.h.kWindowDefSupportsColorGrafPortIndicates that the window definition does not require that the current port be the classic Window Manager port. Not supported in Mac OS X.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.
Discussion
For descriptions of the messages that correspond to these feature flags, see “Window Definition Message Constants.”
Window Part Code Constants
Indicate which part of the window was hit.
typedef SInt16 WindowPartCode;
enum {
inDesk = 0,
inNoWindow = 0,
inMenuBar = 1,
inSysWindow = 2,
inContent = 3,
inDrag = 4,
inGrow = 5,
inGoAway = 6,
inZoomIn = 7,
inZoomOut = 8,
inCollapseBox = 11,
inProxyIcon = 12,
inToolbarButton = 13,
inStructure = 15
};
Constants
inDeskThe cursor is in the desktop region, not in the menu bar, a driver window, or any window that belongs to your application. When
FindWindowreturnsinDesk, your application doesn’t need to do anything.Available in OS X v10.0 and later.
Declared in
MacWindows.h.inNoWindowThe cursor is not in a window.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.inMenuBarThe user has pressed the mouse button while the cursor is in the menu bar. When
FindWindowreturnsinMenuBar, your application typically adjusts its menus and then calls the Menu Manager functionMenuSelectto let the user choose menu items.Available in OS X v10.0 and later.
Declared in
MacWindows.h.inSysWindowNot supported by Carbon.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.inContentThe user has pressed the mouse button while the cursor is in the content area (excluding the size box in an active window) of one of your application’s windows. When
FindWindowreturnsinContent, your application determines how to handle clicks in the content region.Available in OS X v10.0 and later.
Declared in
MacWindows.h.inDragThe user has pressed the mouse button while the cursor is in the drag region of a window. When
FindWindowreturnsinDrag, your application typically callsDragWindowto let the user drag the window to a new location.Available in OS X v10.0 and later.
Declared in
MacWindows.h.inGrowThe user has pressed the mouse button while the cursor is in an active window’s size box. When
FindWindowreturnsinGrow, your application typically callsResizeWindow.Available in OS X v10.0 and later.
Declared in
MacWindows.h.inGoAwayThe user has pressed the mouse button while the cursor is in an active window’s close box. When
FindWindowreturnsinGoAway, your application typically callsTrackGoAwayto track mouse activity while the button is down and then calls its own function for closing a window if the user releases the button while the cursor is in the close box.Available in OS X v10.0 and later.
Declared in
MacWindows.h.inZoomInThe user has pressed the mouse button while the cursor is in the zoom box of an active window that is currently in the standard state. When
FindWindowreturnsinZoomIn, your application typically callsTrackBoxto track mouse activity while the button is down and then calls its own function for zooming a window if the user releases the button while the cursor is in the zoom box.Available in OS X v10.0 and later.
Declared in
MacWindows.h.inZoomOutThe user has pressed the mouse button while the cursor is in the zoom box of an active window that is currently in the user state. When
FindWindowreturnsinZoomOut, your application typically calls the functionTrackBoxto track mouse activity while the button is down. Your application then calls its own function for zooming a window if the user releases the button while the cursor is in the zoom box.Available in OS X v10.0 and later.
Declared in
MacWindows.h.inCollapseBoxThe user has pressed the mouse button while the cursor is in an active window’s collapse box. When
FindWindowreturnsinCollapseBox, your application typically does nothing, because the system will collapse your window for you.Available in OS X v10.0 and later.
Declared in
MacWindows.h.inProxyIconThe user has pressed the mouse button while the cursor is in the proxy icon of a window. When
FindWindowreturnsinProxyIcon, your application typically calls the functionTrackWindowProxyDrag.Available in OS X v10.0 and later.
Declared in
MacWindows.h.inToolbarButtonThe user has pressed the mouse button while the cursor is in the toolbar button. (Mac OS X only.)
Available in OS X v10.1 and later.
Declared in
MacWindows.h.inStructureThe user has pressed the mouse button while the cursor is in the window’s structure region.
Available in OS X v10.1 and later.
Declared in
MacWindows.h.
Discussion
When your application receives a mouse-down event, you typically call FindWindow, which returns an integer that specifies the location, in global coordinates, of the cursor at the time the user pressed the mouse button.
Window Modality Options
Specify the modality of a window.
typedef UInt32 WindowModality;
enum {
kWindowModalityNone = 0,
kWindowModalitySystemModal = 1,
kWindowModalityAppModal = 2,
kWindowModalityWindowModal = 3
};
Constants
kWindowModalityNoneA window does not prevent interaction with any other window in the system.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowModalitySystemModalThe window is system-modal. In Mac OS 9 and earlier, the user cannot perform any other action until the window is dismissed. In Mac OS X, this constant produces the same behavior as
kWindowModalityAppModal, so there is no way to prevent the user from interacting with windows from other applications.Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowModalityAppModalThe window is application-modal; that is the user cannot perform any other action within the application until the window is dismissed. The user can switch to other applications, however.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowModalityWindowModalThe window is document-modal; the user cannot perform any other action within the current document window until the modal window associated with it is dismissed. The user can switch to other windows or applications, however. Sheets are document-modal.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.
Window Position Constants
Define where to place a window.
typedef UInt32 WindowPositionMethod;
enum {
kWindowCenterOnMainScreen = 1,
kWindowCenterOnParentWindow = 2,
kWindowCenterOnParentWindowScreen = 3,
kWindowCascadeOnMainScreen = 4,
kWindowCascadeOnParentWindow = 5,
kWindowCascadeOnParentWindowScreen = 6,
kWindowCascadeStartAtParentWindowScreen = 10,
kWindowAlertPositionOnMainScreen = 7,
kWindowAlertPositionOnParentWindow = 8,
kWindowAlertPositionOnParentWindowScreen = 9
};
Constants
kWindowCenterOnMainScreenCenter the window, both horizontally and vertically, on the screen that contains the menu bar.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowCenterOnParentWindowCenter the window, both horizontally and vertically, on the parent window. If the window to be centered is wider than the parent window, its left edge is aligned with the parent window’s left edge.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowCenterOnParentWindowScreenCenter the window, both horizontally and vertically, on the screen containing the parent window. In Mac OS X v10.3 and later, the parent window may be the same as the positioned window. In CarbonLib and earlier versions of Mac OS X, the parent window must be different from the positioned window.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowCascadeOnMainScreenPlace the window just below the menu bar at the left edge of the main screen. Subsequent windows are placed on the screen relative to the first window, such that the frame of the preceding window remains visible behind the current window. The exact amount by which windows are offset depends upon the dimensions of the window frame under a given appearance.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowCascadeOnParentWindowPlace the window a distance below and to the right of the upper-left corner of the parent window such that the frame of the parent window remains visible behind the current window. The exact amount by which windows are offset depends upon the dimensions of the window frame under a given appearance.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowCascadeOnParentWindowScreenPlace the window just below the menu bar at the left edge of the screen containing the parent window. Subsequent windows are placed on the screen relative to the first window, such that the frame of the preceding window remains visible behind the current window. The exact amount by which windows are offset depends upon the dimensions of the window frame under a given appearance. In Mac OS X v10.3 and later, the parent window may be the same as the positioned window. In CarbonLib and earlier versions of Mac OS X, the parent window must be different from the positioned window.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowCascadeStartAtParentWindowScreenCascade the window on the screen containing the largest portion of its parent window, starting below and to the right of its parent window. The parent window must be different from the positioned window. (Available in Mac OS X v10.2 and CarbonLib 1.6 and later.)
Available in OS X v10.2 and later.
Declared in
MacWindows.h.kWindowAlertPositionOnMainScreenCenter the window horizontally and position it vertically on the screen that contains the menu bar, such that about one-fifth of the screen is above it. In Mac OS X v10.3 and later, the parent window may be the same as the positioned window. In CarbonLib and earlier versions of Mac OS X, the parent window must be different from the positioned window.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowAlertPositionOnParentWindowCenter the window horizontally and position it vertically such that about one-fifth of the parent window is above it.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowAlertPositionOnParentWindowScreenCenter the window horizontally and position it vertically such that about one-fifth of the screen containing the parent window is above it.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.
Discussion
To specify the factors that determine how a window should be positioned, you supply one of these WindowPositionMethod constants to the function RepositionWindow or in the BasicWindowDescription structure of a resource of type ‘wind’. Do not confuse the WindowPositionMethod constants with the pre–Mac OS 8.5 Window Manager window positioning constants or use the WindowPositionMethod constants where the older constants are required (such as in the StandardAlert function or in 'WIND', 'DLOG', or 'ALRT' resources).
System 7 Window Positioning Constants
Define window positioning constants used in 'WIND', 'DLOG', or 'ALRT' resources, as well as the StandardAlert function.
enum {
kWindowNoPosition = 0x0000,
kWindowDefaultPosition = 0x0000,
kWindowCenterMainScreen = 0x280A,
kWindowAlertPositionMainScreen = 0x300A,
kWindowStaggerMainScreen = 0x380A,
kWindowCenterParentWindow = 0xA80A,
kWindowAlertPositionParentWindow = 0xB00A,
kWindowStaggerParentWindow = 0xB80A,
kWindowCenterParentWindowScreen = 0x680A,
kWindowAlertPositionParentWindowScreen = 0x700A,
kWindowStaggerParentWindowScreen = 0x780A
};
Constants
kWindowNoPositionNo position.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowDefaultPositionUse the initial location.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowCenterMainScreenCenter the window on the main screen.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowAlertPositionMainScreenPlace the window in the alert position on the main screen.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowStaggerMainScreenStagger the window on the main screen.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowCenterParentWindowCenter the window on the parent window.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowAlertPositionParentWindowPlace the window in the alert position on the parent window.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowStaggerParentWindowStagger the window relative to the parent window.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowCenterParentWindowScreenCenter the window on the parent window screen.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowAlertPositionParentWindowScreenPlace the window in the alert position on the parent window screen.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowStaggerParentWindowScreenStagger the window on the parent window screen.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.
Discussion
You can use these constants in the optional positioning specification field of the window resource and in the dialog resource to override the window position established by the rectangle specified for the window or dialog. These positioning constants are convenient when the user is creating new documents or when you are handling your own dialog boxes and alert boxes.
These constants are passed into the StandardAlert function and are used in' WIND', 'DLOG’, and 'ALRT' templates. StandardAlert uses zero to specify the default position. Other calls use zero to specify “no position”.
Do not pass these constants to theRepositionWindow function or store these constants in the BasicWindowDescription structure of a 'WIND' resource.
The meaning of the terms used in the window positioning constant descriptions are as follows:
center
Centered both horizontally and vertically, relative either to a screen or to another window (if a window to be centered relative to another window is wider than the window that preceded it, it is pinned to the left edge; a narrower window is centered)
stagger
Located 20 pixels to the right and 20 pixels below the upper-left corner of the last window (in the case of staggering relative to a screen, the first window is placed just below the menu bar at the left edge of the screen, and subsequent windows are placed on that screen relative to the first window)
alert position
Centered horizontally and placed in the “alert position” vertically, that is, with about one-fifth of the window or screen above the new window and the rest below
parent window
Place in the position of the window in which the user was last working based on the frontmost window before the new window comes up.
Window Region Constants
Define various window regions.
typedef UInt16 WindowRegionCode;
enum {
kWindowTitleBarRgn = 0,
kWindowTitleTextRgn = 1,
kWindowCloseBoxRgn = 2,
kWindowZoomBoxRgn = 3,
kWindowDragRgn = 5,
kWindowGrowRgn = 6,
kWindowCollapseBoxRgn = 7,
kWindowTitleProxyIconRgn = 8,
kWindowStructureRgn = 32,
kWindowContentRgn = 33,
kWindowUpdateRgn = 34,
kWindowOpaqueRgn = 35,
kWindowGlobalPortRgn = 40,
kWindowToolbarButtonRgn = 41
};
Constants
kWindowTitleBarRgnThe entire area occupied by a window’s title bar, including the title text region.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowTitleTextRgnThat portion of a window’s title bar that is occupied by the name of the window.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowCloseBoxRgnThe area occupied by a window’s close box.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowZoomBoxRgnThe area occupied by a window’s zoom box.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowDragRgnThe draggable area of the window frame; this area includes the title bar and window outline and excludes the size box, close box, zoom box, and collapse box.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowGrowRgnThe area occupied by a window’s size box.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowCollapseBoxRgnThe area occupied by a window’s collapse box.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowTitleProxyIconRgnSpecifies the region in the window’s title area that contains the proxy icon. The proxy icon region is always located within the window’s title text region.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowStructureRgnThe entire area occupied by a window, including the frame and content region; the window may be partially off-screen but its structure region does not change.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowContentRgnThe window’s content region—the part of a window in which your application displays the contents of the window or dialog, including the size box and any controls.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowUpdateRgnThe window’s update region––the part of the window that needs to be redrawn.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowOpaqueRgnArea of window considered to be opaque. Only valid for windows with alpha channels. (Mac OS X only)
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowGlobalPortRgnBounds of the window’s port in global coordinates; not affected by
CollapseWindow.Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowToolbarButtonRgnBounds of the toolbar button area.
Available in OS X v10.4 and later.
Declared in
MacWindows.h.
Discussion
You can pass constants of type WindowRegionCode in the inRegionCode parameter of GetWindowRegion to obtain a handle to a specific window region. The WindowRegionCode constants are available with Appearance Manager 1.0 and later.
Version Notes
With the Window Manager in Mac OS 8.5 and later, you may pass the kWindowTitleProxyIconRgn, kWindowStructureRgn, and kWindowContentRgn constants to the function GetWindowRegion.
Window Latent Visibility Constants
Defines window latent visibility constants.
typedef UInt32 WindowLatentVisibility;
enum {
kWindowLatentVisibleFloater = 1 << 0,
kWindowLatentVisibleSuspend = 1 << 1,
kWindowLatentVisibleFullScreen = 1 << 2,
kWindowLatentVisibleAppHidden = 1 << 3,
kWindowLatentVisibleCollapsedOwner = 1 << 4,
kWindowLatentVisibleCollapsedGroup = 1 << 5
};
Constants
kWindowLatentVisibleFloaterThe window is a floating window, and floating windows are hidden.
Available in OS X v10.1 and later.
Declared in
MacWindows.h.kWindowLatentVisibleSuspendThe window has
kWindowHideOnSuspendAttributeset and the application is suspended.Available in OS X v10.1 and later.
Declared in
MacWindows.h.kWindowLatentVisibleFullScreenThe window has
kWindowHideOnFullScreenAttributeset and the mode is full-screen.Available in OS X v10.1 and later.
Declared in
MacWindows.h.kWindowLatentVisibleAppHiddenThe window’s process is hidden.
Available in OS X v10.1 and later.
Declared in
MacWindows.h.kWindowLatentVisibleCollapsedOwnerThe window is in an owned group, and the owner was collapsed.
Available in OS X v10.1 and later.
Declared in
MacWindows.h.kWindowLatentVisibleCollapsedGroupThe window is in a group for which
kWindowGroupAttrHideOnCollapseis set, and another window in the group was collapsed.Available in OS X v10.1 and later.
Declared in
MacWindows.h.
Basic Window Description Version Constants
Describe different Mac OS window versions.
enum {
kWindowDefinitionVersionOne = 1,
kWindowDefinitionVersionTwo = 2
};
Constants
kWindowDefinitionVersionOneSpecifies a pre–Mac OS 8.5 Window Manager window. Windows of this version are created using a window definition ID and a Boolean value indicating whether or not the window has a close box.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowDefinitionVersionTwoSpecifies a Mac OS 8.5 Window Manager window. Windows of this version are created using class and attribute information. For details on classes and attributes, see “Window Class Constants” and “Window Attributes” respectively.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.
Discussion
You may supply one of these values in the windowDefinitionVersion field of a structure of type BasicWindowDescription to specify the version of the window definition used for a window.
Window Property Persistent Constant
Define the window property persistent constant.
enum {
kWindowPropertyPersistent = 0x00000001
};
Constants
kWindowPropertyPersistentIndicates this property gets saved when the window is archived. Note, however, that window properties are not archived at all in Mac OS X v10.4.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.
Window Variant Constants
Specify window variants.
enum {
kDocumentWindowVariantCode = 0,
kModalDialogVariantCode = 1,
kPlainDialogVariantCode = 2,
kShadowDialogVariantCode = 3,
kMovableModalDialogVariantCode = 5,
kAlertVariantCode = 7,
kMovableAlertVariantCode = 9,
kSideFloaterVariantCode = 8
};
Constants
kDocumentWindowVariantCodeVariation code for a document window.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kModalDialogVariantCodeVariation code for modal dialog boxes. The code can be added to 16 x the resource ID constant
kStandardWindowDefinitionto create a standard, pre-Appearance modal dialog box window.Available in OS X v10.0 and later.
Declared in
MacWindows.h.kPlainDialogVariantCodeVariation code for a plain dialog box.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kShadowDialogVariantCodeVariation code for a shadow dialog box.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kMovableModalDialogVariantCodeVariation code for movable modal dialog boxes. The code can be added to 16 x the resource ID constant
kStandardWindowDefinitionto create a standard, pre-Appearance movable modal dialog box.Available in OS X v10.0 and later.
Declared in
MacWindows.h.kAlertVariantCodeVariation code for a standard alert box.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kMovableAlertVariantCodeVariation code for a movable alert box.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kSideFloaterVariantCodeVariation code for utility (floating) windows with a side title bar. The code can be added to 16 x the resource ID constant
kFloatingWindowDefinitionto create a standard, pre-Appearance utility (floating) window with a side title bar.Available in OS X v10.0 and later.
Declared in
MacWindows.h.
Window Transition Action Constants
Specify the type of window action taking place.
typedef UInt32 WindowTransitionAction;
enum {
kWindowShowTransitionAction = 1,
kWindowHideTransitionAction = 2,
kWindowMoveTransitionAction = 3,
kWindowResizeTransitionAction = 4
};
Constants
kWindowShowTransitionActionSpecifies that the animation display the window opening, that is, transitioning from a closed to an open state.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowHideTransitionActionSpecifies that the animation display the window closing, that is, transitioning from an open to a closed state.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowMoveTransitionActionMoves the window. Use with the Slide transition effect. The
inRectparameter contains the global coordinates of the window’s new structure bounds and cannot beNULL. (Available in Mac OS X, and in CarbonLib 1.5 and later.)Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowResizeTransitionActionResizes the window. Use with the Slide transition effect. The
inRectparameter contains the global coordinates of the window’s new structure bounds and cannot beNULL. (Available in Mac OS X and in CarbonLib 1.5 and later.)Available in OS X v10.0 and later.
Declared in
MacWindows.h.
Discussion
You may pass these WindowTransitionAction constants to the function TransitionWindow to specify the direction of the animation effect that is to be performed for a window.
Window Transition Effect Constants
Designate the type of transition effect to use to show or hide the window.
typedef UInt32 WindowTransitionEffect;
enum {
kWindowZoomTransitionEffect = 1,
kWindowSheetTransitionEffect = 2,
kWindowSlideTransitionEffect = 3,
kWindowFadeTransitionEffect = 4,
kWindowGenieTransitionEffect = 5
};
Constants
kWindowZoomTransitionEffectSpecifies an animation that displays the window zooming between the open and closed states. The direction of the animation, whether from open to closed, or closed to open, depends upon the
WindowTransitionActionconstant specified in conjunction with theWindowTransitionEffectconstant; see“Window Transition Action Constants” for descriptions of possible values.Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowSheetTransitionEffectZoom in or out from the parent window. Use with
TransitionWindowAndParentand Show or Hide transition actions. (Available in Mac OS X, and in CarbonLib 1.5 and later.)Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowSlideTransitionEffectSlide the window into its new position. Use with
TransitionWindowand Move or Resize transition actions. (Available in Mac OS X and in CarbonLib 1.5 and later.)Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowFadeTransitionEffectFade the window into or out of visibility. Use with the Show or Hide transition action. (Available in Mac OS X v10.3 and later.)
Available in OS X v10.3 and later.
Declared in
MacWindows.h.kWindowGenieTransitionEffectUse the Genie effect that the Dock uses to minimize or maximize a window to show or hide the window. Use with the Show or Hide transition action. (Available in Mac OS X v10.3 and later.)
Available in OS X v10.3 and later.
Declared in
MacWindows.h.
Discussion
You may pass this WindowTransitionEffect constant to the function TransitionWindow to specify the type of animation effect that is to be performed for a window.
Window Activation Scope Constants
Defines window activation scope constants.
typedef UInt32 WindowActivationScope;
enum {
kWindowActivationScopeNone = 0,
kWindowActivationScopeIndependent = 1,
kWindowActivationScopeAll = 2
};
Constants
kWindowActivationScopeNoneWindows with this scope are never activated by the Window Manager. Use
kWindowActivationScopeNonewhen the window’s visual state does not change based on activation (for example, tooltip windows), or when the client wants to manually control all activation. The window owner is free to explicitly activate or deactivate a window by callingActivateWindow.Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowActivationScopeIndependentWindows with this scope are always active if visible and are unaffected by the activation state of other windows. This activation scope is automatically used by floating windows.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowActivationScopeAllWindows with this scope are activated relative to other windows with the same scope in the current process. Only one window with this scope can be active in the entire process. This activation scope is automatically used by document and dialog windows.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.
Window Constrain Options
Constrain options for window resize, growing, and so on.
typedef UInt32 WindowConstrainOptions;
enum {
kWindowConstrainMayResize = (1L << 0),
kWindowConstrainMoveRegardlessOfFit = (1L << 1),
kWindowConstrainAllowPartial = (1L << 2),
kWindowConstrainCalcOnly = (1L << 3),
kWindowConstrainUseTransitionWindow = (1L << 4),
kWindowConstrainMoveMinimum = 1 << 6,
kWindowConstrainUseSpecifiedBounds = 1 << 8,
kWindowConstrainStandardOptions = kWindowConstrainMoveRegardlessOfFit
};
Constants
kWindowConstrainMayResizeThe window may be resized if necessary to make it fit onscreen.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowConstrainMoveRegardlessOfFitThe window may be moved even if it doesn’t fit entirely onscreen.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowConstrainAllowPartialAllow partial intersection of the specified window region with the screen instead of requiring total intersection.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowConstrainCalcOnlyCalculate the new window bounds but don’t actually move the window.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowConstrainUseTransitionWindowUse
TransitionWindowwithkWindowSlideTransitionEffectto move windows onscreen.Available in OS X v10.2 and later.
Declared in
MacWindows.h.kWindowConstrainMoveMinimumMove the window the minimum amount necessary to be onscreen. This option is only supported by the function
HIWindowConstrain. This option applies if a partial fit is not allowed (kWindowConstrainAllowPartialis not specified) or a partial fit is allowed, but the window is not even partially visible. In either case, the window will be moved just enough to be slightly onscreen. You may customize the minimum amount that is required to be visible by passing the desired dimensions in theinMinimumSizeparameter toHIWindowConstrain.Available in OS X v10.5 and later.
Declared in
MacWindows.h.kWindowConstrainUseSpecifiedBoundsUse the specified bounds of the window region to be constrained. This option is only supported by the function
HIWindowConstrain. The bounds are specified using theioBoundsparameter, allowing you to constrain a window to a hypothetical location. For example, if you plan to move your window such that its content region is at a certain location, and you want to know in advance before moving the window whether the window would be offscreen at that location, you can use this option.Available in OS X v10.5 and later.
Declared in
MacWindows.h.kWindowConstrainStandardOptionsUse the most common options: don’t resize the window, move the window regardless of fit to the screen, require total intersection of the specified window region with the screen, and move the window.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.
Window Kinds
Identify how a window was created.
enum {
dialogKind = 2,
userKind = 8,
kDialogWindowKind = 2,
kApplicationWindowKind = 8
};
Constants
dialogKindObsolete equivalent to
kDialogWindowKind.Available in OS X v10.0 and later.
Declared in
MacWindows.h.userKindObsolete equivalent to
kApplicationWindowKind.Available in OS X v10.0 and later.
Declared in
MacWindows.h.kDialogWindowKindIdentifies all dialog or alert windows, whether created by system software or, indirectly through the Dialog Manager, by your application. The Dialog Manager uses this field to track dialog and alert windows.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kApplicationWindowKindIdentifies a window created directly by your application.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.
Discussion
The Window Manager uses these constants in the windowKind field of a color window structure or window structure. Your application can use any value greater than 7.
Window Group Selection Constants
Indicate which window group to select.
enum {
kNextWindowGroup = true,
kPreviousWindowGroup = false
};
Constants
kNextWindowGroupMove to the next window group (in the z-order).
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kPreviousWindowGroupMove to the previous window group (in the z-order).
Available in OS X v10.0 and later.
Declared in
MacWindows.h.
Window Group Attributes
Define attributes for window groups.
typedef UInt32 WindowGroupAttributes;
enum {
kWindowGroupAttrSelectAsLayer = 1 << 0,
kWindowGroupAttrMoveTogether = 1 << 1,
kWindowGroupAttrLayerTogether = 1 << 2,
kWindowGroupAttrSharedActivation = 1 << 3,
kWindowGroupAttrHideOnCollapse = 1 << 4,
kWindowGroupAttrFixedLevel = 1 << 5
};
Constants
kWindowGroupAttrSelectAsLayerMakes the group behave somewhat as a layer of windows that move together. When any window in the group is brought to the front of the group, the entire group will also be brought to the front of the containing group’s child hierarchy. Use of this constant is not recommended; its behavior is rarely useful.
Available in OS X v10.1 and later.
Declared in
MacWindows.h.kWindowGroupAttrMoveTogetherThe positions of the contents of this group with respect to each other cannot be changed. When one item moves, all other items are moved simultaneously. Note that if one window’s position is changed by calling a Window Manager function in Mac OS X v10.4 and later, the positions of the other windows in the group are updated asynchronously—that is, their bounds are not necessarily updated during the function call itself, even though visually the windows move together.
Available in OS X v10.1 and later.
Declared in
MacWindows.h.kWindowGroupAttrLayerTogetherThe z-order of the contents of this group with respect to each other cannot be changed. When one item changes z-order, all other items are moved simultaneously. For purposes of z-ordering, the group and all its subgroups are effectively treated as if they were a single window in the parent group of this group.
Available in OS X v10.1 and later.
Declared in
MacWindows.h.kWindowGroupAttrSharedActivationThe active state of the windows in this group is shared. The windows in the group are activated or deactivated according to the activation scope of the group, but when any window in the group changes activation, all other windows change to match.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowGroupAttrHideOnCollapseWhen any window in this group is collapsed, all other windows in this group are hidden. All subgroups of this group are also examined for this attribute, and any the windows of any subgroup with this attribute are also hidden. All windows will be shown again when the collapsed window is expanded.
Available in OS X v10.1 and later.
Declared in
MacWindows.h.kWindowGroupAttrFixedLevelIf this attribute is specified, this window group’s window level should be left unchanged. If this attribute is not specified, this window group’s window level will be promoted to a value equal to the level of the next fixed-level window group beneath it in the window group hierarchy. (Available in Mac OS X v10.4 and later.)
Available in OS X v10.4 and later.
Declared in
MacWindows.h.
Version Notes
In Mac OS X v10.2.4 and later, the HIToolbox framework improved its use of the window group API so that showing a sheet on a window that was already grouped with another window would not break the existing grouping. To make this change work properly, applications that create their own window groups using the kWindowGroupAttrMoveTogether and kWindowGroupAttrLayerTogether attributes should also specify the kWindowGroupAttrHideOnCollapse and kWindowGroupAttrSharedActivation attributes.
Obsolete Window Group Attributes
Define obsolete window group attribute names.
enum {
kWindowGroupAttrSelectable = kWindowGroupAttrSelectAsLayer,
kWindowGroupAttrPositionFixed = kWindowGroupAttrMoveTogether,
kWindowGroupAttrZOrderFixed = kWindowGroupAttrLayerTogether
};
Constants
kWindowGroupAttrSelectableObsolete name for
kWindowGroupAttrSelectAsLayer.Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowGroupAttrPositionFixedObsolete name; use
kWindowGroupAttrMoveTogetherinstead.Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowGroupAttrZOrderFixedObsolete name; use
kWindowGroupAttrLayerTogetherinstead.Available in OS X v10.0 and later.
Declared in
MacWindows.h.
Window Group Content Options
Window group counting options.
typedef UInt32 WindowGroupContentOptions;
enum {
kWindowGroupContentsReturnWindows = 1 << 0,
kWindowGroupContentsRecurse = 1 << 1,
kWindowGroupContentsVisible = 1 << 2
};
Constants
kWindowGroupContentsReturnWindowsCount only windows in the window group.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowGroupContentsRecurseRecursively count windows of any subgroups of windows in the specified window group.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowGroupContentsVisibleCounts only visible windows.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.
Discussion
You use these constants with the CountWindowGroupContents function.
Window Class Position Constants
Specify which window in the class to select.
enum {
kFirstWindowOfClass = -1,
kLastWindowOfClass = 0
};
Constants
kFirstWindowOfClassSelect the first window in the class.
kLastWindowOfClassSelect the last window in the class.
Discussion
These constants describe special cases for the “behind” parameter in window creation calls.
Window Definition Type Constants
Defines the type of custom window definition.
typedef UInt32 WindowDefType;
enum {
kWindowDefProcPtr = 0,
kWindowDefObjectClass = 1,
kWindowDefProcID = 2,
kWindowDefHIView = 3
};
Constants
kWindowDefProcPtrThe definition is procedure pointer–based.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowDefObjectClassThe definition is a toolbox object.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowDefProcIDAn ID that identifies a particular
‘WDEF’and would typically be one of the constants described in “Appearance-Compliant Window Definition ID Constants.”Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowDefHIViewThe definition is an HIView-based object.
Available in OS X v10.2 and later.
Declared in
MacWindows.h.
Window Definition Procedure Constant
Define the window definition procedure constant.
enum {
kWindowDefProcType = 'WDEF'
};
Constants
kWindowDefProcTypeWindow definition type.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.
Window Definition Hit Test Result Code Constants
Defines result constants to be used by window definition hit testing.
typedef SInt16 WindowDefPartCode;
enum {
wNoHit = 0,
wInContent = 1,
wInDrag = 2,
wInGrow = 3,
wInGoAway = 4,
wInZoomIn = 5,
wInZoomOut = 6,
wInCollapseBox = 9,
wInProxyIcon = 10,
wInToolbarButton = 11,
wInStructure = 13
};
Constants
wNoHitThe mouse-down event did not occur in the content region or the drag region of any active or inactive window or in the close, size, zoom, or collapse box of an active window. The return value
wNoHitmight also mean that the point isn’t in the window. The standard window definition functions, for example, returnwNoHitif the point is in the window frame but not in the title bar.Available in OS X v10.0 and later.
Declared in
MacWindows.h.wInContentThe mouse-down event occurred in the content region of an active or inactive window (with the exception of the size box).
Available in OS X v10.0 and later.
Declared in
MacWindows.h.wInDragThe mouse-down event occurred in the drag region of an active or inactive window.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.wInGrowThe mouse-down occurred in the size box of an active window.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.wInGoAwayThe mouse-down event occurred in the close box of an active window.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.wInZoomInThe mouse-down event occurred in the zoom box of an active window that is currently in the standard state.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.wInZoomOutThe mouse-down event occurred in the zoom box of an active window that is currently in the user state.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.wInCollapseBoxThe mouse-down event occurred in the collapse box of an active window.
Available with Appearance Manager 1.0 and later.
Declared in
MacWindows.h.wInProxyIconThe mouse-down event occurred in the proxy icon of a window.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.wInToolbarButtonThe mouse-down event occurred in the toolbar button.
Available in OS X v10.1 and later.
Declared in
MacWindows.h.wInStructureThe mouse-down event occurred in the window’s structure region.
Available in OS X v10.1 and later.
Declared in
MacWindows.h.
Discussion
In response to the wHit message, your window definition function should return one of these constants.
Return the constants wInGrow, wInGoAway, wInZoomIn, wInZoomOut, and wInCollapseBox only if the window is active—by convention, the size box, close box, zoom box, and collapse box aren’t drawn if the window is inactive. In an inactive document window, for example, a mouse-down event in the part of the title bar that would contain the close box if the window were active is reported as wInDrag.
With the Mac OS 8.5 Window Manager and later, your window definition function may return the wInProxyIcon constant to report that a mouse-down event occurred in your window’s proxy icon.
Window Definition Message Constants
Defines messages sent to non Carbon Event–based window definitions.
enum {
kWindowMsgDraw = 0,
kWindowMsgHitTest = 1,
kWindowMsgCalculateShape = 2,
kWindowMsgInitialize = 3,
kWindowMsgCleanUp = 4,
kWindowMsgDrawGrowOutline = 5,
kWindowMsgDrawGrowBox = 6
};
enum {
kWindowMsgGetFeatures = 7,
kWindowMsgGetRegion = 8
};
enum {
kWindowMsgDragHilite = 9,
kWindowMsgModified = 10,
kWindowMsgDrawInCurrentPort = 11,
kWindowMsgSetupProxyDragImage = 12,
kWindowMsgStateChanged = 13,
kWindowMsgMeasureTitle = 14
};
enum {
kWindowMsgGetGrowImageRegion = 19
};
Constants
kWindowMsgDrawDraw the window’s frame.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowMsgHitTestReport the location of a mouse-down event.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowMsgCalculateShapeCalculate the structure region and the content region.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowMsgInitializePerform additional initialization.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowMsgCleanUpPerform additional disposal.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowMsgDrawGrowOutlineDraw the dotted outline of the window that you see during a resizing operation.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowMsgDrawGrowBoxDraw the outlines for the size box and the scroll bar.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowMsgGetFeaturesReport the window’s features.
Available with Appearance Manager 1.0 and later.
Declared in
MacWindows.h.kWindowMsgGetRegionReport the location of a specific window region.
Available with Appearance Manager 1.0 and later.
Declared in
MacWindows.h.kWindowMsgDragHiliteRedraw the window’s structure region to reflect the window’s validity as a drag-and-drop destination. The Window Manager passes an accompanying Boolean value in your window definition function’s
paramparameter. If the value passed istrue, this indicates that the window’s structure region should be highlighted. If the value passed isfalse, the structure region should be unhighlighted. Your window definition function should return 0 as the function result. (Mac OS 8.5 and later.)Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowMsgModifiedTrack the window’s modification state. The Window Manager sends this message when the function
SetWindowModifiedis called. The Window Manager passes an accompanying Boolean value in your window definition function’sparamparameter. If the value passed istrue, the document contained in the window has been modified. If the value passed isfalse, the document has been saved to disk. You should redraw the window’s structure region to reflect the new modification state, if appropriate. For example, system-defined document windows dim the proxy icon to indicate that the document has been modified by the user and cannot be moved at that time. Your window definition function should return 0 as the function result. (Mac OS 8.5 and later.)Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowMsgDrawInCurrentPortDraw the window’s frame in the current graphics port. Other than restricting drawing to the current port, this message is similar to the pre–Mac OS 8.5 Window Manager window definition message constant
wDraw. (Mac OS 8.5 and later.)Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowMsgSetupProxyDragImageCreate the image of the window’s proxy icon that the Drag Manager uses to represent the icon while it is being dragged. When your application calls the function
TrackWindowProxyDrag, the Window Manager passes this message in your window definition function’smessageparameter and an accompanying pointer to a structure of typeSetupWindowProxyDragImageRecin theparamparameter. Your window definition function is responsible for setting the contents of the structure to contain the data describing the proxy icon’s drag image. Your window definition function should return 0 as the function result. (Mac OS 8.5 and later.)Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowMsgStateChangedBe informed that some aspect of the window’s public state has changed. The Window Manager passes this message in your window definition function’s
messageparameter and an accompanying flag in theparamparameter that indicates what part of the window’s state has been altered. This message is simply a notification message—no response by the window definition function is required. Your window definition function should return 0 as the function result. ThekWindowMsgStateChangedmessage is sent after the window’s internal data has been updated, but before any redraw occurs onscreen. A window definition function should not redraw the window frame in response to this message. If it is necessary to redraw the window frame, the Window Manager notifies the window definition function with awDrawmessage. See “Window Definition State-Changed Constant” for descriptions of the values that the Window Manager can pass to specify the state change that has occurred. (Mac OS 8.5 and later.)Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowMsgMeasureTitleMeasure and return the ideal title width. The Window Manager passes this message in the window definition function’s
messageparameter and an accompanying pointer to a structure of typeMeasureWindowTitleRecin theparamparameter. Your window definition function is responsible for setting the contents of the structure to contain data describing the title width. You should return 0 as the function result. (Mac OS 8.5 and later.)Available in OS X v10.0 and later.
Declared in
MacWindows.h.kWindowMsgGetGrowImageRegionObtain a region to XOR with window during grow or resize. Alter the
GetGrowImageRegionRecstructure passed with the message to the region to be XOR’d. (Available in Carbon only.)
Declared in
MacWindows.h.
Discussion
The Window Manager may pass one of these constants in the message parameter of your window definition function to specify the action that your function must perform. For descriptions of the feature bits that correspond to these messages, see “Window Feature Bits.” Other messages are reserved for internal use by the system.
Window Definition State-Changed Constant
Define the window definition state-changed constant.
enum {
kWindowStateTitleChanged = (1 << 0)
};
Constants
kWindowStateTitleChangedIf the bit specified by this mask is set, the window’s title has changed.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.
Discussion
If you implement a custom window definition function, when the Window Manager passes the kWindowMsgStateChanged message in your window definition function’s message parameter it may also pass a value in the param parameter with one or more bits set to indicate what part of the window’s state has changed. You may use this mask to test this value. For a description of the kWindowMsgStateChanged message, see “Window Definition Message Constants.”
Special Considerations
Drawer State Constants
Define constants that indicate the current drawer state.
typedef UInt32 WindowDrawerState;
enum {
kWindowDrawerOpening = 1,
kWindowDrawerOpen = 2,
kWindowDrawerClosing = 3,
kWindowDrawerClosed = 4
};
Constants
kWindowDrawerOpeningThe drawer is opening.
Available in OS X v10.2 and later.
Declared in
MacWindows.h.kWindowDrawerOpenThe drawer is open.
Available in OS X v10.2 and later.
Declared in
MacWindows.h.kWindowDrawerClosingThe drawer is closing.
Available in OS X v10.2 and later.
Declared in
MacWindows.h.kWindowDrawerClosedThe drawer is closed.
Available in OS X v10.2 and later.
Declared in
MacWindows.h.
Version Notes
Introduced in Mac OS X v10.2.
Window Edge Constants
Specify the edge from which a drawer should appear.
enum {
kWindowEdgeDefault = 0,
kWindowEdgeTop = 1 << 0,
kWindowEdgeLeft = 1 << 1,
kWindowEdgeBottom = 1 << 2,
kWindowEdgeRight = 1 << 3
};
Constants
kWindowEdgeDefaultThe drawer should be opened on whatever edge of the parent window has previously been set as the drawer’s preferred edge.
Available in OS X v10.2 and later.
Declared in
MacWindows.h.kWindowEdgeTopThe drawer should slide out from the top edge.
Available in OS X v10.2 and later.
Declared in
MacWindows.h.kWindowEdgeLeftThe drawer should slide out from the left edge.
Available in OS X v10.2 and later.
Declared in
MacWindows.h.kWindowEdgeBottomThe drawer should slide out from the bottom edge.
Available in OS X v10.2 and later.
Declared in
MacWindows.h.kWindowEdgeRightThe drawer should slide out from the right edge.
Available in OS X v10.2 and later.
Declared in
MacWindows.h.
Rotating Window Menu Item Constant
Indicates whether to add the rotating window item to the Window menu.
enum {
kWindowMenuIncludeRotate = 1 << 0
};
Constants
kWindowMenuIncludeRotateRequests that the standard window menu include a Rotate Windows menu item.
Available in OS X v10.2 and later.
Declared in
MacWindows.h.
Discussion
This constant is used with the function CreateStandardWindowMenu.
Window Menu Item Property Constants
Constants used to access property data of items in the standard window menu.
enum {
kHIWindowMenuCreator = 'wind',
kHIWindowMenuWindowTag = 'wind'
};
Constants
kHIWindowMenuCreatorThe property creator for accessing standard window menu item properties.
Available in OS X v10.5 and later.
Declared in
MacWindows.h.kHIWindowMenuWindowTagThe property tag for accessing standard window menu item properties that hold windows (values of type
WindowRef). Menu items with thekHICommandSelectWindowcommand ID will have a property with this tag that contains the window to be activated when that item is selected.Available in OS X v10.5 and later.
Declared in
MacWindows.h.
Discussion
These constants are used with the Menu Manager functions GetMenuItemProperty and SetMenuItemProperty.
Toolbar View Background Tag
A tag used to inform a custom toolbar view whether to draw its background or leave its background transparent.
enum {
kHIToolbarViewDrawBackgroundTag = 'back'
};
Constants
kHIToolbarViewDrawBackgroundTagA
SetControlDatatag that is used by the standard window frame view to inform the toolbar view whether the view should draw its background or leave its background transparent. The data for this tag is a Boolean. If the data value is true, the toolbar view should draw its background as it desires. If the data value is false, the toolbar view should leave its background transparent so that the window's root view can show through the toolbar view. Currently, the toolbar view will be asked to leave its background transparent for windows with the textured or unified appearance.Available in OS X v10.4 and later.
Declared in
MacWindows.h.
Window Paint Callback Options
Define options to use with the window paint callback function.
typedef OptionBits WindowPaintProcOptions;
enum {
kWindowPaintProcOptionsNone = 0
};
Constants
kWindowPaintProcOptionsNoneNo options.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.
Part Identifier Constants
Used in the value field of the ColorSpec structure, define which part of the window the color affects.
enum {
wContentColor = 0,
wFrameColor = 1,
wTextColor = 2,
wHiliteColor = 3,
wTitleBarColor = 4
};
Constants
wContentColorProduces background color for content region of window.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.wFrameColorProduces color of window’s outline.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.wTextColorProduces color of window’s title and button text.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.wHiliteColorReserved.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.wTitleBarColorReserved.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.
Discussion
When the Appearance Manager is available and you are using standard windows, all the fields of the window color table structure are ignored except the part identifier constant wContentColor in the value field of the ColorSpec structure, which produces the background color for the window’s content region.
If you are creating your own custom windows, the window color table structure and all its part identifier constants can still be used.
Desk Pattern Resource ID
The resource ID of the desktop pattern.
enum {
deskPatID = 16
};
Constants
deskPatIDThe resource ID of the desktop pattern.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.
Discussion
The Window Manager provides the desk pattern resource ID constants, which is the ID of Pattern and PixPat resources that the operating system uses to draw the desktop. The operating system uses the deskPatID constant while the desktop is being drawn. It looks for a resource with this ID and uses the contents of the resource to draw the desktop.
Window Scrolling Options
Options for scrolling windows.
typedef UInt32 ScrollWindowOptions;
enum {
kScrollWindowNoOptions = 0,
kScrollWindowInvalidate = (1L << 0),
kScrollWindowEraseToPortBackground = (1L << 1)
};
Constants
kScrollWindowNoOptionsNo options.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kScrollWindowInvalidateAdd the exposed area to the window’s update region.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kScrollWindowEraseToPortBackgroundErase the exposed area using the background color/pattern of the window’s graphics port.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.
Discussion
Use these constants with the ScrollWindowRect and ScrollWindowRegion functions.
Availability
- Available in Mac OS 8.1 and later.
'wind' Resource Default Collection Item Constants
Specify default collection items in a window ('wind') resource.
enum {
kStoredWindowSystemTag = 'appl',
kStoredBasicWindowDescriptionID = 'sbas',
kStoredWindowPascalTitleID = 's255',
kStoredWindowTitleCFStringID = 'cfst'
};
Constants
kStoredWindowSystemTagThis item tag specifies a system-defined collection item. Note that the
'appl'collection item tag is reserved for use by Apple Computer, Inc. Do not define new collection items using this tag.Available in OS X v10.0 and later.
Declared in
MacWindows.h.kStoredBasicWindowDescriptionIDIn combination with
kStoredWindowSystemTag, this item ID specifies an item of typeBasicWindowDescription. SeeBasicWindowDescriptionfor details on this type.Available in OS X v10.0 and later.
Declared in
MacWindows.h.kStoredWindowPascalTitleIDIn combination with
kStoredWindowSystemTag, this item ID specifies a Pascal title string.Available in OS X v10.0 and later.
Declared in
MacWindows.h.kStoredWindowTitleCFStringIDThis item tag specifies the CFString title string.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.
Discussion
These constants specify the tag and the IDs that identify the default collection items contained in a resource of type ’wind’.
Window Resource IDs
Define standard resource IDs for windows.
enum {
kStandardWindowDefinition = 0,
kRoundWindowDefinition = 1,
kFloatingWindowDefinition = 124
};
Constants
kStandardWindowDefinitionDefines pre-Appearance standard document windows and dialog boxes. When mapping is enabled, this resource ID is mapped to
kWindowDocumentDefProcResIDorkWindowDialogDefProcResID. When mapped tokWindowDocumentDefProcResID, this produces an Appearance-compliant standard document window with no size box and no vertical or horizontal zoom box. When mapped tokWindowDialogDefProcResID, this produces an Appearance-compliant dialog box with no size box and a 3-pixel space between the dialog box’s content and structure region.Available in OS X v10.0 and later.
Declared in
MacWindows.h.kRoundWindowDefinitionDefines pre-Appearance standard desk-accessory style windows. This resource ID is not mapped to any Appearance-compliant resource ID when mapping is enabled.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.kFloatingWindowDefinitionDefines pre-Appearance utility (floating) windows. When mapping is enabled, this resource ID is mapped to
kWindowUtilityDefProcResIDorkWindowUtilitySideTitleDefProcResID. When mapped tokWindowUtilityDefProcResID, this produces an Appearance-compliant utility window. When mapped tokWindowUtilitySideTitleDefProcResID, it produces an Appearance-compliant utility window with a side title bar.Available in OS X v10.0 and later.
Declared in
MacWindows.h.
Discussion
Window resource IDs are changed with Appearance Manager 1.0. The Window Manager now provides many new standard, Appearance-compliant window resource IDs for your program. For a description of the Appearance-compliant window resource IDs, see “Appearance-Compliant Window Resource IDs.”
You can use a window resource ID constant to create a window definition ID; see “Pre-Appearance Window Definition IDs” in Window Manager Legacy Reference for more details.
Resource IDs 0 through 127 are reserved for use by the system.
Window Availability Constants
Define window availability constants for Exposé and Spaces.
typedef OptionBits HIWindowAvailability;
enum {
kHIWindowExposeHidden = 1 << 0,
kHIWindowVisibleInAllSpaces = 1 << 8
};
Constants
kHIWindowExposeHiddenIf this bit is set, the window is hidden during the “All Windows” and “Application windows” modes of Exposé. If this bit is not set, the window is visible during those modes.
Available in OS X v10.4 and later.
Declared in
MacWindows.h.kHIWindowVisibleInAllSpacesIf this bit is set, the window is visible in all Spaces workspaces. If this bit is not set, the window is only visible in the workspace in which it was created.
Available in OS X v10.5 and later.
Declared in
MacWindows.h.
Discussion
These mask bits are used with the function HIWindowChangeAvailability to override the default behavior of the Window Manager in determining whether a window is visible during Exposé or in all Spaces workspaces. By default, newly created windows of class kDocumentWindowClass are given an availability of 0 (meaning that they are available during Exposé), and windows from all other window classes are given an availability of kHIWindowExposeHidden.
Window Scale Mode Constants
Define window scale mode constants.
typedef UInt32 HIWindowScaleMode;
enum {
kHIWindowScaleModeUnscaled = 0,
kHIWindowScaleModeMagnified = 1,
kHIWindowScaleModeFrameworkScaled = 2
};
Constants
kHIWindowScaleModeUnscaledThe window is not scaled at all because the display scale factor is 1.0.
Available in OS X v10.4 and later.
Declared in
MacWindows.h.kHIWindowScaleModeMagnifiedThe window‘s backing store is being magnified by the Window Server because the display scale factor is not equal to 1.0 and because the window was not created with the
kWindowFrameworkScaledAttribute.Available in OS X v10.4 and later.
Declared in
MacWindows.h.kHIWindowScaleModeFrameworkScaledThe window‘s contents are scaled to match the display scale factor because the display scale factor is not equal to 1.0 and because the window was created with
kWindowFrameworkScaledAttribute.Available in OS X v10.4 and later.
Declared in
MacWindows.h.
Discussion
A window’s scale mode indicates in which resolution-independent scale mode it is operating.
Window Group Level Constants
Define window group level constants.
enum {
kWindowGroupLevelActive = 1,
kWindowGroupLevelInactive = 2,
kWindowGroupLevelPromoted = 3,
};
Constants
kWindowGroupLevelActiveThe window level that is nominally used for windows in the group when the application is active. However, if a group with a higher window level is positioned below this group in the window group hierarchy, this group’s active level will be promoted to match the level of the group in front of it. Use
kWindowGroupLevelPromotedto determine the actual window level in use for a group.Available in OS X v10.4 and later.
Declared in
MacWindows.h.kWindowGroupLevelInactiveThe window level for windows in the group when the application is inactive.
Available in OS X v10.4 and later.
Declared in
MacWindows.h.kWindowGroupLevelPromotedThe window level that is actually used for windows in the group when the application is active. This level is the same as the Active window level or is a larger value to match the level of a group below this group. Setting the promoted window level explicitly is not recommended because the promoted level is reset by the Window Manager whenever the window group hierarchy structure changes. Therefore any changes that you make to the promoted level can be overwritten.
Available in OS X v10.4 and later.
Declared in
MacWindows.h.
Discussion
These constants are used when calling GetWindowGroupLevelOfType and SetWindowGroupLevelOfType.
Pre-Appearance Window Definition IDs
Older window definition IDs used before the introduction of the Appearance Manager.
enum {
documentProc = 0,
dBoxProc = 1,
plainDBox = 2,
altDBoxProc = 3,
noGrowDocProc = 4,
movableDBoxProc = 5,
zoomDocProc = 8,
zoomNoGrow = 12,
rDocProc = 16,
floatProc = 1985,
floatGrowProc = 1987,
floatZoomProc = 1989,
floatZoomGrowProc = 1991,
floatSideProc = 1993,
floatSideGrowProc = 1995,
floatSideZoomProc = 1997,
floatSideZoomGrowProc = 1999
};
Constants
documentProcPre-Appearance document window (movable window with size box).
Available in OS X v10.0 and later.
Declared in
MacWindows.h.dBoxProcPre-Appearance modal dialog box.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.plainDBoxPre-Appearance modeless dialog box.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.altDBoxProcPre-Appearance modeless dialog box with shadow.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.noGrowDocProcPre-Appearance movable window with no size box or zoom box.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.movableDBoxProcPre-Appearance movable modal dialog box.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.zoomDocProcPre-Appearance movable window with size box and full zoom box.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.zoomNoGrowPre-Appearance window with full zoom box and no size box.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.rDocProcPre-Appearance rounded-corner window. You can control the diameter of curvature of a rounded-corner window (window type
rDocProc) by adding one of these integers to therDocProcconstant:rDocProc(diameters of curvature: 16, 16)rDocProc+ 2 (diameters of curvature: 4, 4)rDocProc+ 4 (diameters of curvature: 6, 6)rDocProc+ 6 (diameters of curvature: 10, 10)floatProcPre-Appearance utility (floating) window with no size box or zoom box.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.floatGrowProcPre-Appearance utility (floating) window with size box.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.floatZoomProcPre-Appearance utility (floating) window with zoom box.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.floatZoomGrowProcPre-Appearance utility (floating) window with size box and zoom box.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.floatSideProcPre-Appearance utility (floating) window with side title bar and no size or zoom box.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.floatSideGrowProcPre-Appearance utility (floating) window with side title bar and size box.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.floatSideZoomProcPre-Appearance utility (floating) window with side title bar and zoom box.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.floatSideZoomGrowProcPre-Appearance utility (floating) window with side title bar, size box, and zoom box.
Available in OS X v10.0 and later.
Declared in
MacWindows.h.
Discussion
Note that window definition IDs are changed with Appearance Manager 1.0. The Window Manager now provides many new, standard, Appearance-compliant window types.
Your application typically supplies a window definition ID to a resource of type ‘WIND’ or to a window-creation function to specify which window definition function to use in creating the window. A variation code may also be used to describe variations of the same basic window.
The window definition ID is an integer that contains the resource ID of the window definition function in its upper 12 bits and a variation code in its lower 4 bits. For a given resource ID and variation code, the window definition ID is derived as follows: window definition ID = (16 x resource ID) + variation code.
The window definition IDs for dialog boxes and utility (floating) windows pertain to the appearances of these windows only, not their behaviors. For example, if you want a utility window to have the proper behavior, that is, float, your application must provide for it.
When mapping is enabled, standard pre-Appearance window definition function IDs will be mapped to their Appearance-compliant equivalents.
Result Codes
The table below lists result codes defined for the Window Manager.
© 1995, 2003, 2007 Apple Inc. All Rights Reserved. (Last updated: 2007-10-31)