| 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