| Framework | Carbon/Carbon.h |
| Companion guide | |
| Declared in | HIClockView.h HICocoaView.h HIComboBox.h HIImageViews.h HIMenuView.h HIObject.h HIScrollView.h HISearchField.h HISegmentedView.h HITextViews.h HIToolboxDebugging.h HIView.h HIWindowViews.h Menus.h |
HIView is an object-oriented view system subclassed from HIObject. All controls are implemented as HIView objects (“views”). You can easily subclass HIView classes, making it easy to implement custom controls. Over time, the HIView API will replace the current Control Manager. Using the HIView model, every item within a window is a view: the root control, controls, and even the standard window “widgets” (close, zoom, and minimize buttons, resize control, and so on). Current Control Manager function calls are layered on top of this HIView model.
Additional benefits of the HIView model include the following:
Quartz is the native drawing system, but you can still use QuickDraw if desired.
Modern coordinate system not bounded by the 16-bit space of QuickDraw.
Simplified coordinate system for view bounds and the position of a view within its parent.
Views can be ordered within a hierarchy layer; that is, it is easy to place controls in front of or behind other controls.
For additional information about using HIViews, see HIView Programming Guide.
HIViewGetRoot
HIViewFindByID
HIViewGetSuperview
HIViewPlaceInSuperviewAt
HIViewGetNextView
HIViewGetPreviousView
HIViewAddSubview
HIViewRemoveFromSuperview
HIViewGetFirstSubview
HIViewGetLastSubview
HIViewCountSubviews
HIViewGetIndexedSubview
HIViewSetVisible
HIViewIsVisible
HIViewIsLatentlyVisible
HIViewSetHilite
HIViewIsActive
HIViewSetActivated
HIViewIsEnabled
HIViewSetEnabled
HIViewIsCompositingEnabled
HIViewSetText
HIViewCopyText
HIViewGetValue
HIViewSetValue
HIViewGetMinimum
HIViewSetMinimum
HIViewGetMaximum
HIViewSetMaximum
HIViewGetViewSize
HIViewSetViewSize
HIViewIsValid
HIViewGetID
HIViewSetID
HIViewGetCommandID
HIViewSetCommandID
HIViewGetKind
HIViewGetAttributes
HIViewChangeAttributes
HIViewGetNeedsDisplay
HIViewSetNeedsDisplay
HIViewSetNeedsDisplayInRect
HIViewSetNeedsDisplayInShape
HIViewSetNeedsDisplayInRegion
HIViewRender
HIViewGetSizeConstraints
HIViewIsDrawingEnabled
HIViewSetDrawingEnabled
HIViewScrollRect
HIViewSetZOrder
HIViewReshapeStructure
HIViewRegionChanged
HIViewCopyShape
HIViewGetOptimalBounds
HIViewFlashDirtyArea
HIViewGetWindow
HIViewGetFeatures
HIViewChangeFeatures
HIViewGetEventTarget
HIViewGetFocusPart
HIViewSetNextFocus
HIViewAdvanceFocus
HIViewSubtreeContainsFocus
HIViewSetFirstSubViewFocus
HIViewGetBounds
HIViewSetBoundsOrigin
HIViewGetFrame
HIViewSetFrame
HIViewMoveBy
HIViewConvertPoint
HIViewConvertRect
HIViewConvertRegion
HIComboBoxCreate
HIComboBoxGetAttributes
HIComboBoxChangeAttributes
HIComboBoxAppendTextItem
HIComboBoxCopyTextItemAtIndex
HIComboBoxGetItemCount
HIComboBoxInsertTextItemAtIndex
HIComboBoxRemoveItemAtIndex
HIComboBoxIsListVisible
HIComboBoxSetListVisible
HIImageViewCreate
HIImageViewCopyImage
HIImageViewSetImage
HIImageViewGetAlpha
HIImageViewSetAlpha
HIImageViewGetScaleToFit
HIImageViewSetScaleToFit
HIImageViewIsOpaque
HIImageViewSetOpaque
HIScrollViewCreate
HIScrollViewGetScrollBarAutoHide
HIScrollViewSetScrollBarAutoHide
HIScrollViewCanNavigate
HIScrollViewNavigate
HIViewGetLayoutInfo
HIViewSetLayoutInfo
HIViewApplyLayout
HIViewSuspendLayout
HIViewResumeLayout
HIViewIsLayoutActive
HIViewIsLayoutLatentlyActive
HISearchFieldCreate
HISearchFieldSetSearchMenu
HISearchFieldGetSearchMenu
HISearchFieldChangeAttributes
HISearchFieldGetAttributes
HISearchFieldSetDescriptiveText
HISearchFieldCopyDescriptiveText
HISegmentedViewCreate
HISegmentedViewSetSegmentCount
HISegmentedViewGetSegmentCount
HISegmentedViewSetSegmentBehavior
HISegmentedViewGetSegmentBehavior
HISegmentedViewChangeSegmentAttributes
HISegmentedViewGetSegmentAttributes
HISegmentedViewSetSegmentValue
HISegmentedViewGetSegmentValue
HISegmentedViewSetSegmentEnabled
HISegmentedViewIsSegmentEnabled
HISegmentedViewSetSegmentCommand
HISegmentedViewGetSegmentCommand
HISegmentedViewSetSegmentLabel
HISegmentedViewCopySegmentLabel
HISegmentedViewSetSegmentContentWidth
HISegmentedViewGetSegmentContentWidth
HISegmentedViewSetSegmentImage
HISegmentedViewGetSegmentImageContentType
HISegmentedViewCopySegmentImage
Creates a Carbon view that serves as a wrapper for a Cocoa view.
OSStatus HICocoaViewCreate ( NSView *inNSView, OptionBits inOptions, HIViewRef *outHIView );
A pointer to the Cocoa view you want to wrap. This function retains the Cocoa view you pass in; on output, you may safely release the view. If you want to create an empty Carbon wrapper view, you may pass NULL. An empty wrapper view does not draw or respond to user interaction; you can associate it with a Cocoa view at a later time using the function HICocoaViewSetView.
Options for the new Carbon wrapper view. Currently this parameter must be 0.
A pointer to a variable of type HIViewRef. On output, your variable contains a new Carbon view that serves as a wrapper for the Cocoa view specified in the inNSView parameter. You are responsible for releasing the wrapper view when you no longer need it. Note that if you embed the wrapper view in a Carbon window, the view (along with its associated Cocoa view) will be released automatically when the window is destroyed.
An operating system result code. This function returns paramErr whenever the inOptions parameter is not 0 or the outHIView parameter is NULL.
This function creates an HIView-based wrapper for a Cocoa view. You can embed the new wrapper view in a Carbon window and use standard HIView functions to manipulate the view. HICocoaView is supported only in compositing windows.
The following example shows how to use this function to create a wrapped Cocoa view that can be embedded in a Carbon window:
NSView *myCocoaView = [[SomeNSView alloc] init]; |
HIViewRef myHICocoaView; |
HICocoaViewCreate (myCocoaView, 0, &myHICocoaView); |
[myCocoaView release]; |
HICocoaView.hReturns the Cocoa view associated with an existing Carbon wrapper view.
NSView * HICocoaViewGetView ( HIViewRef inHIView );
A wrapper view that has an associated Cocoa view.
The Cocoa view associated with the specified wrapper view, or NULL if the wrapper view is empty or invalid. If you need to save the Cocoa view for later use, you should retain it.
HICocoaView.hAssociates a Cocoa view with a HICocoaView wrapper view.
OSStatus HICocoaViewSetView ( HIViewRef inHIView, NSView *inNSView );
An existing HICocoaView wrapper view.
A pointer to a Cocoa view. This function retains the Cocoa view you pass in; on output, you may safely release this view. If the HICocoaView wrapper view specified in the inHIView parameter already wraps a Cocoa view, this function releases the wrapped view and replaces it with the Cocoa view you pass in.
An operating system result code. This function returns paramErr if either parameter is NULL or invalid.
Typically you’ll use this function after you instantiate a nib-based Carbon window that contains an empty HICocoaView wrapper view. The empty wrapper view serves as a placeholder until you call this function to associate a Cocoa view with it. HICocoaView is supported only in compositing windows.
The following example shows how to use this function to associate a Cocoa view with an existing wrapper view:
NSView *myCocoaView = [[SomeNSView alloc] init]; |
HICocoaViewSetView (myHICocoaView, myCocoaView); |
[myCocoaView release]; |
HICocoaView.hAppends a text item to the combo box disclosure list.
OSStatus HIComboBoxAppendTextItem ( HIViewRef inComboBox, CFStringRef inText, CFIndex *outIndex );
The combo box having the disclosure list to which the text is to be appended.
The text item to be appended to the combo box disclosure list.
On exit, the index of the new item. Can be NULL if you don’t want this information.
An operating system status code.
HIComboBox.hChanges the attributes of a combo box.
OSStatus HIComboBoxChangeAttributes ( HIViewRef inComboBox, OptionBits inAttributesToSet, OptionBits inAttributesToClear );
The combo box whose attributes you want to change.
The attributes to set. For possible values, see “Combo Box Attributes.”
The attributes to clear. For possible values, see “Combo Box Attributes.”
An operating system status code.
HIComboBox.hCopy a text item from a combo box disclosure list
OSStatus HIComboBoxCopyTextItemAtIndex ( HIViewRef inComboBox, CFIndex inIndex, CFStringRef *outString );
The combo box that contains the text item you want to copy.
The index of the text item. This function returns paramErr if the index is out of the bounds of the combo box disclosure list.
A copy of the string at the specified index. You are responsible for releasing the string.
An operating system status code.
HIComboBox.hCreates a combo box control.
OSStatus HIComboBoxCreate ( const HIRect *boundsRect, CFStringRef text, const ControlFontStyleRec *style, CFArrayRef list, OptionBits inAttributes, HIViewRef *outComboBox );
The bounding box of the control.
The default text in the editable portion of the control. Can be NULL.
The font style of the both editable text and the text in the disclosure list. Can be NULL.
The default values available in the disclosure list. Can be NULL.
The default attributes of the combo box. For possible values, see “Combo Box Attributes.”
On exit, a pointer to a reference for the new control.
The combo box can be used in compositing mode, as well as traditional Control Manager mode. When created, this view is invisible. To see the view, you must show the view by calling HIViewSetVisible.
HIComboBox.hGets the attributes of a combo box.
OSStatus HIComboBoxGetAttributes ( HIViewRef inComboBox, OptionBits *outAttributes );
The combo box whose attributes you want to obtain.
The attributes of the combo box. For possible values, see “Combo Box Attributes.”
An operating system status code.
HIComboBox.hGets the number of items in the combo box disclosure list.
ItemCount HIComboBoxGetItemCount ( HIViewRef inComboBox );
The combo box.
The number of items in the combo box disclosure list.
HIComboBox.hInserts a CFString in a combo box disclosure list.
OSStatus HIComboBoxInsertTextItemAtIndex ( HIViewRef inComboBox, CFIndex inIndex, CFStringRef inText );
The combo box having the disclosure list in which the text is to be inserted.
The index at which the text should be inserted. If the index does not fall within the number of items in the combo box list, the text is appended to the end of the list.
The text item to be inserted in the combo box disclosure list.
An operating system status code.
HIComboBox.h
Determines whether a combo box disclosure list is visible.
Boolean HIComboBoxIsListVisible ( HIViewRef inComboBox );
The Combo box whose disclosure list visibility is to be queried.
A Boolean whose value is true if the combo box disclosure list is visible; otherwise, false to indicate that the combo box disclosure list is hidden.
HIComboBox.hRemoves an item from a combo box disclosure list.
OSStatus HIComboBoxRemoveItemAtIndex ( HIViewRef inComboBox, CFIndex inIndex );
The combo box having the disclosure list that from which you want to remove an item.
The index of the item to remove.
An operating system status code.
HIComboBox.h
Hides or shows a combo box disclosure list.
OSStatus HIComboBoxSetListVisible ( HIViewRef inComboBox, Boolean inVisible );
The combo box.
A Boolean whose value is true to make the combo box disclosure list visible or false to hide the combo box list.
An operating system result code.
HIComboBox.h
Creates a new Core Graphics image with the standard selected or disabled appearance.
OSStatus HICreateTransformedCGImage ( CGImageRef inImage, OptionBits inTransform, CGImageRef *outImage );
The original image.
The transformation to apply to the image. For possible values, see “Transformation Constants.”
A pointer to a value of type CGImageRef that, on return, contains the new image. You are responsible for releasing the image.
An operating system result code.
HIView.hDetermines whether a grow box view is transparent.
Boolean HIGrowBoxViewIsTransparent ( HIViewRef inGrowBoxView );
The grow box view reference to query.
A Boolean value that is true if the grow box view is transparent; otherwise, false which indicates the grow box view is an opaque white square with grow lines.
HIWindowViews.hMakes a grow box view transparent or opaque.
OSStatus HIGrowBoxViewSetTransparent ( HIViewRef inGrowBoxView, Boolean inTransparent );
The grow box view reference.
Pass true to make the grow box view use its transparent look or false to make the grow box view use its opaque appearance.
An operating system result code.
This function sets a grow box view to be transparent, meaning the grow box lines are drawn over any content under it. When not transparent, the grow box is an opaque white square with the grow lines.
HIWindowViews.hObtains the image for an image view.
CGImageRef HIImageViewCopyImage ( HIViewRef inView );
The image view to query.
A Core Graphics (Quartz) image reference, or NULL if there is no image set on the view or if the view ref is invalid.
The image is retained, so you should release it when you are finished with it.
HIImageViews.hCreates an image view.
OSStatus HIImageViewCreate ( CGImageRef inImage, HIViewRef *outView );
An initial image, or NULL. You can use SetControlData to set the image later.
The new image view.
An operating system result code.
The view responds to the scrollable interface and can be used in a scrolling view. You can pass an image initially, or set one later.
HIImageViews.hObtains the alpha value for a view.
CGFloat HIImageViewGetAlpha ( HIViewRef inView );
The image view to query.
A floating point number representing the alpha from 0.0 through 1.0.
An alpha of 1.0 means that the view is fully opaque, and alpha of 0.0 is means the view is fully transparent.
HIImageViews.hDetermines whether an image will scale or clip to the view bounds.
Boolean HIImageViewGetScaleToFit ( HIViewRef inView );
The image view to query.
A Boolean whose value is true if the image scales or false if the image clips.
This function determines whether an image view will scale the image it displays to the view bounds or merely clip to the view bounds.
HIImageViews.hDetermines whether an image view is opaque.
Boolean HIImageViewIsOpaque ( HIViewRef inView );
The image view to query.
A Boolean whose value is true if the image view is opaque; otherwise, false.
HIImageViews.hSets the alpha value for an image view.
OSStatus HIImageViewSetAlpha ( HIViewRef inView, CGFloat inAlpha );
The image view to affect.
The new alpha value.
An operating system result code.
Allows you to set the alpha for an image, making it more or less transparent. An alpha of 1.0 is fully opaque, and an alpha of 0.0 is fully transparent. The default alpha for an image is 1.0.
HIImageViews.hSets the image to display in an image view.
OSStatus HIImageViewSetImage ( HIViewRef inView, CGImageRef inImage );
The image view to affect.
The image to set.
An operating system status code.
The image passed in is retained by the view, so you may release the image after calling this function if you no longer need to reference it.
HIImageViews.hSets the opacity of an image view.
OSStatus HIImageViewSetOpaque ( HIViewRef inView, Boolean inOpaque );
The image view to set.
A Boolean whose value is true to make the image view opaque or false to disable the opacity setting.
An operating system result code.
When opacity is enabled, the image view can make certain optimizations for compositing and scrolling. The alpha-related image view APIs are rendered useless when opacity is enabled. An image view, when created, is opaque by default. You must pass false to this function in order to change the alpha, etc. or if your image does not fill the full bounds of the view.
HIImageViews.hSpecifies whether an image should scale or clip to the view’s bounds.
OSStatus HIImageViewSetScaleToFit ( HIViewRef inView, Boolean inScaleToFit );
The image view.
A Boolean whose value is true to indicate that the image should be scaled to fit the view bounds or false to indicate that the image should clip to the view’s bounds.
An operating system status code.
Normally, an image view clips to the view’s bounds. Use this function to tell the image view to size the image to fit into the view’s bounds.
HIImageViews.h
Obtains an HIViewRef that can be used to draw menu content for a menu.
OSStatus HIMenuGetContentView ( MenuRef inMenu, ThemeMenuType inMenuType, HIViewRef *outView );
The menu for which an HIViewRef is to be obtained.
The type of menu for which the menu content view is to be returned. The same MenuRef may have multiple content views, depending on the menu type being displayed.
A pointer to a value of type HIViewRef that, on return, represents the view, or NULL if the menu does not use an HIView to draw its content. The caller should not release this view.
An operating system result code. If the menu uses an MDEF instead of a view to draw its content, this function sets outView to NULL and returns noErr.
If the content view has not yet been created, the Menu Manager will create the content view using the view class ID and initialization event associated with the menu. Note that the menu content view is not the same as the window content view; the menu content view is embedded inside the window content view.
Menus.h
Returns the MenuRef associated with a view that is a subclass of HIMenuView.
MenuRef HIMenuViewGetMenu ( HIViewRef inView );
The view whose menu is to be returned.
The MenuRef associated with the specified view, or NULL if a view is passed that is not a subclass of HIMenuView.
An HIMenuView subclass might use call this function to determine the menu it should draw.
Prior to Mac OS X v10.5, this function returns NULL if passed an instance of the standard menu view. In Mac OS X v10.5 and later, this function correctly returns the owning menu of an instance of the standard menu view.
HIMenuView.h
Determines whether it is possible to navigate in a scroll view.
Boolean HIScrollViewCanNavigate ( HIViewRef inView, HIScrollViewAction inAction );
The view to query.
The navigation action to test. For possible values, see “Scroll View Action Constants.”
A Boolean whose value is true if the navigation specified by inAction is possible; otherwise, false.
Use this function to determine whether it is possible to perform a particular navigation within a scroll view. For example, if a scroll view is already at the top of the scrollable content, it is not possible to navigate upward, so the home and page up actions would not be possible. You might use this function to help you update the state of menu items.
HIScrollView.hCreates a scroll view.
OSStatus HIScrollViewCreate ( OptionBits inOptions, HIViewRef *outView );
Options for our scroll view. You must specify either a horizontal or a vertical scroll bar. If neither is passed, an error is returned. For possible values, see “Scroll View Constants.”
The new scroll view.
An operating system result code.
This view has three parts. It can have a horizontal scroll bar, a vertical scroll bar, and a view to be scrolled that must be added by calling HIViewAddSubview. The added scroll view integrates itself automatically and appropriately.
HIScrollView.hObtains current setting of a scroll view’s scroll bar auto-hide setting.
Boolean HIScrollViewGetScrollBarAutoHide ( HIViewRef inView );
The view to query.
A Boolean whose value is true if the auto-hide setting is enabled; otherwise, false.
When the auto-hide setting is enabled, a scroll view’s scroll bars are hidden when the entire scrollable view can be fully displayed in the scroll view’s bounds. This is similar to the behavior of the Preview application.
HIScrollView.h
Changes the portion of a view’s target.
OSStatus HIScrollViewNavigate ( HIViewRef inView, HIScrollViewAction inAction );
The view to scroll.
The action to take.
An operating system result code.
Use this function to programmatically change the portion of a scroll view’s target. For example, you can call this function to move to the beginning or end of a document. You can also page up, down, left and right. In general, you should not call this function from embedded content, that is, the scrollable view inside the scroll view. Instead, for those cases, you should position yourself appropriately and tell the scroll view you changed via the kEventScrollableInfoChanged Carbon event. This function is merely a programmatic way to scroll as one would by hand using the scroll bars.
HIScrollView.hSets a scroll view’s auto-hide setting.
OSStatus HIScrollViewSetScrollBarAutoHide ( HIViewRef inView, Boolean inAutoHide );
The view to affect.
A Boolean whose value is true to enable auto-hide and false to disable auto-hide.
An operating system result code.
When the auto-hide setting is enabled, a scroll view’s scroll bars are hidden when the entire scrollable view can be fully displayed in the scroll view’s bounds. This is similar to the behavior of the Preview application.
HIScrollView.h
Sets the attributes of a search field.
OSStatus HISearchFieldChangeAttributes ( HIViewRef inSearchField, OptionBits inAttributesToSet, OptionBits inAttributesToClear );
The search field whose attributes are to be changed.
The attributes to set. For possible values, see “Search Field Attribute Constants.”
The attributes to clear. For possible values, see “Search Field Attribute Constants.”
An operating system result code.
HISearchField.h
Obtains the description associated with a search field.
OSStatus HISearchFieldCopyDescriptiveText ( HIViewRef inSearchField, CFStringRef *outDescription );
The search field whose descriptive text is to be obtained.
A pointer to a value of type CFStringRef that, on return, represents the description that is associated with the search field specified by inSearchField. This parameter cannot be NULL. If no description is associated with the search field, on return, outDescription is set to NULL. If there is a description, a CFStringRef is created for you; you are responsible for releasing the CFStringRef when you no longer need it.
An operating system result code.
HISearchField.h
Creates a Search field control.
OSStatus HISearchFieldCreate ( const HIRect *inBounds, OptionBits inAttributes, MenuRef inSearchMenu, CFStringRef inDescriptiveText, HIViewRef *outRef );
The initial bounds of the view, or NULL. If this parameter is NULL, the view is created with empty bounds ( 0, 0, 0, 0 ).
The initial attributes of the search field. Indicates whether the field should contain the Cancel icon. For possible values, see “Search Field Attribute Constants.”
The menu to be associated with this search field, or NULL. If inSearchMenu is non-NULL, the menu will be retained by the search field and the Search icon will be enabled in the left side of the text field. If this parameter is NULL, the view will not display the Search icon in the left portion of the text field. You are expected to install handlers on this menu to handle the visual appearance of the menu (for example, to draw check marks or enable items when the menu receives the kEventMenuEnableItems Carbon event), and to keep track of what action should be performed by associating HICommands with each menu item and installing a handler for the kEventClassCommand /kEventCommandProcess Carbon event.
The text to be displayed in the text field when the field does not have focus and contains no user-entered text, or NULL. This text should indicate the search criteria. For example, you may want to identify to the user that the search will cover the “Subject” or “Contents” of a selected range of items. If inDescriptiveText is non-NULL, the text will be retained by the search field.
On return, a reference for the new view.
An operating system result code.
This view is designed to be used by applications that provide searching functionality. Visually, it is a standard text field optionally adorned with a Search icon on the left and a Cancel image on the right. The new control is initially invisible.
When the user accepts the text by pressing the Return or Enter key, a Carbon event of kEventClassTextField / kEventTextAccepted is sent to the control to indicate that the search should begin. This control also responds to all of the standard control tags used by the EditUnicodeText control.
HISearchField.h
Obtains the attributes for a search field.
OSStatus HISearchFieldGetAttributes ( HIViewRef inSearchField, OptionBits *outAttributes );
The search field whose attributes are to be obtained.
A pointer to a value of type OptionBits that, on return, contains the attributes of the Search field specified by inSearchField. This parameter cannot be NULL. For possible values, see “Search Field Attribute Constants.”
An operating system result code.
HISearchField.h
Obtains the search menu associated with a search field.
OSStatus HISearchFieldGetSearchMenu ( HIViewRef inSearchField, MenuRef *outSearchMenu );
The search field for which you want to obtain the search menu.
A pointer to a value of type MenuRef that, on return, represents the menu associated with the search field. The menu is not retained on output, and this parameter cannot be NULL.
An operating system result code.
HISearchField.h
Sets the description of the search action for a search field.
OSStatus HISearchFieldSetDescriptiveText ( HIViewRef inSearchField, CFStringRef inDescription );
The search field whose descriptive text is to be set.
The new description for the search field. If the search field already has a description, it will be released. If this parameter is non-NULL, it will be retained by the search field. If this parameter is NULL, upon return, no description is associated with the search field.
An operating system result code.
HISearchField.h
Sets the search menu associated with a search field view.
OSStatus HISearchFieldSetSearchMenu ( HIViewRef inSearchField, MenuRef inSearchMenu );
The Search field with which to associate the search menu.
The menu to associate with the Search field, or NULL. If a menu is already associated with the Search field, that menu is released. If inSearchMenu is non-NULL, it will be retained by the Search field and the Search icon will be enabled in the left side of the text field. You are expected to install handlers on this menu to handle the visual appearance of the menu (for example, to draw check marks or enable items when the menu receives the kEventMenuEnableItems Carbon event). You are also expected to keep track of the actions that should be performed by associating HICommands with each menu item and installing a handler for the kEventClassCommand /kEventCommandProcess Carbon event. If inSearchMenu is NULL, the Search icon is removed from the left side of the text field and no menu is associated with the Search field.
An operating system result code.
HISearchField.h
Changes the attributes of an individual segment of a segmented view.
OSStatus HISegmentedViewChangeSegmentAttributes ( HIViewRef inSegmentedView, UInt32 inSegmentIndexOneBased, OptionBits inAttributesToSet, OptionBits inAttributesToClear );
The segmented view that owns the segment whose attributes you want to change.
The one-based index of the segment whose attributes you want to change. This must be a non-zero value that is no higher than the segmented view’s current segment count.
The attribute bits you want to set for the segment. For possible values, see “Segment Attribute Constants.”
The attribute bits you want to clear for the segment.
An operating system result code.
By default, a segment has no attributes.
HISegmentedView.h
Copies the image drawn by a segment.
OSStatus HISegmentedViewCopySegmentImage ( HIViewRef inSegmentedView, UInt32 inSegmentIndexOneBased, HIViewImageContentInfo *ioImage );
The segmented view that owns the segment whose image you want to copy.
The one-based index of the segment whose image you want to set. This must be a non-zero value that is no higher than the segmented view’s current segment count.
A pointer to a HIViewImageContentInfo structure whose contentType field specifies the type of image you want to copy. If the segment uses the type of image you specified, on return, the appropriate field of the union contains a copy of the image. If the segment index is an illegal value, the result is undefined. You are responsible for releasing the image.
An operating system result code.
Call HISegmentedViewGetSegmentImageContentType to get the image type.
HISegmentedView.h
Obtains a copy of the label string associated with a segment.
OSStatus HISegmentedViewCopySegmentLabel ( HIViewRef inSegmentedView, UInt32 inSegmentIndexOneBased, CFStringRef *outLabel );
The segmented view that owns the segment whose label you want to copy.
The one-based index of the segment whose label is to be copied. This must be a non-zero value that is no higher than the segmented view’s current segment count.
A pointer to a CFStringRef that represents the copy of the label associated with the segment. You are responsible for releasing the the string containing the copy of the label. If no label is associated with the specified segment, outLabel is set to NULL.
An operating system result code.
HISegmentedView.h
Creates a segmented view.
OSStatus HISegmentedViewCreate ( const HIRect *inBounds, HIViewRef *outRef );
The bounds of the view to be created, or NULL. If NULL, the view is created with CGRectZero bounds.
A valid pointer to an HIViewRef that, on return, represents the newly created view.
An operating system result code.
You can use a segmented view to implement the icon/column/list view switcher as seen in the Finder. After creating a segmented view, set the number of segments by calling HISegmentedViewSetSegmentCount. Each segment can be configured independently by calling other HISegmentedView APIs. Changing the number of segments and configuring each segment changes the appearance of the segmented view. After configuring the view, you may want to call HIViewGetOptimalBounds on the view and resize it so the content fits optimally.
The value of the whole segmented view corresponds to the index of the currently selected segment with the radio behavior. If you set the value of the whole segmented view to n by calling HIViewSetValue, the value of each radio-behavior segment is set to zero except for the segment at index n. If segment n also has radio behavior, its value will be set to one. When a radio-behavior segment is clicked, the value of the whole segmented view is set to the segment’s index.
Segmented views work in both compositing and non-compositing modes.
HISegmentedView.h
Returns the attributes of an individual segment of a segmented view.
OptionBits HISegmentedViewGetSegmentAttributes ( HIViewRef inSegmentedView, UInt32 inSegmentIndexOneBased );
The segmented view that owns the segment to query.
The one-based index of the segment whose attributes you want to query. This must be a non-zero value that is no higher than the segmented view’s current segment count.
The attribute bits that are set for the specified segment. For possible values, see “Segment Attribute Constants.” If the segment index is an illegal value, the result is undefined.
HISegmentedView.h
Obtains the behavior of an individual segment of a segmented view.
HISegmentBehavior HISegmentedViewGetSegmentBehavior ( HIViewRef inSegmentedView, UInt32 inSegmentIndexOneBased );
The segmented view that owns the segment whose behavior is to be obtained.
The one-based index of the segment whose behavior you want to obtain. This must be a non-zero value that is no higher than the segmented view’s current segment count.
A value of type HISegmentBehavior describing the behavior of the given segment. For possible values, see “Segment Behavior Constants.” If the segment index is an illegal value, the result is undefined.
HISegmentedView.h
Obtains the command ID associated with a segment.
UInt32 HISegmentedViewGetSegmentCommand ( HIViewRef inSegmentedView, UInt32 inSegmentIndexOneBased );
The segmented view that owns the segment for which the command ID is to be obtained.
The one-based index of the segment for which the command ID is to be obtained. This must be a non-zero value that is no higher than the segmented view’s current segment count.
The command ID associated with the specified segment. If the segment index is an illegal value, the result is undefined.
HISegmentedView.h
Obtains the content width of a segment.
CGFloat HISegmentedViewGetSegmentContentWidth ( HIViewRef inSegmentedView, UInt32 inSegmentIndexOneBased, Boolean *outAutoCalculated );
The segmented view that owns the segment whose content width is to be obtained.
The one-based index of the segment. This must be a non-zero value that is no higher than the segmented view’s current segment count.
A pointer to a Boolean whose value, on return, is true if the segment calculates its own width automatically; otherwise, false. Pass NULL if you don’t want this information.
The width of the content for the given segment. If the segment index is an illegal value, the result is undefined.
The content width is the horizontal area taken up by a segment’s label (if any) and image (if any).
HISegmentedView.h
Obtains the number of segments for a segmented view.
UInt32 HISegmentedViewGetSegmentCount ( HIViewRef inSegmentedView );
The segmented view for which the number of segments is to be obtained.
A UInt32 whose value is the number of segments in the segmented view specified by inSegmentedView.
HISegmentedView.h
Obtains the type of image content drawn by a segment.
HIViewImageContentType HISegmentedViewGetSegmentImageContentType ( HIViewRef inSegmentedView, UInt32 inSegmentIndexOneBased );
The segmented view that owns the segment whose image content type you want to obtain.
The one-based index of the segment whose image you want to set. This must be a non-zero value that is no higher than the segmented view’s current segment count.
The image content type of the image drawn by the specified segment. If the segment index is an illegal value, the result is undefined.
HISegmentedView.h
Returns the value of an individual segment of a segmented view.
SInt32 HISegmentedViewGetSegmentValue ( HIViewRef inSegmentedView, UInt32 inSegmentIndexOneBased );
The segmented view that owns the segment to query.
The one-based index of the segment whose value you want to obtain. This must be a non-zero value that is no higher than the segmented view’s current segment count.
An SInt32 containing the value of the specified segment. Zero means that the segment is unpressed or unselected, and one means the segment is pressed or selected.
Getting a segment value is only meaningful for segments with the sticky, toggles, or radio behaviors. The value of segments that have the momentary behavior is undefined.
HISegmentedView.h
Determines whether an individual segment of a segmented view is enabled.
Boolean HISegmentedViewIsSegmentEnabled ( HIViewRef inSegmentedView, UInt32 inSegmentIndexOneBased );
The segmented view that owns the segment to query.
The one-based index of the segment to query. This must be a non-zero value that is no higher than the segmented view’s current segment count.
A Boolean whose value is true if the segment is enabled or false if the segment is not enabled.
HISegmentedView.h
Changes the behavior of an individual segment of a segmented view.
OSStatus HISegmentedViewSetSegmentBehavior ( HIViewRef inSegmentedView, UInt32 inSegmentIndexOneBased, HISegmentBehavior inBehavior );
The segmented view that owns the segment whose behavior is to be set.
The one-based index of the segment whose behavior you want to set. This must be a non-zero value that is no higher than the segmented view’s current segment count.
The behavior you want the segment to have. For possible values, see “Segment Behavior Constants.”
An operating system result code.
By default, a segment has the kHISegmentBehaviorMomentary behavior.
HISegmentedView.h
Sets the command ID for a segment.
OSStatus HISegmentedViewSetSegmentCommand ( HIViewRef inSegmentedView, UInt32 inSegmentIndexOneBased, UInt32 inCommand );
The segmented view that owns the segment for which the command ID is to be set.
The one-based index of the segment for which the command ID is to be set. This must be a non-zero value that is no higher than the segmented view’s current segment count.
The command ID you want to associate with the segment. When the command ID is 0 for a segment, the kEventCommandProcess event is not sent when the segment is clicked.
An operating system result code.
When any non-zero command ID is set, the segmented view sends an HICommand whenever the segment is clicked. By default, the command is sent to the segmented view and up the containment hierarchy. If you want the command to start at the user focus instead, set the kHISegmentCmdToUserFocus attribute for the segment.
HISegmentedView.h
Specifies how the content width of segment is to be calculated.
OSStatus HISegmentedViewSetSegmentContentWidth ( HIViewRef inSegmentedView, UInt32 inSegmentIndexOneBased, Boolean inAutoCalculateWidth, CGFloat inWidth );
The segmented view that owns the segment whose method of calculating content width you want to specify.
The one-based index of the segment. This must be a non-zero value that is no higher than the segmented view’s current segment count.
A Boolean whose value is true if you want the segment to calculate its own width automatically (in which case, the inWidth parameter is ignored), or false if you want the value of the inWidth parameter to be associated with the segment.
The width in pixels.
An operating system result code.
The content width is the horizontal area taken up by a segment’s label (if any) and image (if any).
HISegmentedView.h
Sets the number of segments for a segmented view.
OSStatus HISegmentedViewSetSegmentCount ( HIViewRef inSegmentedView, UInt32 inSegmentCount );
The segmented menu for which the number of segments is to be set.
A positive integer specifying the number of segments the view is to have.
An operating system result code.
The content for any previous segments beyond the new count is released. All new segments beyond the previous count are initialized with basic settings: Momentary, no attributes, zero value, enabled, no command, no label, no content, and auto-calculated content width. You should configure any new segments to match your needs.
HISegmentedView.h
Enables or disables an individual segment of a segmented view.
OSStatus HISegmentedViewSetSegmentEnabled ( HIViewRef inSegmentedView, UInt32 inSegmentIndexOneBased, Boolean inEnabled );
The segmented view that owns the segment that is to be enabled or disabled.
The one-based index of the segment to enable or disable. This must be a non-zero value that is no higher than the segmented view’s current segment count.
A Boolean whose value is true to enable the segment or false to disable the segment.
An operating system result code.
HISegmentedView.h
Sets or clears the image associated with a segment.
OSStatus HISegmentedViewSetSegmentImage ( HIViewRef inSegmentedView, UInt32 inSegmentIndexOneBased, const HIViewImageContentInfo *inImage );
The segmented view that owns the segment whose image you want to set.
The one-based index of the segment whose image you want to set. This must be a non-zero value that is no higher than the segmented view’s current segment count.
A pointer to an HIViewImageContentInfo structure with the image information for the specified segment. Segments support three types of image content: kControlNoContent, kControlContentIconRef, and kControlContentCGImageRef.
An operating system result code.
HISegmentedView.h
Sets the label string for a segment.
OSStatus HISegmentedViewSetSegmentLabel ( HIViewRef inSegmentedView, UInt32 inSegmentIndexOneBased, CFStringRef inLabel );
The segmented view that owns the segment whose label you want to sets.
The one-based index of the segment whose label is to be set. This must be a non-zero value that is no higher than the segmented view’s current segment count.
A CFStringRef with the text of the label. The segmented view will copy the string you passed in. To eliminate the label from the segment, pass NULL or an empty CFStringRef.
An operating system result code.
By default, a segment has no label string.
HISegmentedView.h
Changes the value of an individual segment of a segmented view.
OSStatus HISegmentedViewSetSegmentValue ( HIViewRef inSegmentedView, UInt32 inSegmentIndexOneBased, SInt32 inValue );
The segmented view that owns the segment to query.
The one-based index of the segment whose value you want to change. This must be a non-zero value that is no higher than the segmented view’s current segment count.
The value you want to set. Zero means that the segment is unpressed or unselected, and one means the segment is pressed or selected. Setting any other value will result in an undefined behavior.
An operating system result code.
Setting a segment value is only meaningful for segments with the sticky, toggles, or radio behaviors. Setting the value of segments that have the momentary behavior to something other than zero results in a behavior that is undefined.
HISegmentedView.h
Adds a subview to the given parent view.
OSStatus HIViewAddSubview ( HIViewRef inParent, HIViewRef inNewChild );
The view that will receive the new subview.
The subview being added.
An operating system result code. The result code errNeedsCompositedWindow is returned if you try to embed into the content view in a non-compositing window; you can only embed into the content view in a compositing window.
The new subview is added to the front of the list of subviews (that is, it is made topmost). The subview being added is not retained by the new parent view. Do not release the view after adding it, or it will cease to exist. All views in a window are released automatically when the window is destroyed.
HIView.hAdvances the keyboard focus to the next most appropriate view.
OSStatus HIViewAdvanceFocus ( HIViewRef inRootForFocus, EventModifiers inModifiers );
The subtree to manipulate. The focus does not leave inRootToFocus. Typically, you would pass the content of the window or the root. If focused on the toolbar, for example, the focus is limited to the toolbar only. In this case, for example, the Toolbox passes the toolbar view in as the focus root.
The keyboard event modifiers that caused HIViewAdvanceFocus to be called. These modifiers are used to determine the focus direction as well as other alternate focusing behaviors.
An operating system result code.
Unless overridden in some fashion (either by overriding certain Carbon events or by calling the HIViewSetNextFocus, the Toolbox uses a spatially determinant method of focusing, attempting to focus left to right and top to bottom in a window, taking groups of controls into account.
HIView.h
Applies the current layout to the specified view.
OSStatus HIViewApplyLayout ( HIViewRef inView );
The view to which the layout is to be applied.
An operating system result code.
Side bindings have no effect, but positioning and scaling are applied, in that order.
HIView.hChanges the attributes of a view.
OSStatus HIViewChangeAttributes ( HIViewRef inView, OptionBits inAttrsToSet, OptionBits inAttrsToClear );
The view whose attributes you want to change.
The attributes you want to change. For possible values, see “HIView Attributes.”
The attributes you want to clear. For possible values, see “HIView Attributes.”
An operating system result code.
You can set and clear attributes simultaneously.
HIView.h
Changes the features of a view.
OSStatus HIViewChangeFeatures ( HIViewRef inView, HIViewFeatures inFeaturesToSet, HIViewFeatures inFeaturesToClear );
The view whose features are to be changed.
The features that are to be set. For details, see “HIView Feature Constants.”
The features that are to be cleared. For details, see “HIView Feature Constants.”
An operating system result code.
The view itself typically controls its features. For example, the view might decide that under some situations it is opaque and in others it is transparent. In general entities outside of the view itself should not call this function. The only exception might be user-interface building tools that want to make sure a view always responds to clicks, for example, so it could override mouse tracking to drag items.
HIView.h
Changes the shape of a tracking area.
OSStatus HIViewChangeTrackingArea ( HIViewTrackingAreaRef inArea, HIShapeRef inShape );
The tracking area to change.
The shape to use. Pass NULL to use the entire structure region of the view.
An operating system result code.
HIView.h
Passes a mouse-down event to a view.
OSStatus HIViewClick ( HIViewRef inView, EventRef inEvent );
The view to handle the event.
The mouse event to handle.
An operating system result code.
After a successful call to HIViewGetViewForMouseEvent for a mouse down event, you should call this function to have the view handle the click. In general we recommend using the Standard Window Handler instead of calling this function yourself.
HIView.hConverts a point’s coordinates from one view to another.
OSStatus HIViewConvertPoint ( HIPoint *ioPoint, HIViewRef inSourceView, HIViewRef inDestView );
The point to convert.
The view whose coordinate system ioPoint is starting out in. You can pass NULL to indicate that ioPoint is a window-relative point.
The view whose coordinate system ioPoint should end up in. You can pass NULL to indicate that ioPoint is a window-relative point.
An operating system result code.
Both views must have a common ancestor, that is, they must both be in the same window.
HIView.hConverts a rectangle from one view to another.
OSStatus HIViewConvertRect ( HIRect *ioRect, HIViewRef inSourceView, HIViewRef inDestView );
The rectangle to convert.
The view whose coordinate system ioRect is starting out in. You can pass NULL to indicate that ioRect is a window-relative rectangle.
The view whose coordinate system ioRect should end up in. You can pass NULL to indicate that ioRect is a window-relative rectangle.
An operating system result code.
Both views must have a common ancestor, that is, they must both be in the same window.
HIView.hConverts a region from one view to another.
OSStatus HIViewConvertRegion ( RgnHandle ioRgn, HIViewRef inSourceView, HIViewRef inDestView );
The region to convert.
The view whose coordinate system ioRgn is starting out in. You can pass NULL to indicate that ioRgn is a window-relative region.
The view whose coordinate system ioRgn should end up in. You can pass NULL to indicate that ioRgn is a window-relative region.
An operating system result code.
Both views must have a common ancestor, that is, they must both be in the same window.
HIView.h
Copies the shape of a part of a view.
OSStatus HIViewCopyShape ( HIViewRef inView, HIViewPartCode inPart, HIShapeRef *outShape );
The view having a part whose shape is to be copied.
The part of the view whose shape is to be copied. For possible values, see “HIViewPartCode Constants.”
On exit, the newly created shape. You are responsible for releasing the copied shape.
An operating system result code.
HIView.h
Copies the text of a view.
CFStringRef HIViewCopyText ( HIViewRef inView );
The view whose text is to be copied.
A CFString containing a copy of the view’s text. The caller is responsible for releasing the CFString.
This function attempts to copy the text that is displayed when drawing the view and is generally successful on views that handle the kControlEditTextCFStringTag GetControlData tag. If this function can’t copy that text, it copies the text in the view’s title instead.
HIView.h
Returns the number of subviews embedded in a view.
CFIndex HIViewCountSubviews ( HIViewRef inView );
The view whose subviews are to be counted.
The number of subviews for the specified view.
HIView.hCreates a Core Graphics offscreen image of a view.
OSStatus HIViewCreateOffscreenImage ( HIViewRef inView, OptionBits inOptions, HIRect *outFrame, CGImageRef *outImage );
The view you want to create an image of.
Options. Currently you must pass zero.
The frame of the view within the resultant image. It is in the coordinate system of the image, where 0,0 is the top left corner of the image. This is so you can know exactly where the control is in the image when the control draws outside its bounds for things such as shadows.
The image of the view, including anything that would be drawn outside the view’s frame.
An operating system status code.
This function creates an CGImageRef for the specified view. The view and any of its children are rendered in the resultant image.
HIView.h
Disposes of an existing tracking area.
OSStatus HIViewDisposeTrackingArea ( HIViewTrackingAreaRef inArea );
The tracking area that is to be disposed of.
An operating system result code.
All tracking areas attached to a view are automatically disposed of when the view is disposed of, so you don’t need to dispose of a tracking area explicitly unless you want to remove it from a view before the view is disposed of.
After you call this function, the reference is invalid.
HIView.hDraws a Core Graphics image appropriately for a view.
OSStatus HIViewDrawCGImage ( CGContextRef inContext, const HIRect *inBounds, CGImageRef inImage );
The context to draw in.
The bounds to draw the image into.
The image to draw.
An operating system status code.
This function is similar to CGContextDrawImage, but it flips the context so that the image is drawn correctly. The origin of a view is at the top left corner, so you are really drawing upside-down. This call insulates you from that fact.
HIView.hObtains a view by its ID.
OSStatus HIViewFindByID ( HIViewRef inStartView, HIViewID inID, HIViewRef *outView );
The view to start searching at.
The ID of the view you are looking for.
Receives the control if found.
An operating system result code.
Allows you to find a particular view by its ID. The HIViewID type used by this function is identical to the ControlID type used by the Control Manager.
HIView.h
Flashes a window’s dirty area.
OSStatus HIViewFlashDirtyArea ( WindowRef inWindow );
The window whose dirty area is to be flashed.
An operating system result code.
As a debugging aid, this function flashes the area for an entire window that will be redrawn at the next draw time.
HIToolboxDebugging.hObtains the attributes for a view.
OSStatus HIViewGetAttributes ( HIViewRef inView, OptionBits *outAttrs );
The view to inspect.
The attributes of the view. For possible values, see “HIView Attributes.”
An operating system result code.
HIView.hObtains the local bounds of a view.
OSStatus HIViewGetBounds ( HIViewRef inView, HIRect *outRect );
The view whose local bounds are to be obtained.
The local bounds of the view.
An operating system result code.
The local bounds are the coordinate system that is completely view-relative. A view’s top left coordinate starts out at 0, 0. Most operations use local coordinates. Note, however, that the frame is used to move a view, not local coordinates.
HIView.h
Obtains the command ID of a view.
OSStatus HIViewGetCommandID ( HIViewRef inView, UInt32 *outCommandID );
The view whose command ID is to be obtained.
A pointer to a value of type UInt32 that, on return, contains the view’s command ID.
An operating system result code.
HIView.h
Returns the EventTargetRef for the specified view.
EventTargetRef HIViewGetEventTarget ( HIViewRef inView );
The view for which the EventTargetRef should be returned.
The EventTargetRef.
Once you obtain this reference, you can install an event handler and send events to the target.
HIView.h
Obtains the features of the specified view.
OSStatus HIViewGetFeatures ( HIViewRef inView, HIViewFeatures *outFeatures );
The view to query.
A pointer to a value of the HIViewFeatures that, on return, contains the view’s features. For more information, see “HIView Feature Constants.”
An operating system result code.
This function returns feature bits for the view but does not return older Control Manager features, such as kControlSupportsDataAccess.
HIView.h
Returns the first subview of a parent view.
HIViewRef HIViewGetFirstSubview ( HIViewRef inView );
The view whose subview you are fetching.
An HIView reference, or NULL if this view has no subviews or is invalid.
Returns the first subview of a container. The first subview is the topmost subview in z-order.
HIView.hObtains the part in the specified view that currently has focus.
OSStatus HIViewGetFocusPart ( HIViewRef inView, HIViewPartCode *outFocusPart );
The view to inquire about.
The part that currently has focus. For more information, see “HIViewPartCode Constants.”
An operating system result code.
HIView.hObtains the frame bounds of a view.
OSStatus HIViewGetFrame ( HIViewRef inView, HIRect *outRect );
The view whose frame you want to obtain.
The frame of the view.
An operating system result code.
The frame bounds is the bounds of a view relative to its parent’s local coordinate system.
HIView.h
Obtains the HIViewID of a view.
OSStatus HIViewGetID ( HIViewRef inView, HIViewID *outID );
The view whose validity is to be checked.
A pointer to a value of type HIViewID that, on return, contains the view’s HIViewID.
An operating system result code.
HIView.h
Obtains the subview of a view by index.
OSStatus HIViewGetIndexedSubview ( HIViewRef inView, CFIndex inSubviewIndex, HIViewRef *outSubview );
The view whose indexed subview is being requested.
The index of the requested subview.
A pointer to an HIViewRef that, on return, represents the indexed subview.
The number of subviews for the specified view.
Instead of calling HIViewGetIndexedSubview repeatedly, it may be more efficient to iterate through the subviews of a view with calls to HIViewGetFirstSubview and HIViewGetNextView.
HIView.h
Obtains the signature and kind of a view.
OSStatus HIViewGetKind ( HIViewRef inView, HIViewKind *outViewKind );
The view whose signature and kind is to be obtained.
A pointer to a HIViewKind structure that, on return, contains the view’s signature and kind. For details, see HIViewKind.
An operating system result code.
HIView.h
Returns the last subview in a parent view.
HIViewRef HIViewGetLastSubview ( HIViewRef inView );
The view whose subview you are fetching.
An HIView reference, or NULL if this view has no subviews or is invalid.
Returns the last subview of a container. The last subview is the bottommost subview in z-order.
HIView.h
Obtains the layout information of an view.
OSStatus HIViewGetLayoutInfo ( HIViewRef inView, HILayoutInfo *outLayoutInfo );
The view whose layout information is to be obtained.
A pointer to an HILayoutInfo into which to copy the view’s layout information. If the version field of this structure is not valid, the call will fail.
An operating system result code.
HIView.h
Obtains a view’s maximum value.
SInt32 HIViewGetMaximum ( HIViewRef inView );
The view whose maximum value is to be obtained.
The maximum value of the specified view.
HIView.h
Obtains the minimum value of a view.
SInt32 HIViewGetMinimum ( HIViewRef inView );
The view whose minimum value is to be obtained.
The minimum value of the specified view.
HIView.hDetermines whether a view needs to be redrawn.
Boolean HIViewGetNeedsDisplay ( HIViewRef inView );
The view to inspect.
A Boolean whose value is true if the view passed in or any of its subviews require redrawing; otherwise, false.
A view or subview requires redrawing if any part of the view or subview has been invalidated.
HIView.hReturns the view behind the specified view.
HIViewRef HIViewGetNextView ( HIViewRef inView );
The view to use as reference.
An HIView reference, or NULL if this view has no view behind it or is invalid.
Returns the view after the specified view, in z-order.
HIView.h
Obtains the optimal size and text placement of a view.
OSStatus HIViewGetOptimalBounds ( HIViewRef inView, HIRect *outBounds, CGFloat *outBaseLineOffset );
The view whose optimal size and text placement are to be obtained.
A pointer to a value of type HIRect that, on return, contains the view’s optimal bounds. Pass NULL if you don’t need this information.
A pointer to a value of type float that, on return, contains the view’s optimal text placement. Pass NULL if you don’t need this information.
An operating system result code.
HIView.hDetermines the part hit for a given point.
OSStatus HIViewGetPartHit ( HIViewRef inView, const HIPoint *inPoint, HIViewPartCode *outPart );
The view to test the part hit.
The view-relative point to use.
The part hit by inPoint.
An operating system result code.
Given a view, and a view-relative point, this function returns the part code hit as determined by the view.
HIView.hReturns the view above the specified view.
HIViewRef HIViewGetPreviousView ( HIViewRef inView );
The view to use as reference.
An HIView reference, or NULL if this view has no view in front of it or is invalid.
Returns the view before the specified view, in z-order.
HIView.h
Obtains the root view for a window.
HIViewRef HIViewGetRoot ( WindowRef inWindow );
The window to get the root for.
The root view for the window, or NULL if an invalid window is passed.
Note that the root view is not the same as the Control Manager root control.
HIView.hReturns the minimum and maximum size for a control.
OSStatus HIViewGetSizeConstraints ( HIViewRef inView, HISize *outMinSize, HISize *outMaxSize );
The view to inspect.
The minimum size the view can be.
The maximum size the view can be.
An operating system result code.
These sizes can, for example, be used to help auto-position subviews. To get meaningful results, the control must respond to the kEventControlGetSizeContraints event.
HIView.h
Returns the child of the given view hit by the point passed in.
OSStatus HIViewGetSubviewHit ( HIViewRef inView, const HIPoint *inPoint, Boolean inDeep, HIViewRef *outView );
The view you wish to position.
The mouse coordinate to use. This is passed in the local coordinate system of inView.
Pass true to find the deepest child hit, false to go only one level deep (just check direct children of inView).
The view hit by inPoint, or NULL if no subview was hit.
An operating system result code.
This function is more primitive than using HIViewGetViewForMouseEvent, and should be used only in non-event-handling cases.
HIView.hReturns a view’s parent view.
HIViewRef HIViewGetSuperview ( HIViewRef inView );
The view whose parent you are interested in getting.
An HIView reference, or NULL if this view has no parent or is invalid.
HIView.h
Obtains the ID of a tracking area.
OSStatus HIViewGetTrackingAreaID ( HIViewTrackingAreaRef inArea, HIViewTrackingAreaID *outID );
The tracking area whose ID is to be obtained.
On return, the ID for the tracking area specified by inArea.
An operating system result code.
The tracking area ID that is obtained is the value that was specified when HIViewNewTrackingArea was called to create the tracking area.
HIView.h
Obtains the value of a view.
SInt32 HIViewGetValue ( HIViewRef inView );
The view whose value is to be obtained.
The view’s value.
HIView.h
Returns the appropriate view to handle a mouse event.
OSStatus HIViewGetViewForMouseEvent ( HIViewRef inView, EventRef inEvent, HIViewRef *outView );
The view to start from. You should pass the window’s root view.
The mouse event in question.
The view that the mouse event should be sent to.
An operating system result code.
This function is a little higher-level than HIViewGetSubviewHit. This function finds the deepest view that should handle the mouse event. It also sends a Carbon event to each view asking it to return the appropriate subview, which allows parent views to catch clicks on their subviews. This function is the recommended function to use before processing mouse events. Using one of the more primitive functions may result in an undefined behavior.
HIView.h
Obtains the view size of a view.
SInt32 HIViewGetViewSize ( HIViewRef inView );
The view whose view size is to be obtained.
The view size.
The view size is the size of the content to which a view’s display is proportioned. The view size is commonly used to set the proportional size of a scroll bar’s thumb indicator.
HIView.h
Obtains a reference to the window to which the specified view is bound.
WindowRef HIViewGetWindow ( HIViewRef inView );
The view to query.
An operating system result code, or NULL if the view reference specified by inView is invalid or if the view is not bound to any window.
HIView.h
Determines whether a view is active.
Boolean HIViewIsActive ( HIViewRef inView, Boolean *outIsLatentActive );
The view that is to be queried.
A pointer to a Boolean that, on return, is set to true if the view is latently active or false if the view is not latently active. Pass NULL if you don’t need this information.
A Boolean whose value indicates whether the view is active (true) or not (false).
A view’s active state is affected by the active state of its parents. If HIViewIsActive finds that any parent view is inactive, it returns false to indicate that the view specified by inView is considered to be inactive too. In addition, HIViewIsActive can optionally check to see if a view is latently active, even if the view’s parents are inactive.
HIView.h
Determines whether compositing is enabled for a view.
Boolean HIViewIsCompositingEnabled ( HIViewRef inView );
The view that is to be queried.
A Boolean whose value indicates whether compositing is enabled (true) or not (false).
Checking a window’s kWindowCompositingAttribute attribute is not sufficient for determining whether a view is in compositing or non-compositing mode because some of a window’s views can be in either mode at the same time. Call this function to determine the current compositing mode of a view.
HIView.hDetermines if drawing is currently enabled for a view.
Boolean HIViewIsDrawingEnabled ( HIViewRef inView );
The view to get the drawing state for.
A Boolean value indicating that drawing is on (true) or off (false).
HIView.h
Determines whether a view is enabled.
Boolean HIViewIsEnabled ( HIViewRef inView, Boolean *outIsLatentEnabled );
The view to query.
A pointer to a Boolean that, on return, is set to true if the view is latently enabled or false if the view is not latently enabled. Pass NULL if you don’t need this information.
A Boolean whose value indicates whether the view is enabled (true) or not (false).
A view’s enabled state is affected by the enabled state of its parents. If HIViewIsEnabled finds that any parent view is disabled, it returns false to indicate that the view specified by inView is considered to be disabled too. In addition, HIViewIsEnabled can optionally check to see if a view is latently enabled, even if its parents are disabled.
HIView.h
Determines whether a view is latently visible.
Boolean HIViewIsLatentlyVisible ( HIViewRef inView );
The view whose latent visibility is to be queried.
A Boolean value indicating whether the view is latently visible (true) or hidden (false).
A view’s visibility is affected by the visibility of its parents. If any parent view is invisible, the view specified by inView is considered to be invisible too. HIViewIsLatentlyVisible returns whether a view is latently visible, even if its parents are invisible.
HIView.h
Determines whether layout handling is active or suspended.
Boolean HIViewIsLayoutActive ( HIViewRef inView );
The view for which the status of layout handling is to be determined.
A Boolean whose value is true if the view would respond to any linked relative’s changes; otherwise false.
A view’s layout active state is also affected by the layout active state of its parents. If a parent view has an inactive layout, this view is also considered to have an inactive layout. To determine the latent active state of a view, see HIViewIsLayoutLatentlyActive.
Note that this function does not determine whether the view’s layout is valid.
HIView.h
Determines whether layout handling is latently active or suspended.
Boolean HIViewIsLayoutLatentlyActive ( HIViewRef inView );
The view for which the status of layout handling is to be determined.
A Boolean whose value is true if the view would latently respond to any linked relative’s changes; otherwise false.
This function determines whether a view’s layout is latently active, even if one of its parent’s layouts is not active.
HIView.h
Determines whether the specified view is known to the HIToolbox.
Boolean HIViewIsValid ( HIViewRef inView );
The view to check.
A Boolean whose value is true if the view is known to the HIToolbox; otherwise, false.
This function does not check the data in the view for validity.
HIView.hDetermines whether a view is visible.
Boolean HIViewIsVisible ( HIViewRef inView );
The view whose visibility you want to determine.
A Boolean value indicating whether the view is visible (true) or hidden (false).
HIViewIsVisible returns the effective visibility of a view, which is determined both by the view’s own visibility and the visibility of its parent views. If a parent view is invisible, this view is considered to be invisible too.
HIView.h
Move a view by the specified distance relative to its current location.
OSStatus HIViewMoveBy ( HIViewRef inView, CGFloat inDX, CGFloat inDY );
The view you want to move.
The horizontal distance to move the view. Negative values move the view to the left, positive values to the right.
The vertical distance to move the view. Negative values move the view up, positive values down.
An operating system result code.
This function affects the view’s frame but does not affect the view’s bounds.
HIView.h
Creates a new tracking area for a view.
OSStatus HIViewNewTrackingArea ( HIViewRef inView, HIShapeRef inShape, HIViewTrackingAreaID inID, HIViewTrackingAreaRef *outRef );
The view for which a new tracking area is to be created.
The shape to use. Pass NULL to use the entire structure region of the view. On return, you may safely release the shape.
An identifier for the new tracking area. You can specify any value you want, or zero if you don’t want to associate an identifier with the new tracking area.
On return, a reference to the new tracking area. In Mac OS X v10.5 and later, you may pass NULL if you don't need this information. The new tracking area is automatically destroyed when the view is released; you do not need to dispose of the tracking area yourself unless you remove it from the view before the view is released.
An operating system result code.
HIView.hPlaces a view at an absolute location within its parent.
OSStatus HIViewPlaceInSuperviewAt ( HIViewRef inView, CGFloat inX, CGFloat inY );
The view you want to position.
The absolute horizontal coordinate at which to position the view.
The absolute vertical coordinate at which to position the view.
An operating system result code.
This function affects the view’s frame but does not affect the view’s bounds.
HIView.hInforms the system that a region of the view has changed.
OSStatus HIViewRegionChanged ( HIViewRef inView, HIViewPartCode inRegionCode );
The view whose region changed.
The region that changed. At present, the region can only be the structure, opaque, and clickable regions. For possible constants, see “HIView Meta-Parts Constants.”
An operating system result code.
The view system may respond to the information provided by this function in some way. For example, if a view’s clickable region changes, call this function to tell the Toolbox to resynchronize the region it uses for asynchronous window dragging (if enabled). Likewise, if a view’s opaque region changes, call this function to adjust the window’s opaque shape.
You don’t need to call this function when a view is moved or resized because the HIToolbox automatically handles those kinds of changes.
HIView.h
Removes a view from its parent.
OSStatus HIViewRemoveFromSuperview ( HIViewRef inView );
The view to remove.
An operating system result code.
The subview that is removed from the parent is not released and still exists.
HIView.h
Renders the invalid portions of a view.
OSStatus HIViewRender ( HIViewRef inView );
The view that is to be rendered.
An operating system result code.
Normally, areas are redrawn at event loop time, but there might be times when an immediate redraw is needed. You should call this function sparingly because it does a fully composited redraw for the area of the view. That is, all other views that intersect the area of the specified view are also redrawn. Calling this function for several views at a particular level of a hierarchy would be costly, so you should only pass the root view of a window to this function.
The behavior of this function when passed a non-root view changed in Mac OS X v10.4. In Mac OS X v10.3, when called on a non-root view, this function validated all of the views in the window that intersect the specified view, including portions that did not intersect the specified view. Consequently, all of the views were not actually redrawn. In Mac OS X v10.4, when called on a non-root view, this function only validates those portions of each view that intersect the specified view.
HIView.h
Informs the system that the structure region of the given view has changed shape.
OSStatus HIViewReshapeStructure ( HIViewRef inView );
The view to reshape and invalidate.
An operating system result code.
This function is used by custom views. If a view decides that its structure will change shape, it should call this function. This tells the toolbox to recalculate and invalidate as appropriate. You might, for example, call this function when gaining or losing a focus ring.
HIView.h
Resumes layout handling for a view and its children.
OSStatus HIViewResumeLayout ( HIViewRef inView );
The view for which layout handling is to be resumed.
An operating system result code.
HIView.hScrolls a view’s contents, or a portion thereof.
OSStatus HIViewScrollRect ( HIViewRef inView, const HIRect *inRect, CGFloat inDX, CGFloat inDY );
The view to scroll.
The rect to scroll. Pass NULL to mean the entire view. The rect passed cannot be bigger than the view's bounds. It must be in the local coordinate system of the view.
The horizontal distance to scroll. Positive values shift to the right, negative values shift to the left.
The vertical distance to scroll. Positive values shift downward, negative values shift upward.
An operating system result code.
This function blits the contents of the view as appropriate to scroll and then invalidates those portions that need to be redrawn. Be warned that this is a raw bit scroll. Anything that overlaps the target view will be scrolled as well.
HIView.h
Sets a view to be active or inactive.
OSStatus HIViewSetActivated ( HIViewRef inView, Boolean inSetActivated );
The view that is to be set.
A Boolean whose value is true to set the view to be active or false to set the view to be inactive.
An operating system result code.
This function affects the effective activation of a view, which affects the effective activation of the view’s children. If the view is being set to inactive, all children become inactive as well, but their latent activation does not change. If the children are latently inactive and the view is made active, the children remain latently inactive.
HIView.hSets the origin of the view.
OSStatus HIViewSetBoundsOrigin ( HIViewRef inView, CGFloat inX, CGFloat inY );
The view whose origin you wish to adjust.
The X coordinate.
The Y coordinate.
An operating system result code.
This effectively also moves all subcontrols of a view as well. This call will not invalidate the view, in case you might want to move the contents with HIViewScrollRect instead of redrawing the complete content.
HIView.h
Sets the command ID of a view.
OSStatus HIViewSetCommandID ( HIViewRef inView, UInt32 inCommandID );
The view whose command ID is to be set.
The command ID to set.
An operating system result code.
HIView.hTurns control drawing on or off.
OSStatus HIViewSetDrawingEnabled ( HIViewRef inView, Boolean inEnabled );
The view to enable or disable drawing for.
A Boolean value indicating whether drawing should be on (true) or off (false).
An operating system result code.
You can use this function to ensure that no drawing events are sent to the specified control. Functions such as Draw1Control and HIViewSetNeedsDisplay cannot draw when control drawing is off.
HIView.h
Enables or disables a view.
OSStatus HIViewSetEnabled ( HIViewRef inView, Boolean inSetEnabled );
The view that is to be set.
A Boolean whose value is true to enable the view or false to disable the view.
An operating system result code.
Any subviews of the view specified by inView become enabled or disabled in accordance with the value of inSetEnabled.
HIView.hSets the subview that is first to receive keyboard focus.
OSStatus HIViewSetFirstSubViewFocus ( HIViewRef inParent, HIViewRef inSubView );
The parent view.
The first subview that is to receive keyboard focus. Pass NULL to tell the view system to use the default rules.
An operating system result code.
This function sets the first subview to shift focus to whenever the keyboard focus is advanced and the container view is entered.
HIView.hSets the frame of a view.
OSStatus HIViewSetFrame ( HIViewRef inView, const HIRect *inRect );
The view whose frame is to be set.
The new frame to set.
An operating system result code.
This function effectively moves the view within its parent. It also marks the view (and anything that was exposed behind it) to be redrawn.
HIView.h
Sets highlighting on a view.
OSStatus HIViewSetHilite ( HIViewRef inView, HIViewPartCode inHilitePart );
The view for which highlighting is to be set.
The part of the view whose highlighting is to be set. For possible values, see “HIViewPartCode Constants.”
An operating system result code.
HIView.h
Sets the HIViewID of a view.
OSStatus HIViewSetID ( HIViewRef inView, HIViewID inID );
The view whose HIViewID is to be set.
The HIViewID to set.
An operating system result code.
HIView.h
Sets the layout information of an HIView.
OSStatus HIViewSetLayoutInfo ( HIViewRef inView, const HILayoutInfo *inLayoutInfo );
The view whose layout information is to be set.
A pointer to an HILayoutInfo structure containing the layout values that are to be set.
An operating system result code.
Layouts are used to automatically change the size and positioning of a view when another view changes size or position. Layout changes only take effect in two cases:
When HIViewApplyLayout is called after the view’s layout has been set by calling HIViewSetLayoutInfo. The HIViewApplyLayout function is most useful when first applying a scaling or positioning layout to a view in order to set up the view’s initial position and size relative to the view referenced in the layout.
When the related view changes its size or position.
A layout allows a view’s size or position to be modified in three ways: side binding, axial scaling, and axial positioning. In the following examples, View A initially has a left side of 100 and a right side of 150, and is placed inside a parent view that has a width of 275.
Bindings — Setting up a binding relationship between two views specifies that one edge of a view is to change by an amount equal to the change in an edge of another view. If View A has a right-side binding to its parent’s maximum (or right) side, when the parent’s right side changes, View A’s right side changes by the same amount. If the parent view resizes to be 325 units wide (50 units wider than before), View A is resized so that its left side changes to 150 units and its right side changes to 200, which is 50 units more to the right than before. You can think of bindings as a way to maintain distance. An edge bound to another view’s edge always maintains its offset from that related edge. In other view systems, this concept is often referred to as “springs and rods.” Note that a binding does not cause one side of the view to exactly align with the side of another view; a binding merely causes one side of the view to change by the same amount as another view changes. To align one edge of a view to another view’s edge, use positioning. Bindings depend on changes in size or position of the related view. As a result, calling HIViewApplyLayout does not activate side bindings, as no changes have occurred. Bindings are implemented using the HIBinding structure and one HISideBinding structure per view edge.
Scaling — Setting up a scaling relationship between two views specifies that the axial size (that is, the width or height) of a view is to be a specified ratio of the size of another view when that other view moves or resizes. If View A has an x-axis scaling for its parent view with a ratio of 0.8, when the parent view’s width changes, View A’s width changes to be the parent’s width multiplied by 0.8. If the parent view resizes to be 325 units wide, View A resizes so that its left side stays at 100 and its right side changes to 360 (100 + 325 * 0.8). Note that when a scaling layout is first set up on a view with HIViewSetLayoutInfo, no scaling is applied to the view because scaling only occurs when the related view resizes. If scaling is required at initial setup, call HIViewSetLayoutInfo and then HIViewApplyLayout. Scaling is implemented using the HIScaling structure and one HIAxisScale structure per view axis.
Positioning — Setting up a positioning relationship between two views specifies that the axial position (i.e., vertical or horizontal) of a view is to change so that the view aligns with the minimum, maximum, or center of another view when that other view resizes. If View A has an x-axis position with its parent view with center positioning specified, when the parent view changes size, View A moves so that it is centered horizontally relative to its parent. If the parent view resizes to be 300 units wide, View A repositions so that its left side is at 125 and its right side is at 175, centered in the parent view. Positioning is implemented using the HIPositioning structure and one HIAxisPosition per view axis.
The HIView layout engine applies transformations to a view sequentially. First, bindings are applied. Then scaling is applied, which could override some of the previously applied bindings. Then positioning is applied, which could also override some of the previously applied bindings. The bindings are applied recursively to a container’s subviews, which requires care on your part to avoid infinite recursion, especially when applying inter-relational bindings. For example, if View A’s x axis is scaled relative to View B and View B’s x-axis is scaled to View A, your application could hang when the layouts are applied because View A would affect View B, which would affect View A, and so on.
For more information on using the layout engine, see HIView Programming Guide.
HIView.h
Sets a view’s maximum value.
OSStatus HIViewSetMaximum ( HIViewRef inView, SInt32 inMaximum );
The view whose maximum value is to be set.
The maximum value to set.
An operating system result code.
HIView.h
Sets a view’s minimum value.
OSStatus HIViewSetMinimum ( HIViewRef inView, SInt32 inMinimum );
The view whose minimum value is to be set.
The value to set as the view’s minimum value.
An operating system result code.
HIView.hMarks a view as needing or not needing to be redrawn.
OSStatus HIViewSetNeedsDisplay ( HIViewRef inView, Boolean inNeedsDisplay );
The view to mark as dirty (needing to be redrawn) or clean (not needing to be redrawn).
A Boolean whose value is true to mark the view as dirty or false to mark it as clean.
An operating system result code.
If the view is not visible or is obscured completely by other views, no action is taken.
HIView.h
Uses an HIRect to mark a portion of a view as needing or not needing to be redrawn.
OSStatus HIViewSetNeedsDisplayInRect ( HIViewRef inView, const HIRect *inRect, Boolean inNeedsDisplay );
The view having a region that is to be marked as dirty (needs to be redrawn) or clean (valid and not needing to be redrawn).
The area, in view-relative coordinates, that is to be marked.
A Boolean whose value is true to mark the area described by inRect as dirty or false to mark it as clean.
An operating system result code.
If the view is not visible or is obscured completely by other views, no action is taken. The area specified by inRect is intersected with the view’s visible region.
HIView.h
Uses a region to mark a portion of a view as needing or not needing to be redrawn.
OSStatus HIViewSetNeedsDisplayInRegion ( HIViewRef inView, RgnHandle inRgn, Boolean inNeedsDisplay );
The view having a region that is to be marked as dirty (needs to be redrawn) or clean (valid and not needing to be redrawn).
The region, in view-relative coordinates, to mark as dirty or clean.
A Boolean whose value is true to mark the region described by inRgn as dirty or false to mark it as clean.
An operating system result code.
If the view is not visible or is obscured completely by other views, no action is taken. The specified region is effectively intersected with the view’s visible region.
HIView.h
Uses a shape to mark a portion of a view as needing or not needing to be redrawn.
OSStatus HIViewSetNeedsDisplayInShape ( HIViewRef inView, HIShapeRef inArea, Boolean inNeedsDisplay );
The view having a shape that is to be marked as dirty (needs to be redrawn) or clean (valid and not needing to be redrawn).
The area, in view-relative coordinates, that is to be marked.
A Boolean whose value is true to mark the area described by inArea as dirty or false to mark it as clean.
An operating system result code.
If the view is not visible or is obscured completely by other views, no action is taken. The area specified by inArea is intersected with the view’s visible region.
HIView.hSets the view that is to receive keyboard focus when keyboard focus advances from the specified view.
OSStatus HIViewSetNextFocus ( HIViewRef inView, HIViewRef inNextFocus );
The view.
The view that is to receive keyboard focus when focus is advanced from the view specified by inView. The view must have the same parent as the view specified by inView. Pass NULL to tell the view system to use the default rules.
An operating system result code.
This function sets the view to which keyboard focus is to be shifted the next time keyboard focus is advanced from the view specified by inView.
HIView.h
Sets the text of a view to the specified string.
OSStatus HIViewSetText ( HIViewRef inView, CFStringRef inText );
The view whose text is to be set.
The text that is to be set.
An operating system result code.
This function attempts to set the text that is displayed when drawing the view and is generally successful on views that handle the kControlEditTextCFStringTag SetControlData tag. If this function can’t set that text, it sets the text in the view’s title instead.
HIView.h
Sets the value of a view.
OSStatus HIViewSetValue ( HIViewRef inView, SInt32 inValue );
The view whose value is to be set.
The value to set.
An operating system result code.
HIView.h
Sets the view size of a view.
OSStatus HIViewSetViewSize ( HIViewRef inView, SInt32 inViewSize );
The view whose view size is to be set.
The view size that is to be set.
An operating system result code.
The view size is the size of the content to which a view’s display is proportioned. The view size is commonly used to set the proportional size of a scroll bar’s thumb indicator.
HIView.hHides or shows a view.
OSStatus HIViewSetVisible ( HIViewRef inView, Boolean inVisible );
The view to hide or show.
A Boolean value that indicates whether you want to hide the view (false) or show the view (true).
An operating system result code.
Marks the area the view will occupy or previously occupied as needing to be redrawn later.
HIView.hChanges the front-to-back ordering of sibling views.
OSStatus HIViewSetZOrder ( HIViewRef inView, HIViewZOrderOp inOp, HIViewRef inOther );
The view whose Z-order you want to change.
Causes inView to be ordered above or below inOther. For possible values, see “HIView Z-Ordering Constants.”
Another optional view to use as a reference. Pass NULL to indicate an absolute position.
An operating system result code.
For example, passing kHIViewZOrderAbove as the value on inOp and NULL as the value of inOther moves a view to the front of all of its siblings. Passing kHIViewZOrderBelow as the value of inOp and NULL as the value of inOther moves a view to the back of all its siblings.
HIView.hSimulates a mouse click on a given view.
OSStatus HIViewSimulateClick ( HIViewRef inView, HIViewPartCode inPartToClick, UInt32 inModifiers, HIViewPartCode *outPartClicked );
The view to test the part hit.
The part the view should consider to be clicked.
The modifiers the view can consider for its click action.
The part that was hit; can be kHIViewNoPart if no action occurred. For possible values, see “HIViewPartCode Constants.” Pass NULL if you don’t need the part code returned.
An operating system result code.
This function is used to simulate a mouse click on a given view. It sends a kEventControlSimulateHit event to the specified view and also sends kEventControlHit and (if the Hit event is not handled) kEventCommandProcess events.
Note that not all windows respond to the events that this API sends. A fully Carbon-event-based window most likely responds exactly as if the user had really clicked in the view. A window that uses Classic event record-based APIs (WaitNextEvent or ModalDialog) typically does not respond at all. To simulate a click in such a window, you may need to post a mouse-down/mouse-up pair or use a Dialog Manager event filter proc to simulate a hit in a dialog item.
HIView.hDetermines whether a view or any subviews have keyboard focus.
Boolean HIViewSubtreeContainsFocus ( HIViewRef inSubtreeStart );
The view to query.
A Boolean whose value is true if the view or any of its children have keyboard focus; otherwise, false.
HIView.h
Suspends layout handling for a view and its children.
OSStatus HIViewSuspendLayout ( HIViewRef inView );
The view for which layout handling is to be suspended.
An operating system result code.
HIView.hStructure that stores the layout of an HIView.
struct HILayoutInfo {
UInt32 version;
HIBinding binding;
HIScaling scale;
HIPositioning position;
};
versionThe version of this structure. The current version is kHILayoutInfoVersionZero.
bindingAn HIBinding structure describing the bindings to apply to the sides of an HIView.
scaleAn HIScaling structure describing the axial scaling to apply to an HIView.
positionAn HIPositioning structure describing the positioning to apply to an HIView.
This structure is provided as a parameter to HIViewGetLayoutInfo and HIViewSetLayoutInfo.
Represents a set of top, left, bottom, and right bindings for an view.
struct HIBinding {
HISideBinding top;
HISideBinding left;
HISideBinding bottom;
HISideBinding right;
};
topThe top side bindings.
leftThe left side bindings.
bottomThe bottom side bindings.
rightThe right side bindings.
These constants are used in conjunction with the HIView layout engine.
Structure for storing the binding for the side of a view.
struct HISideBinding {
HIViewRef toView;
HIBindingKind kind;
float offset;
};
toViewAn HIViewRef to the view to which this side is bound. This field can be NULL, which indicates that the side is bound to its parent view.
kindThe bind kind. For possible values, see “HILayout Binding Kind Constants.”
offsetReserved; must be set to zero.
The layout engine can automatically reposition and resize views for which relationships have been set up. (Call HIViewSetLayoutInfo to establish these relationships.) A side binding is entirely related to the change of the parent’s position or size but only as the size affects the maximum edge position. A side binding doesn’t mean “move to where my relative’s side is” but rather “move as my relative’s side has moved.”
A set of scaling descriptions for the axes of a view.
struct HIScaling {
HIAxisScale x;
HIAxisScale y;
};
xThe horizontal scaling for a view.
xThe vertical scaling for a view.
Represents a scale description for an axis of a view.
struct HIAxisScale {
HIViewRef toView;
HIScaleKind kind;
float ratio;
};
toViewAn HIViewRef to the view to which this axis is scaled. This field can be NULL, which indicates that the axis is scaled relative to its parent’s view.
kindThe type of scaling. Currently, this field must be kHILayoutScaleAbsolute.
ratioA value that indicates how much to scale the view. Zero indicates no scaling. A value of one indicates that the view is to always have the same axial size.
A positioning description for an HIView.
struct HIPositioning {
HIAxisPosition x;
HIAxisPosition y;
};
xThe X axis.
yThe Y axis.
An axial position description for an HIView.
struct HIAxisPosition {
HIViewRef toView;
HIPositionKind kind;
float offset;
};
toViewAn HIViewRef to the view relative to which a view positioned. This field can be NULL, which indicates that the axis is positioned relative to its parent’s view.
kindThe type of positioning. For possible values, see “HIPositionKind Constants.”
offsetAfter the position kind has been applied, the origin component that corresponds to the positioning axis is offset by this value. For example, left aligned + 10.
Describes the content of a view.
struct HIViewContentInfo {
HIViewContentType contentType;
union {
IconSuiteRef iconSuite;
IconRef iconRef;
CGImageRef imageRef;
} u;
};
typedef struct HIViewContentInfo HIViewContentInfo;
typedef HIViewContentInfo * HIViewContentInfoPtr;
contentTypeThe type of content in the union. For possible values, see “HIViewContentType Constants.”
HIView.h
Defines the HIView ID.
typedef ControlID HIViewID;
HIView.h
Describes the offsets from the structure to the content area of a view.
struct HIViewFrameMetrics {
float top;
float left;
float bottom;
float right;
};
topHeight of the top of the structure area.
leftWidth of the left of the structure area.
bottomHeight of the bottom of the structure area.
rightWidth of the right of the structure area.
The top metric is the difference between the vertical coordinate of the top edge of the view’s structure region and the vertical coordinate of the top edge of the view’s content region. This structure is returned by a view in response to a kEventControlGetFrameMetrics event.
Represents the signature and kind of the view.
struct HIViewKind {
OSType signature;
OSType kind;
}
signatureThe signature of the view. Apple reserves all signatures made up of only lowercase characters.
kindThe kind of the view. Apple reserves all kinds made up of only lowercase characters.
Define an HIView reference.
typedef ControlRef HIViewRef;
HIObject.h
Define an HIView tracking area reference.
typedef struct OpaqueHIViewTrackingAreaRef HIViewTrackingAreaRef;
HIView.h
Define an HIView tracking area ID.
typedef UInt64 HIViewTrackingAreaID;
HIView.hSpecify class identifiers for view-related subclasses of HIObject.
#define kHIViewClassID CFSTR("com.apple.hiview")
#define kHIGrowBoxViewClassID CFSTR("com.apple.higrowboxview")
#define kHIImageViewClassID CFSTR("com.apple.HIImageView")
#define kHIMenuViewClassID CFSTR("com.apple.HIMenuView")
#define kHIStandardMenuViewClassID CFSTR("com.apple.HIStandardMenuView")
#define kHISegmentedViewClassID CFSTR("com.apple.HISegmentedView")
#define kHIScrollViewClassID CFSTR("com.apple.HIScrollView")
#define kHIComboBoxClassID CFSTR("com.apple.HIComboBox")
#define kHISearchFieldClassID CFSTR("com.apple.HISearchField")
#define kHICocoaViewClassID CFSTR("com.apple.HICocoaView")
kHIViewClassIDClass identifier for the HIView class.
Available in Mac OS X v10.2 and later.
Declared in HIView.h.
kHIGrowBoxViewClassIDClass identifier for the HIGrowBoxView class.
Available in Mac OS X v10.2 and later.
Declared in HIWindowViews.h.
kHIImageViewClassIDClass identifier for the HIImageView class.
Available in Mac OS X v10.3 and later.
Declared in HIImageViews.h.
kHIMenuViewClassIDClass identifier for the HIMenuView class.
Available in Mac OS X v10.3 and later.
Declared in HIMenuView.h.
kHIStandardMenuViewClassIDClass identifier for the HIStandardMenuView class.
Available in Mac OS X v10.3 and later.
Declared in HIMenuView.h.
kHISegmentedViewClassIDClass identifier for the HISegmentedView class.
Available in Mac OS X v10.3 and later.
Declared in HISegmentedView.h.
kHIScrollViewClassIDClass identifier for the HIScrollView class.
Available in Mac OS X v10.3 and later.
Declared in HIScrollView.h.
kHIComboBoxClassIDClass identifier for the HIComboBox class.
Available in Mac OS X v10.3 and later.
Declared in HIComboBox.h.
kHISearchFieldClassIDClass identifier for the HISearchField class.
Available in Mac OS X v10.3 and later.
Declared in HISearchField.h.
kHICocoaViewClassIDClass identifier for the HICocoaView class.
Available in Mac OS X v10.5 and later.
Declared in HICocoaView.h.
Specify the constant for changes in date or time in the clock control (kEventClassClockView).
enum {
kEventClockDateOrTimeChanged = 1
};
kEventClockDateOrTimeChangedAn event sent by the clock control when the user changes the date or time. Clients can register for this notification in order to update state based on the date or time in the clock. This event is sent to the view only; it is not propagated. The event is sent to all handlers installed on the control.
Available in Mac OS X v10.4 and later.
Declared in HIClockView.h.
Table 1 shows the event parameters associated with this event.
Event kind |
Parameter name |
Parameter type |
|
|
|
Specify constants for combo box attributes.
enum {
kHIComboBoxNoAttributes = 0L,
kHIComboBoxAutoCompletionAttribute = (1L << 0),
kHIComboBoxAutoDisclosureAttribute = (1L << 1),
kHIComboBoxAutoSortAttribute = (1L << 2),
kHIComboBoxAutoSizeListAttribute = (1L << 3),
kHIComboBoxStandardAttributes = (kHIComboBoxAutoCompletionAttribute |
kHIComboBoxAutoDisclosureAttribute | kHIComboBoxAutoSizeListAttribute)
};
kHIComboBoxNoAttributesIndicates the lack of any attributes.
Available in Mac OS X v10.2 and later.
Declared in HIComboBox.h.
kHIComboBoxAutoCompletionAttributeThe control will attempt to auto complete the text the user is typing with an item in the combo box list that is the closest appropriate match.
Available in Mac OS X v10.2 and later.
Declared in HIComboBox.h.
kHIComboBoxAutoDisclosureAttributeThe control will disclose the combo box list after the user enters text.
Available in Mac OS X v10.2 and later.
Declared in HIComboBox.h.
kHIComboBoxAutoSortAttributeThe items in the combo box list will be automatically sorted in alphabetical order.
Available in Mac OS X v10.2 and later.
Declared in HIComboBox.h.
kHIComboBoxAutoSizeListAttributeThe combo box list will be automatically sized to fit the Human Interface Guidelines.
Available in Mac OS X v10.2 and later.
Declared in HIComboBox.h.
kHIComboBoxStandardAttributesThe minimum set of commonly used combo box attributes.
Available in Mac OS X v10.2 and later.
Declared in HIComboBox.h.
Specify constants for combo box data tags.
enum {
kHIComboBoxListTag = 'cbls',
kHIComboBoxListPixelWidthTag = 'cblw',
kHIComboBoxListPixelHeightTag = 'cblh',
kHIComboBoxNumVisibleItemsTag = 'cbni'
};
kHIComboBoxListTagExtract the contents of the combo box list as a CFArray. The CFArray is retained; if you get the array, you own it and must release it. If you set it by calling SetControlData, the toolbox makes a copy of it, and you are free to release your reference. The reference count is bumped on get/retains on set.
Available in Mac OS X v10.2 and later.
Declared in HIComboBox.h.
kHIComboBoxListPixelWidthTagA UInt32 containing the width of the combo box list. The width can be customized. This tag disables the auto size attribute.
Available in Mac OS X v10.2 and later.
Declared in HIComboBox.h.
kHIComboBoxListPixelHeightTagA UInt32 containing the height of the combo box list. The height can be customized. This tag disables the auto size attribute.
Available in Mac OS X v10.2 and later.
Declared in HIComboBox.h.
kHIComboBoxNumVisibleItemsTagA UInt32 containing the number of visible items in the combo box list. The number can be customized. This tag disables the auto size attribute.
Available in Mac OS X v10.2 and later.
Declared in HIComboBox.h.
The combo box view also supports these tags previously defined for the EditUnicodeText control. These tags are available through GetControlData and SetControlData with a ControlPartCode of kHIComboBoxEditTextPart:
kControlFontStyleTag
kControlEditTextFixedTextTag
kControlEditTextTextTag
kControlEditTextKeyFilterTag
kControlEditTextValidationProcTag
kControlEditUnicodeTextPostUpdateProcTag
kControlEditTextSelectionTag
kControlEditTextKeyScriptBehaviorTag
kControlEditTextCharCount
kControlEditTextCFStringTag
Specify a constant for combo box list item events (kEventClassHIComboBox).
enum {
kEventComboBoxListItemSelected = 1,
kEventParamComboBoxListSelectedItemIndex = 'cbli'
};
kEventComboBoxListItemSelectedThis event is sent as a notification when an item in the combo box disclosure list has been selected. This event is sent to all handlers installed on the control. This does not imply that the selection has been accepted; for that you will need to register for the kEventClassTextField/kEventTextAccepted event.
Available in Mac OS X v10.4 and later.
Declared in HIComboBox.h.
kEventParamComboBoxListSelectedItemIndexIndicates the index of a selected combo box list item.
Available in Mac OS X v10.4 and later.
Declared in HIComboBox.h.
Table 2 shows the event parameters associated with these events.
Event kind |
Parameter name |
Parameter type |
|
|
|
|
|
Specify constants for combo box part codes.
enum {
kHIComboBoxEditTextPart = 5,
kHIComboBoxDisclosurePart = 28
};
kHIComboBoxEditTextPartEdit text part.
Available in Mac OS X v10.2 and later.
Declared in HIComboBox.h.
kHIComboBoxDisclosurePartDisclosure part.
Available in Mac OS X v10.2 and later.
Declared in HIComboBox.h.
Combo box part code constants are used when calling HIViewSetHilite, HIViewCopyShape and are returned by HIViewRegionChanged, HIViewGetFocusPart. They are also used by the hit testing functions, HIViewSimulateClick and HIViewGetPartHit.
Specify constants for control kinds.
enum {
kControlKindHIScrollView = 'scrl',
kControlKindHIImageView = 'imag',
kControlKindHIComboBox = 'cbbx',
kControlKindHISearchField = 'srfd',
kControlKindHIMenuView = 'menu',
kControlKindHIStandardMenuView = 'smnu',
kHISegmentedViewKind = 'sgmt',
kControlKindHIGrowBoxView = 'grow',
kControlKindHICocoaView = 'hins'
};
kControlKindHIScrollViewControl kind for a scroll view.
Available in Mac OS X v10.4 and later.
Declared in HIScrollView.h.
kControlKindHIImageViewControl kind for an image view.
Available in Mac OS X v10.4 and later.
Declared in HIImageViews.h.
kControlKindHIComboBoxControl kind for a combo box.
Available in Mac OS X v10.2 and later.
Declared in HIComboBox.h.
kControlKindHISearchFieldControl kind for a search field.
Available in Mac OS X v10.3 and later.
Declared in HISearchField.h.
kControlKindHIMenuViewControl kind for a menu view.
Available in Mac OS X v10.4 and later.
Declared in HIMenuView.h.
kControlKindHIStandardMenuViewControl kind for a standard menu view.
Available in Mac OS X v10.4 and later.
Declared in HIMenuView.h.
kHISegmentedViewKindControl kind for a segmented view.
Available in Mac OS X v10.3 and later.
Declared in HISegmentedView.h.
kControlKindHIGrowBoxViewControl kind for a grow box view.
Available in Mac OS X v10.4 and later.
Declared in HIWindowViews.h.
kControlKindHICocoaViewControl kind for a view that wraps a Cocoa view.
Available in Mac OS X v10.5 and later.
Declared in HICocoaView.h.
These constants are returned by HIViewGetKind and GetControlKind.
Specify event class constants.
enum {
kEventClassClockView = 'cloc',
kEventClassScrollable = 'scrl',
kEventClassHIComboBox = 'hicb',
kEventClassSearchField = 'srfd',
kEventClassTextField = 'txfd'
};
kEventClassClockViewEvent class for events related to a clock view.
Available in Mac OS X v10.4 and later.
Declared in HIClockView.h.
kEventClassScrollableEvent class for events related to a scrollable view.
Available in Mac OS X v10.2 and later.
Declared in HIScrollView.h.
kEventClassHIComboBoxEvent class for events related to a combo box view.
Available in Mac OS X v10.4 and later.
Declared in HIComboBox.h.
kEventClassSearchFieldEvent calls for events related to a search field view.
Available in Mac OS X v10.3 and later.
Declared in HISearchField.h.
kEventClassTextFieldEvent class for events related to text field views.
Available in Mac OS X v10.3 and later.
Declared in HITextViews.h.
Specify binding constants used by the HIView layout engine.
enum {
kHILayoutBindNone = 0,
kHILayoutBindMin = 1,
kHILayoutBindMax= 2,
kHILayoutBindLeft = kHILayoutBindMin,
kHILayoutBindRight = kHILayoutBindMax,
kHILayoutBindTop = kHILayoutBindMin,
kHILayoutBindBottom = kHILayoutBindMax
};
typedef UInt16 HIBindingKind;
kHILayoutBindNoneNo binding is to occur.
Available in Mac OS X v10.3 and later.
Declared in HIView.h.
kHILayoutBindMinBind to the minimum of the axis.
Available in Mac OS X v10.3 and later.
Declared in HIView.h.
kHILayoutBindMaxBind to the maximum of the axis.
Available in Mac OS X v10.3 and later.
Declared in HIView.h.
kHILayoutBindLeftSynonym for kHILayoutBindMin.
Available in Mac OS X v10.3 and later.
Declared in HIView.h.
kHILayoutBindRightSynonym for kHILayoutBindMax.
Available in Mac OS X v10.3 and later.
Declared in HIView.h.
kHILayoutBindTopSynonym for kHILayoutBindMin.
Available in Mac OS X v10.3 and later.
Declared in HIView.h.
kHILayoutBindBottomSynonym for kHILayoutBindMax.
Available in Mac OS X v10.3 and later.
Declared in HIView.h.
Mac OS X v10.3 provides a layout engine for HIViews that allows applications to specify the layout relationships between multiple views. When necessary, the layout engine automatically repositions and resizes views that have layout information. For more information on how to use the layout engine, see HIViewSetLayoutInfo.
Horizontal and vertical bindings are very similar in application, but along different axes, so the binding kinds have been abstracted to minimum and maximum. Synonyms are provided for convenience, and you are encouraged to use them.
Specify version 0 of the HILayoutInfo structure
enum {
kHILayoutInfoVersionZero = 0
};
kHILayoutInfoVersionZeroThe version of the HILayoutInfo structure is 0.
Available in Mac OS X v10.3 and later.
Declared in HIView.h.
Specify position constants used by the HIView layout engine.
enum {
kHILayoutPositionNone = 0,
kHILayoutPositionCenter = 1,
kHILayoutPositionMin = 2,
kHILayoutPositionMax = 3,
kHILayoutPositionLeft = kHILayoutPositionMin,
kHILayoutPositionRight = kHILayoutPositionMax,
kHILayoutPositionTop = kHILayoutPositionMin,
kHILayoutPositionBottom = kHILayoutPositionMax
};
typedef UInt16 HIPositionKind;
kHILayoutPositionNoneNo positioning is to occur.
Available in Mac OS X v10.3 and later.
Declared in HIView.h.
kHILayoutPositionCenterBind to the center.
Available in Mac OS X v10.3 and later.
Declared in HIView.h.
kHILayoutPositionMinBind to the minimum of the axis.
Available in Mac OS X v10.3 and later.
Declared in HIView.h.
kHILayoutPositionMaxBind to the maximum of the axis.
Available in Mac OS X v10.3 and later.
Declared in HIView.h.
kHILayoutPositionLeftSynonym for kHILayoutPositionMin.
Available in Mac OS X v10.3 and later.
Declared in HIView.h.
kHILayoutPositionRightSynonym for kHILayoutPositionMax.
Available in Mac OS X v10.3 and later.
Declared in HIView.h.
kHILayoutPositionTopSynonym for kHILayoutPositiondMin.
Available in Mac OS X v10.3 and later.
Declared in HIView.h.
kHILayoutPositionBottomSynonym for kHILayoutPositionMax.
Available in Mac OS X v10.3 and later.
Declared in HIView.h.
Specify a constant that indicates the scale is determined from the axis size.
enum {
kHILayoutScaleAbsolute = 0
};
typedef UInt16 HIScaleKind;
kHILayoutScaleAbsoluteIndicates that the scale is determined from the axis size.
Available in Mac OS X v10.3 and later.
Declared in HIView.h.
This constant is used in conjunction with the HIView layout engine.
Specify constants that change the behavior of controls.
enum {
kHIViewAttributeSendCommandToUserFocus = 1 << 0,
kHIViewAttributeIsFieldEditor = 1 << 1,
kHIViewSendCommandToUserFocus = kHIViewAttributeSendCommandToUserFocus
};
kHIViewAttributeSendCommandToUserFocusWhen set, the control sends the command it generates to the user focus; the command propagates as it would naturally from there. (The default is to send the command to itself and then to its parent and so forth.) You may want to use this setting for views that are not typically in a focused window. For example, a push button in a toolbar window might use this setting to cause its command to be sent to the focused window rather than to the toolbar window.
Available in Mac OS X v10.4 and later.
Declared in HIView.h.
kHIViewAttributeIsFieldEditorIndicates that text editing controls should behave appropriately for editing fields in a dialog; specifically, the control should ignore the Return, Enter, Escape, and Tab keys, and allow them to be processed by other participants in the event flow.
Available in Mac OS X v10.4 and later.
Declared in HIView.h.
kHIViewSendCommandToUserFocusLegacy constant. Use kHIViewAttributeSendCommandToUserFocus instead.
Available in Mac OS X v10.2 and later.
Declared in HIView.h.
These constants are used by HIViewGetAttributes to get a view’s attributes and by HIViewChangeAttributes to set or change a view’s attributes.
Specify constants for view features.
enum {
kHIViewFeatureSupportsGhosting = 1 << 0,
kHIViewFeatureAllowsSubviews = 1 << 1,
kHIViewFeatureGetsFocusOnClick = 1 << 8,
kHIViewFeatureSupportsLiveFeedback = 1 << 10,
kHIViewFeatureSupportsRadioBehavior = 1 << 11,
kHIViewFeatureAutoToggles = 1 << 14,
kHIViewFeatureIdlesWithTimer = 1 << 23,
kHIViewFeatureInvertsUpDownValueMeaning = 1 << 24,
kHIViewFeatureIsOpaque = 1 << 25,
kHIViewFeatureDoesNotDraw = 1 << 27,
kHIViewFeatureDoesNotUseSpecialParts = 1 << 28,
kHIViewFeatureIgnoresClicks = 1 << 29
};
typedef UInt64 HIViewFeatures;
kHIViewFeatureSupportsGhostingThis view supports using the ghosting protocol when live tracking is not enabled. Use this constant instead of the legacy constant, kHIViewSupportsGhosting.
Available in Mac OS X v10.4 and later.
Declared in HIView.h.
kHIViewFeatureAllowsSubviewsThis view allows subviews to be embedded within it. Use this constant instead of the legacy constant, kHIViewAllowsSubviews.
Available in Mac OS X v10.4 and later.
Declared in HIView.h.
kHIViewFeatureGetsFocusOnClickIf this view is clicked, the keyboard focus should be set to this view automatically; used primarily for edit text controls. Use this constant instead of the legacy constant, kHIViewGetsFocusOnClick.
Available in Mac OS X v10.4 and later.
Declared in HIView.h.
kHIViewFeatureSupportsLiveFeedbackThis view supports the live feedback protocol, which is necessary for implementing live scroll bar tracking. Clients of a view should never disable this bit. Use this constant instead of the legacy constant, kHIViewSupportsLiveFeedback.
Available in Mac OS X v10.4 and later.
Declared in HIView.h.
kHIViewFeatureSupportsRadioBehaviorThis view can be placed in a radio group. Radio buttons and bevel buttons report this behavior. Use this constant instead of the legacy constant, kHIViewSupportsRadioBehavior.
Available in Mac OS X v10.4 and later.
Declared in HIView.h.
kHIViewFeatureAutoTogglesThis view supports the auto-toggle protocol and should at the very least auto-toggle between off and on. The view can support a Carbon event for more advanced auto-toggling of its value. The tab view supports this, for example, so that when a tab is clicked its value changes automatically. Use this constant instead of the legacy constant, kHIViewAutoToggles.
Available in Mac OS X v10.4 and later.
Declared in HIView.h.
kHIViewFeatureIdlesWithTimerAn informational bit. Turning this bit off would not necessarily disable any timer a view might be using, but a timer could obey this bit if desired. Use this constant instead of the legacy constant, kHIViewIdlesWithTimer.
Available in Mac OS X v10.4 and later.
Declared in HIView.h.
kHIViewFeatureInvertsUpDownValueMeaningThis bit tells the Control Manager that when the Up button part of the control is clicked, the value of the control should increase. A Scroll bar, conversely, decreases in value when its Up button is clicked. Use this constant instead of the legacy constant, kHIViewInvertsUpDownValueMeaning.
Available in Mac OS X v10.4 and later.
Declared in HIView.h.
kHIViewFeatureIsOpaqueWhen set, the view’s structure region is used to determine the view’s opaque region, and calling the view can usually be avoided. Use this constant instead of the legacy constant, kHIViewIsOpaque.
Available in Mac OS X v10.4 and later.
Declared in HIView.h.
kHIViewFeatureDoesNotDrawThis bit is an optimization that tells the Control Manager that a view is transparent and does not do any drawing, so the Control Manager doesn’t have to invalidate the view and instead should invalidate views behind this view. For example, on a metal window, the content view is actually fully transparent, so invalidating it is unnecessary. Use this constant instead of the legacy constant, kHIViewDoesNotDraw.
Available in Mac OS X v10.4 and later.
Declared in HIView.h.
kHIViewFeatureDoesNotUseSpecialPartsIndicates to the Control Manager that this view doesn’t use the special part codes for indicator, inactive, and disabled. Use this constant instead of the legacy constant, kHIViewDoesNotUseSpecialParts.
Available in Mac OS X v10.4 and later.
Declared in HIView.h.
kHIViewFeatureIgnoresClicksWhen set, this bit tells the Control Manager that it does not need to ask the control for it’s clickable region. A view such as the visual separator would set this bit, and metal windows set this bit when doing asynchronous window dragging. This bit is typically set in conjunction with the kHIViewFeatureDoesNotDrawBit. Use this constant instead of the legacy constant, kHIViewIgnoresClicks.
Available in Mac OS X v10.4 and later.
Declared in HIView.h.
View feature flags are generally determined by the view itself and are not typically changed by clients of the view. Call HIViewGetFeatures to obtain a view’s features, and HIViewChangeFeatures to set and clear a view’s features.
Specify meta-parts constants used when calling HIViewCopyShape.
enum {
kHIViewStructureMetaPart = -1,
kHIViewContentMetaPart = -2,
kHIViewOpaqueMetaPart = -3,
kHIViewClickableMetaPart = -4
};
kHIViewStructureMetaPartThe structure region is the total area over which the view draws.
Available in Mac OS X v10.4 and later.
Declared in HIView.h.
kHIViewContentMetaPartThe content region is only defined by views that can embed other views. It is the area that embedded content can live.
Available in Mac OS X v10.4 and later.
Declared in HIView.h.
kHIViewOpaqueMetaPartThe portion of the view that is opaque. No views behind this portion of the view will be asked to draw because their drawing would be completely overwritten by this view’s drawing.
Available in Mac OS X v10.4 and later.
Declared in HIView.h.
kHIViewClickableMetaPartUsed for asynchronous window dragging only. The default is the structure region.
Available in Mac OS X v10.4 and later.
Declared in HIView.h.
Meta-parts are used when calling HIViewCopyShape. Meta-parts define a region of a view and they might be defined by a view. Along with these parts, you can also pass in normal part codes to get the regions of those parts. Not all views fully support this feature.
Specify constants that set a view’s z-order.
enum {
kHIViewZOrderAbove = 1,
kHIViewZOrderBelow = 2,
};
typedef UInt32 HIViewZOrderOp;
kHIViewZOrderAboveOrder the view above another view.
Available in Mac OS X v10.2 and later.
Declared in HIView.h.
kHIViewZOrderBelowOrder the view below another view.
Available in Mac OS X v10.2 and later.
Declared in HIView.h.
These constants are used when calling HIViewSetZOrder.
Specify constants that describe a view’s content.
enum {
kHIViewContentTextOnly = 0,
kHIViewContentNone = 0,
kHIViewContentIconSuiteRef = 129,
kHIViewContentIconRef = 132,
kHIViewContentCGImageRef = 134
};
kHIViewContentTextOnlyThe view has no content other than text.
Available in Mac OS X v10.4 and later.
Declared in HIView.h.
kHIViewContentNoneThe view has no content.
Available in Mac OS X v10.4 and later.
Declared in HIView.h.
kHIViewContentIconSuiteRefThe view’s content is an IconSuiteRef.
Available in Mac OS X v10.4 and later.
Declared in HIView.h.
kHIViewContentIconRefThe view’s content is an IconRef.
Available in Mac OS X v10.4 and later.
Declared in HIView.h.
kHIViewContentCGImageRefThe view’s content is an CGImageRef.
Available in Mac OS X v10.4 and later.
Declared in HIView.h.
These constants are used in the HIViewContentInfo structure. For information on that structure, see HIViewContentInfo.
Specify view parts constants.
enum {
kHIViewNoPart = 0,
kHIViewIndicatorPart = 129,
kHIViewDisabledPart = 254,
kHIViewInactivePart = 255,
kHIViewEntireView = kHIViewNoPart
};
typedef ControlPartCode HIViewPartCode;
kHIViewNoPartThe entire view; used when not referring to a specific part.
Available in Mac OS X v10.4 and later.
Declared in HIView.h.
kHIViewIndicatorPartIndicator part.
Available in Mac OS X v10.4 and later.
Declared in HIView.h.
kHIViewDisabledPartDisabled part.
Available in Mac OS X v10.4 and later.
Declared in HIView.h.
kHIViewInactivePartInactive part.
Available in Mac OS X v10.4 and later.
Declared in HIView.h.
kHIViewEntireViewThe entire view; used when not referring to a specific part.
Available in Mac OS X v10.4 and later.
Declared in HIView.h.
These constants are used when calling HIViewSetHilite, HIViewRegionChanged, HIViewCopyShape, HIViewSimulateClick, HIViewGetPartHit, and HIViewGetFocusPart. These constants are also used with various kEventClassControl Carbon events.
Specify constants for mouse tracking area events (kEventClassControl).
enum {
kEventControlTrackingAreaEntered = 23,
kEventControlTrackingAreaExited = 24,
kEventParamHIViewTrackingArea = 'ctra',
typeHIViewTrackingAreaRef = 'ctra'
};
kEventControlTrackingAreaEnteredIf you installed a mouse tracking area in your view, you will receive this event when the mouse enters that area. The tracking area reference is sent with the event.
Available in Mac OS X v10.4 and later.
Declared in HIView.h.
kEventControlTrackingAreaExitedIf you installed a mouse tracking area in your view, you will receive this event when the mouse leaves that area. The tracking area reference is sent with the event.
Available in Mac OS X v10.4 and later.
Declared in HIView.h.
kEventParamHIViewTrackingAreaAn HIViewTrackingAreaRef for the tracking area that was entered.
Available in Mac OS X v10.4 and later.
Declared in HIView.h.
Table 3 shows the event parameters associated with these events.
Event kind |
Parameter name |
Parameter type |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Specify constants for scroll view options.
enum {
kHIScrollViewOptionsVertScroll = (1 << 0),
kHIScrollViewOptionsHorizScroll = (1 << 1),
kHIScrollViewOptionsAllowGrow = (1 << 2),
kHIScrollViewValidOptions = (kHIScrollViewOptionsVertScroll |
kHIScrollViewOptionsHorizScroll | kHIScrollViewOptionsAllowGrow)
};
kHIScrollViewOptionsVertScrollIndicates that a vertical scroll bar is desired.
Available in Mac OS X v10.2 and later.
Declared in HIScrollView.h.
kHIScrollViewOptionsHorizScrollIndicates that a horizontal scroll bar is desired.
Available in Mac OS X v10.2 and later.
Declared in HIScrollView.h.
kHIScrollViewOptionsAllowGrowIndicates that space for a grow box should be taken into account when laying out scroll bars. In Mac OS X v10.3 and earlier, if both horizontal and vertical scroll bars are requested, this attribute is assumed. In Mac OS X v10.4 and later, this attribute is not assumed; this allows the scroll view to support independent auto-hiding of the two scroll bars in Mac OS X v10.4 and later. If you want to preserve space for the grow box on all systems, specify this option bit.
Available in Mac OS X v10.2 and later.
Declared in HIScrollView.h.
kHIScrollViewValidOptionsAll valid scroll view options.
Available in Mac OS X v10.2 and later.
Declared in HIScrollView.h.
These constants are used in conjunction with HIScrollViewCreate.
Specify constants for scroll view navigation actions.
enum {
kHIScrollViewScrollToTop = (1 << 0),
kHIScrollViewScrollToBottom = (1 << 1),
kHIScrollViewScrollToLeft = (1 << 2),
kHIScrollViewScrollToRight = (1 << 3),
kHIScrollViewPageUp = (1 << 4),
kHIScrollViewPageDown = (1 << 5),
kHIScrollViewPageLeft = (1 << 6),
kHIScrollViewPageRight = (1 << 7)
};
typedef UInt32 HIScrollViewAction;
kHIScrollViewScrollToTopThe scroll view should move to the top of the content.
Available in Mac OS X v10.3 and later.
Declared in HIScrollView.h.
kHIScrollViewScrollToBottomThe scroll view should move to the bottom of the content.
Available in Mac OS X v10.3 and later.
Declared in HIScrollView.h.
kHIScrollViewScrollToLeftThe scroll view should move to the left of the content.
Available in Mac OS X v10.3 and later.
Declared in HIScrollView.h.
kHIScrollViewScrollToRightThe scroll view should move to the right of the content.
Available in Mac OS X v10.3 and later.
Declared in HIScrollView.h.
kHIScrollViewPageUpThe scroll view should page up.
Available in Mac OS X v10.3 and later.
Declared in HIScrollView.h.
kHIScrollViewPageDownThe scroll view should page down.
Available in Mac OS X v10.3 and later.
Declared in HIScrollView.h.
kHIScrollViewPageLeftThe scroll view should page left.
Available in Mac OS X v10.3 and later.
Declared in HIScrollView.h.
kHIScrollViewPageRightThe scroll view should page right.
Available in Mac OS X v10.3 and later.
Declared in HIScrollView.h.
These constants are used in conjunction with HIScrollViewNavigate and HIScrollViewCanNavigate.
Specify constants for scrollable events (kEventClassScrollable).
enum {
kEventScrollableGetInfo = 1,
kEventScrollableInfoChanged = 2,
kEventScrollableScrollTo = 10
};
kEventScrollableGetInfoThis event is sent by an HIScrollView to its scrollable view to determine the current size and origin of the scrollable view. A scrollable view must implement this event in order to scroll properly inside an HIScrollView.
Available in Mac OS X v10.2 and later.
Declared in HIScrollView.h.
kEventScrollableInfoChangedThis event is not sent by an HIScrollView itself. Instead, it may be sent to an instance of HIScrollView to notify the scroll view that the size or origin of its scrollable view has changed. The HIScrollView responds to this event by sending a kEventScrollableGetInfo event to its scrollable view. It then updates the scroll bars appropriately to reflect the changes. It does not move the origin of the scrollable view at all. This event is just a notification to allow the scroll view to sync up with its scrollable view.
Available in Mac OS X v10.2 and later.
Declared in HIScrollView.h.
kEventScrollableScrollToThis event is sent by an HIScrollView to its scrollable view to request that the scrollable view update its current origin and redraw. Typically, a scrollable view scrolls its content by setting its bounds origin using HIViewSetBoundsOrigin or by offsetting its drawing by the scroll origin. If the view embeds other views, it must use HIViewSetBoundsOrigin to allow the embedded views to scroll along with their containing view. A view that uses HIViewSetBoundsOrigin should call that API in response to this event. A view that offsets its drawing by the scroll origin should update its current origin in its own instance data in response to this event. A scrollable view should also use HIViewScrollRect to scroll its content or HIViewSetNeedsDisplay to cause itself to redraw using the new origin point. A scrollable view must implement this event in order to scroll properly inside an HIScrollView.
Available in Mac OS X v10.2 and later.
Declared in HIScrollView.h.
Table 4 shows the event parameters associated with these events.
Event kind |
Parameter name |
Parameter type |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Specify scrollable event parameter constants.
enum {
kEventParamImageSize = 'imsz',
kEventParamViewSize = 'vwsz',
kEventParamLineSize = 'lnsz',
kEventParamOrigin = 'orgn'
};
kEventParamImageSizeA value of type typeHISize representing the image size. The image size is the total size of the scrollable view, including any parts of the view that are not currently visible. For example, a scrollable view that displays a hundred page document would return an image size equal to one hundred times the height of the page.
Available in Mac OS X v10.2 and later.
Declared in HIScrollView.h.
kEventParamViewSizeA value of type typeHISize representing the view size. The view size is the current size of the scrollable view. Typically, this is the same as the view’s bounds and can be acquired by calling HIViewGetBounds.
Available in Mac OS X v10.2 and later.
Declared in HIScrollView.h.
kEventParamLineSizeA value of type typeHISize representing the line size. The line size is the distance that the HIScrollView should scroll its subview when the user clicks a scroll bar arrow. For example, this might be 10 pixels vertically and 20 pixels horizontally.
Available in Mac OS X v10.2 and later.
Declared in HIScrollView.h.
kEventParamOriginA value of type typeHIPoint representing the origin. The origin is the current view-relative origin within the total scrollable image that is displayed at the top left corner of the view. These coordinates should always be greater than or equal to zero and less than or equal to the view’s image size minus its view size. Typically, a view that implements the kEventScrollableScrollTo event by calling HIViewSetBoundsOrigin returns the current bounds origin for this parameter, and a view implements the ScrollTo event by storing the origin in its instance data returns its stored origin for this parameter. For example, a scrollable view that currently is displaying page ten of a hundred page document would return a horizontal origin of zero and a vertical origin equal to ten times the height of the page.
Available in Mac OS X v10.2 and later.
Declared in HIScrollView.h.
Specify constants for search field attributes.
enum {
kHISearchFieldNoAttributes = 0,
kHISearchFieldAttributesCancel = (1 << 0),
kHISearchFieldAttributesSearchIcon = (1 << 1)
};
kHISearchFieldNoAttributesIndicates that this view does not have any attributes.
Available in Mac OS X v10.3 and later.
Declared in HISearchField.h.
kHISearchFieldAttributesCancelIndicates that this view contains a Cancel button.
Available in Mac OS X v10.3 and later.
Declared in HISearchField.h.
kHISearchFieldAttributesSearchIconIndicates that this view contains the Search icon in the text field. If a menu is associated with the search field, this attribute is implicitly set and the Search icon will display with a menu disclosure badge.
Available in Mac OS X v10.4 and later.
Declared in HISearchField.h.
These constants are used when calling HISearchFieldCreate, HISearchFieldGetAttributes, and HISearchFieldChangeAttributes.
Specify constants for search field data tags.
Search field views support these tags previously defined for the EditUnicodeText control. These tags are available through GetControlData and SetControlData with a ControlPartCode of kControlEditTextPart:
kControlFontStyleTag
kControlEditTextFixedTextTag
kControlEditTextTextTag
kControlEditTextKeyFilterTag
kControlEditTextValidationProcTag
kControlEditUnicodeTextPostUpdateProcTag
kControlEditTextSelectionTag
kControlEditTextKeyScriptBehaviorTag
kControlEditTextCharCount
kControlEditTextCFStringTag
Specify constants for search field part codes.
enum {
kControlSearchFieldCancelPart = 30,
kControlSearchFieldMenuPart = 31
};
kControlSearchFieldCancelPartCancel part.
Available in Mac OS X v10.3 and later.
Declared in HISearchField.h.
kControlSearchFieldMenuPartMenu part.
Available in Mac OS X v10.3 and later.
Declared in HISearchField.h.
Specify segment attribute constants.
enum {
kHISegmentNoAttributes = 0,
kHISegmentSendCmdToUserFocus = (1 << 0)
};
kHISegmentNoAttributesIndicates no attributes.
Available in Mac OS X v10.3 and later.
Declared in HISegmentedView.h.
kHISegmentSendCmdToUserFocusIf this attribute bit is set, the command that is sent when the segment is clicked will be directed at the user focus instead of up the segmented view’s containment hierarchy.
Available in Mac OS X v10.3 and later.
Declared in HISegmentedView.h.
These constants are used when calling HISegmentedViewCreate and HISegmentedViewChangeSegmentAttributes.
Specify segment behavior constants.
enum {
kHISegmentBehaviorMomentary = 1,
kHISegmentBehaviorRadio = 2,
kHISegmentBehaviorToggles = 3,
kHISegmentBehaviorSticky = 4
};
kHISegmentBehaviorMomentaryPops back up after being pressed, just like a push button.
Available in Mac OS X v10.3 and later.
Declared in HISegmentedView.h.
kHISegmentBehaviorRadioStays pressed until another segment with the radio behavior is pressed. This makes the segment behave like a radio button. After this segment is clicked, the segmented view’s value is changed to this segment’s one-based index.
Available in Mac OS X v10.3 and later.
Declared in HISegmentedView.h.
kHISegmentBehaviorTogglesBehaves like a check box. When clicked, it toggles back and forth between checked and unchecked states. Currently, this constant should not be used; if you use it, you get the same effect as if you used kHISegmentBehaviorMomentary.
Available in Mac OS X v10.3 and later.
Declared in HISegmentedView.h.
kHISegmentBehaviorStickyAfter being pressed, this type of segment stays pressed until it is unpressed programmatically. Currently, this constant should not be used; if you use it, you get the same effect as if you used kHISegmentBehaviorMomentary.
Available in Mac OS X v10.3 and later.
Declared in HISegmentedView.h.
These constants are used in conjunction with HISegmentedViewSetSegmentBehavior and HISegmentedViewGetSegmentBehavior.
Specify IDs of views that are commonly used.
const HIViewID kHIViewWindowContentID; const HIViewID kHIViewWindowGrowBoxID; const HIViewID kHIViewMenuContentID;
kHIViewWindowContentIDThe standard view ID for the content view of a window.
Available in Mac OS X v10.2 and later.
Declared in HIWindowViews.h.
kHIViewWindowGrowBoxIDThe standard view ID for the grow box view of a window. Not all windows have grow boxes, so you might not find this view if you look for it.
Available in Mac OS X v10.2 and later.
Declared in HIWindowViews.h.
kHIViewMenuContentIDThe standard view ID for the content view of a menu. The Menu Manager assigns this view ID to all menu content views.
Available in Mac OS X v10.3 and later.
Declared in HIMenuView.h.
Specify constants for text field events (kEventClassTextField).
enum {
kEventTextAccepted = 1,
kEventTextShouldChangeInRange = 2,
kEventTextDidChange = 3
};
kEventTextAcceptedThis event is sent as a notification when the text contained in a control’s editable text field has been accepted by the user. Text is accepted when the user presses Return or Enter on the keyboard for the EditUnicodeText, HIComboBox, and HISearchField controls, or when the text has changed in the field and the field loses focus for the EditUnicodeText, HIComboBox, HISearchField and HITextView controls. This event is sent to the control containing the text field only, it is not propagated. It is sent to all handlers installed on the control containing the text field.
Available in Mac OS X v10.3 and later.
Declared in HITextViews.h.
kEventTextShouldChangeInRangeThis event is sent whenever the text is about to be modified in text field, either by user input or in other scenarios such as a paste from the clipboard, spell-checking word correction, or Mac OS X Service operation. You can change the text that is inserted by providing a replacement string as a parameter to this event. This event is only sent for Unicode text controls; it is not sent for the Classic non-Unicode EditText control. This event is not sent prior to programmatic modification of the text field contents using SetControlData. This event is not sent while an active inline editing session is in progress. Once the inline text has been confirmed, this event is sent prior to the confirmed text being inserted into the text field. If you need control over keystrokes during an inline editing session, you can use the kEventTextInputFilterText event. This event is sent to the control containing the text field only; it does not propagate.
Available in Mac OS X v10.4 and later.
Declared in HITextViews.h.
kEventTextDidChangeThis event is sent to indicate that the contents of an editable text field have changed. This event is sent by all of the Unicode-based editable text views: HIComboBox, HISearchField, HITextView and EditUnicodeText. This event is not sent for the Classic non-Unicode EditText control. Note that this event is sent after inline editing operations, such as pressing a dead key, or using a input method that creates an inline editing hole. Most clients of this event should ignore the event during inline editing, and only respond to changes to the text after inline editing completes. A client can check for the presence of the kEventParamUnconfirmedRange parameter to determine whether inline editing is currently active; if this parameter is present, the client may wish to ignore the event. This event is not sent after programmatic modification of the text field contents using SetControlData. This event is sent only to the control containing the text field; it does not propagate. It is sent to all handlers registered for it.
Available in Mac OS X v10.4 and later.
Declared in HITextViews.h.
Table 5 shows the event parameters associated with these events.
Event kind |
Parameter name |
Parameter type |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Specify constants for text field event parameters.
enum {
kEventParamTextSelection = 'txsl',
kEventParamCandidateText = 'tstx',
kEventParamReplacementText = 'trtx',
kEventParamUnconfirmedRange = 'tunr',
kEventParamUnconfirmedText = 'txun'
};
kEventParamTextSelectionThe range of the selection that is about to be changed. The units of the selection are in the same units that are returned in a EditTextSelectionRec, when called with GetControlData using kControlEditTextSelectionTag.
Available in Mac OS X v10.4 and later.
Declared in HITextViews.h.
kEventParamCandidateTextThe text that is to replace the selection. Note that this string was originally created with CFStringCreateWithCharactersNoCopy, and the original text has a limited life span. If for some reason you need to retain the text past the end of your event handler, you should extract the characters from the string with CFStringGetCharacters, and then store those characters or create a new CFString from them.
Available in Mac OS X v10.4 and later.
Declared in HITextViews.h.
kEventParamReplacementTextOptional replacement text.
Available in Mac OS X v10.4 and later.
Declared in HITextViews.h.
kEventParamUnconfirmedRangeIf the text field currently has an open inline hole, this parameter contains the range of text inside the hole. This parameter is optional and is only present during inline editing.
Available in Mac OS X v10.4 and later.
Declared in HITextViews.h.
kEventParamUnconfirmedTextIf the text field currently has an open inline hole, this parameter contains the non-confirmed text currently being edited inside the hole. This parameter is optional and is only present during inline editing. Note that this string was originally created with CFStringCreateWithCharactersNoCopy, and the original text has a limited life span. If for some reason you need to retain the text past the end of your event handler, you should extract the characters from the string with CFStringGetCharacters, and then store those characters or create a new CFString from them.
Available in Mac OS X v10.4 and later.
Declared in HITextViews.h.
Specify transformation constants.
enum {
kHITransformNone = 0x00,
kHITransformDisabled = 0x01,
kHITransformSelected = 0x4000
};
kHITransformNoneNo visual transformation should be applied.
Available in Mac OS X v10.4 and later.
Declared in HIView.h.
kHITransformDisabledThe image should be transformed to use a disabled appearance. This transformation should not be combined with any other transformations.
Available in Mac OS X v10.4 and later.
Declared in HIView.h.
kHITransformSelectedThe image should be transformed to use a selected appearance. This transformation should not be combined with any other transformations.
Available in Mac OS X v10.4 and later.
Declared in HIView.h.
These constants are used when calling HICreateTransformedCGImage.
Specify the signature of all HIToolbox views.
enum {
kHIViewKindSignatureApple = 'appl'
};
kHIViewKindSignatureAppleSignature of all toolbox views.
Available in Mac OS X v10.4 and later.
Declared in HIView.h.
This table lists the result codes defined in HIView.
© 2003, 2007 Apple Inc. All Rights Reserved. (Last updated: 2007-04-13)