| Framework | Carbon/Carbon.h |
| Declared in | ControlDefinitions.h Controls.h HIButtonViews.h HIClockView.h HIContainerViews.h HIDataBrowser.h HIDisclosureViews.h HIImageViews.h HILittleArrows.h HIObject.h HIPopupButton.h HIProgressViews.h HIRelevanceBar.h HIScrollView.h HISeparator.h HISlider.h HITabbedView.h HITextViews.h HIToolboxDebugging.h |
Your application uses the Control Manager to create and manage controls. Controls are onscreen objects that the user can manipulate with the mouse. By manipulating controls, the user can take an immediate action or change settings to modify a future action. For example, a scroll bar control allows a user to immediately change the portion of the document that your application displays, whereas a pop-up menu control for connection speed might allow the user to change the rate by which your application handles subsequent data transmissions.
Virtually all applications need to implement controls, at least in the form of scroll bars for document windows. Other standard Mac OS controls include buttons, checkboxes, radio buttons, and pop-up menus. You can use the Control Manager to create and manage these controls, too.
In Mac OS X v10.2 and later, Control Manager controls may be implemented as HIViews. View-based controls offer additional flexibility and extensibility for developers. For more information, see the document HIView Programming Guide.
Important: Documentation for the data browser control is available separately in Data Browser Programming Guide.
Carbon supports most Control Manager functions, with the following changes:
The C-style, lowercase versions of Control Manager function names are no longer supported. If your application uses any Control Manager lowercase function names, you must replace them with their uppercase equivalents.
Custom control definition procedures (also known as CDEFs), must be compiled as PowerPC-native code, and can not be stored as resources. See the Carbon Porting Guide for more information.
Your application must use the functions defined by the Control Manager to create and dispose of Control Manager data structures. For example, instead of directly creating and disposing of control records, applications must call the Control Manager functions GetNewControl and DisposeControl.
With the availability of the Appearance Manager, you should not access the PopupPrivateData structure, but rather pass the kControlPopupButtonMenuHandleTag tag to GetControlData to obtain its contents.
Your application must use Control Manager accessor functions to access Control Manager data structures.
You are encouraged to adopt the standard Mac OS control definition procedures in your application. Applications that use the standard control definition procedures inherit the Mac OS human interface appearance. Applications that use custom control definition procedures will work correctly, but because custom definition procedures invoke their own drawing routines, Mac OS X can’t draw these applications with the current appearance.
CreateBevelButtonControl
CreateChasingArrowsControl
CreateCheckBoxControl
CreateCheckGroupBoxControl
CreateClockControl
CreateDisclosureButtonControl
CreateDisclosureTriangleControl
CreateEditUnicodeTextControl
CreateGroupBoxControl
CreateIconControl
CreateImageWellControl
CreateListBoxControl
CreateLittleArrowsControl
CreatePictureControl
CreatePlacardControl
CreatePopupArrowControl
CreatePopupButtonControl
CreatePopupGroupBoxControl
CreateProgressBarControl
CreatePushButtonControl
CreatePushButtonWithIconControl
CreateRadioButtonControl
CreateRadioGroupControl
CreateRelevanceBarControl
CreateRoundButtonControl
CreateScrollBarControl
CreateSeparatorControl
CreateSliderControl
CreateStaticTextControl
CreateTabsControl
CreateUserPaneControl
CreateWindowHeaderControl
DisposeControl
GetNewControl
KillControls
RegisterControlDefinition
CreateCustomControl Deprecated in Mac OS X v10.5
AutoEmbedControl
CountSubControls
CreateRootControl
DumpControlHierarchy
EmbedControl
GetControlOwner
GetIndexedSubControl
GetRootControl
GetSuperControl
DisableControl
Draw1Control
DrawControlInCurrentPort
DrawControls
GetControlViewSize
IsControlVisible
SetControlViewSize
SetUpControlBackground
SetUpControlTextColor
UpdateControls
HideControl
ShowControl
SetControlVisibility
FindControl
FindControlUnderMouse
GetControlAction
GetControlClickActivation
GetControlCommandID
HandleControlClick
HandleControlContextualMenuClick
HandleControlDragReceive
HandleControlDragTracking
HandleControlSetCursor
IsAutomaticControlDragTrackingEnabledForWindow
IsControlDragTrackingEnabled
SetAutomaticControlDragTrackingEnabledForWindow
SetControlAction
SetControlCommandID
SetControlDragTrackingEnabled
TestControl
HandleControlKey Deprecated in Mac OS X v10.5
ActivateControl
DeactivateControl
EnableControl
GetControlRegion
IsControlActive
IsControlEnabled
IsControlHilited
MoveControl
SizeControl
ChangeControlPropertyAttributes
CopyControlTitleAsCFString
GetBestControlRect
GetControl32BitMaximum
GetControl32BitMinimum
GetControl32BitValue
GetControlBounds
GetControlByID
GetControlData
GetControlDataSize
GetControlHilite
GetControlID
GetControlKind
GetControlProperty
GetControlPropertySize
GetControlReference
GetImageWellContentInfo
GetControlPropertyAttributes
GetTabContentRect
IsValidControlHandle
RemoveControlProperty
SetControl32BitMaximum
SetControl32BitMinimum
SetControl32BitValue
SetControlData
SetControlBounds
SetControlID
SetControlTitleWithCFString
SetDisclosureTriangleLastValue
SetImageWellContentInfo
SetImageWellTransform
SetTabEnabled
SetControlFontStyle
SetControlProperty
SetControlReference
The functions described in this section can only be called for pop-up button and pop-up group box controls, which can support pop-up menus that activate when the user presses the control with the mouse.
Bevel button controls have additional features that you can or should manipulate to display them properly. This section describes the functions you can use to manipulate these features.
GetBevelButtonContentInfo
GetBevelButtonMenuHandle
GetBevelButtonMenuValue
SetBevelButtonContentInfo
SetBevelButtonGraphicAlignment
SetBevelButtonMenuValue
SetBevelButtonTextAlignment
SetBevelButtonTextPlacement
SetBevelButtonTransform
DisposeControlActionUPP
DisposeControlCNTLToCollectionUPP
DisposeControlEditTextValidationUPP
DisposeControlKeyFilterUPP
DisposeControlUserPaneActivateUPP
DisposeControlUserPaneBackgroundUPP
DisposeControlUserPaneDrawUPP
DisposeControlUserPaneFocusUPP
DisposeControlUserPaneHitTestUPP
DisposeControlUserPaneIdleUPP
DisposeControlUserPaneKeyDownUPP
DisposeControlUserPaneTrackingUPP
DisposeEditUnicodePostUpdateUPP
InvokeControlActionUPP
InvokeControlCNTLToCollectionUPP
InvokeControlEditTextValidationUPP
InvokeControlKeyFilterUPP
InvokeControlUserPaneActivateUPP
InvokeControlUserPaneBackgroundUPP
InvokeControlUserPaneDrawUPP
InvokeControlUserPaneFocusUPP
InvokeControlUserPaneHitTestUPP
InvokeControlUserPaneIdleUPP
InvokeControlUserPaneKeyDownUPP
InvokeControlUserPaneTrackingUPP
InvokeEditUnicodePostUpdateUPP
NewControlActionUPP
NewControlCNTLToCollectionUPP
NewControlEditTextValidationUPP
NewControlKeyFilterUPP
NewControlUserPaneActivateUPP
NewControlUserPaneBackgroundUPP
NewControlUserPaneDrawUPP
NewControlUserPaneFocusUPP
NewControlUserPaneHitTestUPP
NewControlUserPaneIdleUPP
NewControlUserPaneKeyDownUPP
NewControlUserPaneTrackingUPP
NewEditUnicodePostUpdateUPP
DisposeControlDefUPP Deprecated in Mac OS X v10.5
InvokeControlDefUPP Deprecated in Mac OS X v10.5
NewControlDefUPP Deprecated in Mac OS X v10.5
These functions are outdated and are not recommended.
CreateScrollingTextBoxControl
DisposeControlColorUPP
GetControlFeatures
GetControlMaximum
GetControlMinimum
GetControlValue
GetControlVariant
InvokeControlColorUPP
NewControlColorUPP
SetControlColorProc
GetControlDataHandle
SetControlDataHandle
SetControlMaximum
SetControlMinimum
SetControlSupervisor
SetControlValue
TrackControl
DragControl
HiliteControl
SendControlMessage
GetControlTitle Deprecated in Mac OS X v10.5
NewControl Deprecated in Mac OS X v10.5
SetControlTitle Deprecated in Mac OS X v10.5
CreateEditTextControl Deprecated in Mac OS X v10.4
IdleControls Deprecated in Mac OS X v10.4
Activates a control and any latent embedded controls.
OSErr ActivateControl ( ControlRef inControl );
A handle to the control to activate. If you pass a window’s root control, ActivateControl activates all controls in that window. For a description of this data type, see ControlRef.
A result code. See “Control Manager Result Codes.”
The ActivateControl function should be called instead of HiliteControl to activate a specified control and its latent embedded controls.
An embedded control is considered latent when it is deactivated or hidden due to its embedder control being deactivated or hidden. If you activate a latent embedded control whose embedder is deactivated, the embedded control becomes latent until the embedder is activated. However, if you deactivate a latent embedded control, it will not be activated when its embedder is activated.
If a control definition function supports activate events, it will receive a kControlMsgActivate message before redrawing itself in its active state.
Controls.h
Advances the keyboard focus to the next focusable control in a window.
OSErr AdvanceKeyboardFocus ( WindowRef inWindow );
A pointer to the window for which to advance keyboard focus.
A result code. See “Control Manager Result Codes.”
The AdvanceKeyboardFocus function skips over deactivated and hidden controls until it finds the next focusable control in the window. If it does not find a focusable item, it simply returns.
When AdvanceKeyboardFocus is called, the Control Manager calls your control definition function and passes kControlMsgFocus in its message parameter and kControlFocusNextPart in its param parameter. In response to this message, your control definition function should change keyboard focus to its next part, the entire control, or remove keyboard focus from the control, depending upon the circumstances. See ControlDefProcPtr for a discussion of possible responses to this message.
Controls.h
Automatically embeds a control in the smallest appropriate embedder control.
OSErr AutoEmbedControl ( ControlRef inControl, WindowRef inWindow );
A handle to the control to be embedded.
A pointer to the window in which to embed the control.
A result code. See “Control Manager Result Codes.”
The Dialog Manager uses AutoEmbedControl to position dialog items in an embedding hierarchy based on both visual containment and the item list resource order. As items are added to a dialog box during creation, controls that already exist in the window will be containers for new controls if they both visually contain the control and have set the kControlSupportsEmbedding feature bit. For this reason, you should place the largest embedder controls at the beginning of the item list resource. As an example, the Dialog Manager would embed radio buttons in a tab control if they visually “fit” inside the tab control, as long as the tab control was already created in a'DITL' resource and established as an embedder control. For more information on embedding hierarchies in dialog and alert boxes, see the function EmbedControl.
Controls.h
Changes a property attribute.
OSStatus ChangeControlPropertyAttributes ( ControlRef control, OSType propertyCreator, OSType propertyTag, OptionBits attributesToSet, OptionBits attributesToClear );
The control whose property’s attributes you want to change. For a description of this data type, see ControlRef.
An OSType signature, usually the signature of your application. Do not use all lower case signatures, as these are reserved for use by Apple.
An OSType signature, defined by your application, defining the property whose attributes you want to change.
A bit field indicating the attributes you want to set for this property.
A bit field indicating the attributes you want to clear for this property.
A result code. See “Control Manager Result Codes.”
If you have associated control properties with a control (by calling SetControlProperty, you can also assign arbitrary attribute bits to the property. You can use these attributes to indicate information about the property data.
Currently, kControlPropertyPersistent is the only control property attribute that is defined.
Controls.h
Removes the keyboard focus for the currently focused control in a window.
OSErr ClearKeyboardFocus ( WindowRef inWindow );
A pointer to the window in which to clear keyboard focus.
A result code. See “Control Manager Result Codes.”
When the ClearKeyboardFocus function is called, the Control Manager calls your control definition function and passes kControlMsgFocus in its message parameter and kControlFocusNoPart in its param parameter. See ControlDefProcPtr for a discussion of possible responses to this message.
Controls.h
Makes a copy of the control’s title as a Core Foundation string.
OSStatus CopyControlTitleAsCFString ( ControlRef inControl, CFStringRef *outString );
The control whose title is to be copied. For a description of this data type, see ControlRef.
A copy of the control’s title.
A result code. See “Control Manager Result Codes.”
Controls.h
Obtains the number of embedded controls within a control.
OSErr CountSubControls ( ControlRef inControl, UInt16 *outNumChildren );
The control whose embedded controls are to be counted. For a description of this data type, see ControlRef.
On input, a pointer to an unsigned 16-bit integer value. On return, the value is set to the number of embedded subcontrols.
A result code. See “Control Manager Result Codes.”
The CountSubControls function is useful for iterating over the control hierarchy. You can use the count produced to determine how many subcontrols there are and then call GetIndexedSubControl to get each.
Controls.h
Creates a bevel button control.
OSStatus CreateBevelButtonControl ( WindowRef window, const Rect *boundsRect, CFStringRef title, ControlBevelThickness thickness, ControlBevelButtonBehavior behavior, ControlButtonContentInfoPtr info, MenuID menuID, ControlBevelButtonMenuBehavior menuBehavior, ControlBevelButtonMenuPlacement menuPlacement, ControlRef *outControl );
The window that is to contain the control. This parameter may be NULL in Mac OS X v10.3 and later.
The bounds of the desired control in the window’s local coordinates.
The title of the control.
The thickness of the button. For possible values, see “Control Bevel Thickness Constants.”
The behavior the button is to have. For possible values, see “Bevel Button Behavior Constants.”
A value of type ControlButtonContentInfoPtr for the content information.
The menu ID. This parameter may be 0 if you don’t have a menu. Icon suite, picture, color icon, and IconRef are supported on Mac OS X v10.0 through Mac OS X v10.4. Values of type CGImageRef are supported in Mac OS X v10.4.
The behavior of the menu. For possible values, see “Bevel Button Menu Constant.”
The placement of the menu. For possible values, see “Control Bevel Button Menu Placement Constants.”
On return, outControl points to the new control. For a description of this data type, see ControlRef.
A result code. See “Control Manager Result Codes.”
HIButtonViews.h
Creates a chasing arrows control.
OSStatus CreateChasingArrowsControl ( WindowRef window, const Rect *boundsRect, ControlRef *outControl );
The window that is to contain the control. This parameter may be NULL in Mac OS X v10.3 and later.
The bounds of the desired control in the window’s local coordinates.
On return, outControl points to the new control. For a description of this data type, see ControlRef.
A result code. See “Control Manager Result Codes.”
This control automatically animates via an event loop timer.
HIProgressViews.h
Creates a checkbox control.
OSStatus CreateCheckBoxControl ( WindowRef window, const Rect *boundsRect, CFStringRef title, SInt32 initialValue, Boolean autoToggle, ControlRef *outControl );
The window that is to contain the checkbox control. This parameter may be NULL in Mac OS X v10.3 and later.
The bounds of the desired checkbox in the window’s local coordinates.
The title of the checkbox.
The initial setting of the checkbox. Set to a non-zero value to indicate the checked state.
If set to true, clicking the checkbox will automatically toggle its state (checked or unchecked).
On return, outControl points to the new checkbox. For a description of this data type, see ControlRef.
A result code. See “Control Manager Result Codes.”
HIButtonViews.h
Creates a group box control that has a check box as its title.
OSStatus CreateCheckGroupBoxControl ( WindowRef window, const Rect *boundsRect, CFStringRef title, SInt32 initialValue, Boolean primary, Boolean autoToggle, ControlRef *outControl );
The window in which the control is to be placed. This parameter may be NULL in Mac OS X v10.3 and later.
The bounds of the control in the window’s local coordinates.
The title of the control. The title is used as the title of the check box.
The initial value of the check box.
A Boolean whose value is true to create a primary group box or false to create a secondary group box.
A Boolean whose value is true to create an auto-toggling check box. Auto-toggling check box titles are only supported on Mac OS X; this parameter must be false when used with CarbonLib.
On return, the new control. For a description of this data type, see ControlRef.
A result code. See “Control Manager Result Codes.”
HIContainerViews.h
Creates a clock control.
OSStatus CreateClockControl ( WindowRef window, const Rect *boundsRect, ControlClockType clockType, ControlClockFlags clockFlags, ControlRef *outControl );
The window that is to contain the control. This parameter may be NULL in Mac OS X v10.3 and later.
The bounds of the desired control in the window’s local coordinates.
The clock type. For possible values, see “Control Clock Type Constants.”
Clock options. For possible values, see “Clock Value Flag Constants.”
On return, outControl points to the new control. For a description of this data type, see ControlRef.
A result code. See “Control Manager Result Codes.”
HIClockView.h
Creates a new instance of the Disclosure Button Control.
OSStatus CreateDisclosureButtonControl ( WindowRef inWindow, const Rect *inBoundsRect, SInt32 inValue, Boolean inAutoToggles, ControlRef *outControl );
The WindowRef in which to create the control. This parameter may be NULL in Mac OS X v10.3 and later.
The bounding rectangle for the control in the window’s local coordinates. The height of the control is fixed and the control will be centered vertically within the rectangle you specify.
The initial value; either kControlDisclosureButtonClosed or kControlDisclosureButtonDisclosed.
A Boolean value indicating whether its value should change automatically after tracking the mouse.
On successful exit, this will contain the new control. For a description of this data type, see ControlRef.
A result code. See “Control Manager Result Codes.”
CreateDisclosureButtonControl is preferred over NewControl because it allows you to specify the exact set of parameters required to create the control without overloading parameter semantics. The initial minimum of the Disclosure Button will be kControlDisclosureButtonClosed, and the maximum will be kControlDisclosureButtonDisclosed.
HIDisclosureViews.h
Creates a disclosure triangle control.
OSStatus CreateDisclosureTriangleControl ( WindowRef inWindow, const Rect *inBoundsRect, ControlDisclosureTriangleOrientation inOrientation, CFStringRef inTitle, SInt32 inInitialValue, Boolean inDrawTitle, Boolean inAutoToggles, ControlRef *outControl );
The window that is to contain the control. This parameter may be NULL in Mac OS X v10.3 and later.
The desired position, in the window’s local coordinates, for the disclosure triangle.
The direction the disclosure triangle should point when it is “closed.” Passing kControlDisclosureTrianglePointDefault is only legal as of Mac OS X and CarbonLib 1.5. For other possible values, see “Control Disclosure Triangle Orientation Constants.”
The title for the disclosure triangle. The title is displayed only if the value of the inDrawTitle parameter is true. Displaying the title only works on Mac OS X.
The initial state of the disclosure triangle. A value of 0 causes the disclosure triangle to be drawn initially in the “closed” state, and a value of 1 causes the triangle to be drawn initially in the “open” state.
A Boolean whose value is true if the disclosure triangle should draw its title next to the widget. Displaying the title only works on Mac OS X.
A Boolean whose value is true to enable auto toggling; otherwise, false. When auto toggling is enabled, the disclosure triangle automatically changes from “open” to “closed” and from “closed” to “open” when it is clicked.
On return, outControl points to the new control. For a description of this data type, see ControlRef.
A result code. See “Control Manager Result Codes.”
A disclosure triangle is a small control that gives the user a way to toggle the visibility of information or other user interface. When information is in a hidden state, a disclosure triangle is considered “closed” and should point to the right (or sometimes to the left). When the user clicks it, a disclosure triangle rotates downwards into the “open” state. The application should respond by revealing the appropriate information or interface.
On Mac OS X, a root control is created for the window if one does not already exist. If a root control exists for the window, the disclosure triangle control is embedded in it.
HIDisclosureViews.h
Creates a new edit text control.
OSStatus CreateEditUnicodeTextControl ( WindowRef window, const Rect *boundsRect, CFStringRef text, Boolean isPassword, const ControlFontStyleRec *style, ControlRef *outControl );
The window in which the control is to be placed. This parameter may be NULL in Mac OS X v10.3 and later.
The bounds of the control in the window’s local coordinates.
The text of the control. May be NULL.
A Boolean indicating whether the field is to be used as a password field. Passing false indicates that text entered in the field is to be displayed normally. Passing true means that the field is to be used as a password field; any text typed into the field is displayed as bullets.
The control’s font style, size, color, and so on. May be NULL.
On return, the new control. For a description of this data type, see ControlRef.
A result code. See “Control Manager Result Codes.”
This function is the preferred way of creating edit text controls. Use it instead of the CreateEditTextControl function. The resulting control handles Unicode text and draws its text using anti-aliasing. Controls created by CreateEditTextControl do not handle Unicode text and are not drawn with anti-aliasing.
HITextViews.h
Creates a group box control.
OSStatus CreateGroupBoxControl ( WindowRef window, const Rect *boundsRect, CFStringRef title, Boolean primary, ControlRef *outControl );
The window that is to contain the control. This parameter may be NULL in Mac OS X v10.3 and later.
The bounds of the desired control in the window’s local coordinates.
The title of the control. This parameter can be NULL if you don’t want the control to have a title.
A Boolean whose value is true to create a primary group box or false to create a secondary group box. Secondary group boxes are intended to be contained within primary group boxes and have a slightly different appearance.
On return, outControl points to the new control. For a description of this data type, see ControlRef.
A result code. See “Control Manager Result Codes.”
HIContainerViews.h
Creates an icon control.
OSStatus CreateIconControl ( WindowRef inWindow, const Rect *inBoundsRect, const ControlButtonContentInfo *inIconContent, Boolean inDontTrack, ControlRef *outControl );
The window in which the control is to be placed. This parameter may be NULL in Mac OS X v10.3 and later.
The bounds of the control in the window’s local coordinates.
The descriptor for the icon you want the control to display. Mac OS X and CarbonLib 1.5 (and beyond) support all of the icon content types. Prior to CarbonLib 1.5, the only content types that are properly respected are kControlContentIconSuiteRes, kControlContentCIconRes, and kControlContentICONRes.
A Boolean whose value is true to indicate that the control should not be highlighted when it is clicked; false means that the control should be highlighted and the mouse tracked when the control is clicked.
On return, the new control. For a description of this data type, see ControlRef.
A result code. See “Control Manager Result Codes.”
HIImageViews.h
Creates an image well control.
OSStatus CreateImageWellControl ( WindowRef window, const Rect *boundsRect, const ControlButtonContentInfo *info, ControlRef *outControl );
The window that is to contain the control. This parameter may be NULL in Mac OS X v10.3 and later.
The bounds of the control in the window’s local coordinates.
The image that is to be displayed in the image well. The image can be an icon suite, picture, color icon, or an IconRef in Mac OS X v10.0 and later. It can be also be a CGImageRef in Mac OS X v10.4 and later.
On return, outControl points to the new control. For a description of this data type, see ControlRef.
A result code. See “Control Manager Result Codes.”
An image well control is a control that displays an image inside a frame (or “well”). The user can drag other images onto the well.
HIImageViews.h
Creates a list box control.
OSStatus CreateListBoxControl ( WindowRef window, const Rect *boundsRect, Boolean autoSize, SInt16 numRows, SInt16 numColumns, Boolean horizScroll, Boolean vertScroll, SInt16 cellHeight, SInt16 cellWidth, Boolean hasGrowSpace, const ListDefSpec *listDef, ControlRef *outControl );
The window that is to contain the control. This parameter may be NULL in Mac OS X v10.3 and later.
The bounds of the control in the window’s local coordinates.
A Boolean whose value is true to enable auto-sizing; otherwise, false. When auto-sizing is enabled, the control automatically resizes itself as necessary to ensure that the height of the control is an exact multiple of the cell height.
The number of rows the control is to have.
The number of columns the control is to have.
A Boolean whose value is true if the control is to have a horizontal scroll bar; otherwise, false.
A Boolean whose value is true if the control is to have a vertical scroll bar; otherwise, false.
The height of cells in the control.
The width of cells in the control.
A Boolean whose value is true to indicate that the control is drawn so that there is room for a size box; otherwise, false.
A pointer to the list definition function you want to associate with the new control. This parameter may be NULL if you want to use the standard list definition function, which only displays text.
On return, outControl points to the new control. For a description of this data type, see ControlRef.
A result code. See “Control Manager Result Codes.”
The list is created with default values, and uses the standard LDEF (0) if you don’t specify a custom list definition function in the listDef parameter. You can set the LDEF to use by using kControlListBoxLDEFTag. You can change the list by getting the list handle. To get the list handle, call GetControlData and pass the kControlListBoxListHandletag constant.
ControlDefinitions.h
Creates a little arrows control.
OSStatus CreateLittleArrowsControl ( WindowRef window, const Rect *boundsRect, SInt32 value, SInt32 minimum, SInt32 maximum, SInt32 increment, ControlRef *outControl );
The window that is to contain the control. This parameter may be NULL in Mac OS X v10.3 and later.
The bounds of the control in the window’s local coordinates.
The initial value of the control.
The minimum value the control can have.
The maximum value the control can have.
The amount to increment each time an arrow is clicked.
On return, outControl points to the new control. For a description of this data type, see ControlRef.
A result code. See “Control Manager Result Codes.”
This control implements the little up and down arrows seen in the Date & Time system preferences panel. To change the value of this control, you need to create a control action proc. The following sample code creates the control and sets the action proc:
CreateLittleArrowsControl(&rect, minimum, maximum, increment, value); |
SetControlAction(Arrows, LittleArrowActionProc); |
Here is sample code for the action proc:
void LittleArrowActionProc(ControlRef cref, ControlPartCode part) { |
SInt32 val = GetControl32BitValue(cref); |
SInt32 s = 0; |
GetControlData(cref, 0, kControlLittleArrowsIncrementValueTag, sizeof(SInt32), &s, nil; |
switch (part) { |
case kControlUpButtonPart: |
SetControl32BitValue(cref, val+s); |
break; |
case kControlDownButtonPart: |
SetControl32BitValue(cref, val-s); |
break; |
}; |
}; |
HILittleArrows.h
Creates a picture control.
OSStatus CreatePictureControl ( WindowRef window, const Rect *boundsRect, const ControlButtonContentInfo *content, Boolean dontTrack, ControlRef *outControl );
The window in which the control is to be placed. This parameter may be NULL in Mac OS X v10.3 and later.
The bounds of the control in the window’s local coordinates.
The descriptor for the picture you want the control to display. Only picture content is supported. You can change the picture by calling SetControlData and passing the kControlPictureHandleTag constant.
A Boolean whose value is true to indicate that the control should not be highlighted when it is clicked; false means that the control should be highlighted and the mouse tracked when the control is clicked.
On return, the new control.
A result code. See “Control Manager Result Codes.”
ControlDefinitions.h
Creates a placard control.
OSStatus CreatePlacardControl ( WindowRef window, const Rect *boundsRect, ControlRef *outControl );
The window that is to contain the control. This parameter may be NULL in Mac OS X v10.3 and later.
The bounding box of the control in the window’s local coordinates.
On return, the new control. For a description of this data type, see ControlRef.
A result code. See “Control Manager Result Codes.”
HIContainerViews.h
Creates a pop-up arrow control.
OSStatus CreatePopupArrowControl ( WindowRef window, const Rect *boundsRect, ControlPopupArrowOrientation orientation, ControlPopupArrowSize size, ControlRef *outControl );
The window that is to contain the control. This parameter may be NULL in Mac OS X v10.3 and later.
The bounds of the control in the window’s local coordinates.
The orientation of the control.
The size of the control.
On return, the new control. For a description of this data type, see ControlRef.
A result code. See “Control Manager Result Codes.”
HIPopupButton.h
Creates a pop-up button control.
OSStatus CreatePopupButtonControl ( WindowRef window, const Rect *boundsRect, CFStringRef title, MenuID menuID, Boolean variableWidth, SInt16 titleWidth, SInt16 titleJustification, Style titleStyle, ControlRef *outControl );
The window in which the control is to be placed. This parameter may be NULL in Mac OS X v10.3 and later.
The bounds of the control in the window’s local coordinates.
The title of the control.
The ID of a menu that should be used by the control. A menu with this ID should be inserted into the menubar with InsertMenu(menu, kInsertHierarchicalMenu). You can also pass -12345 to have the control delay its acquisition of a menu; in this case, you can build the menu and later provide it to the control with SetControlData and kControlPopupButtonMenuRefTag or kControlPopupButtonOwnedMenuRefTag.
A Boolean whose value indicates whether the width of the control is allowed to vary according to the width of the selected menu item text (true), or should remain fixed to the original control bounds width (false).
The width of the title.
The justification of the title. Use a TextEdit justification constant (teFlushDefault, teCenter, teFlushRight, or teFlushLeft).
A QuickDraw style bitfield indicating the font style of the title.
On return, the new control. For a description of this data type, see ControlRef.
A result code. See “Control Manager Result Codes.”
HIPopupButton.h
Creates a group box control that has a pop-up button as its title.
OSStatus CreatePopupGroupBoxControl ( WindowRef window, const Rect *boundsRect, CFStringRef title, Boolean primary, MenuID menuID, Boolean variableWidth, SInt16 titleWidth, SInt16 titleJustification, Style titleStyle, ControlRef *outControl );
The window that is to contain the control. This parameter may be NULL in Mac OS X v10.3 and later.
The bounds of the control in the window’s local coordinates.
The title of the control. The title is used as the title of the pop-up button.
A Boolean whose value is true to create a primary group box or false to create a secondary group box.
The menu ID of the menu that is to be displayed by the pop-up button. A menu with this ID should be inserted into the menubar with InsertMenu(menu, kInsertHierarchicalMenu). You can also pass -12345 to have the control delay its acquisition of a menu; in this case, you can build the menu and later provide it to the control with SetControlData and kControlPopupButtonMenuRefTag or kControlPopupButtonOwnedMenuRefTag.
A Boolean whose value is true if the pop-up button is to have a variable-width title or false if the pop-up button is to have a fixed-width title. Fixed-width titles are only supported by Mac OS X; this parameter must be true when used with CarbonLib.
The width in pixels of the pop-up button title.
The justification of the pop-up button title. Use a TextEdit justification constant (teFlushDefault, teCenter, teFlushRight, or teFlushLeft).
The QuickDraw text style of the pop-up button title.
On return, outControl points to the new control. For a description of this data type, see ControlRef.
A result code. See “Control Manager Result Codes.”
HIContainerViews.h
Creates a progress bar control.
OSStatus CreateProgressBarControl ( WindowRef window, const Rect *boundsRect, SInt32 value, SInt32 minimum, SInt32 maximum, Boolean indeterminate, ControlRef *outControl );
The window that is to contain the control. This parameter may be NULL in Mac OS X v10.3 and later.
The bounds of the control in the window’s local coordinates.
The initial value of the control.
The minimum value of the control.
The maximum value of the control.
A Boolean whose value is true if you want the control to display a rotating barber pole effect to indicate that something is happening (an indeterminate progress bar) or false if you want to display a determinate progress bar that uses the values of the minimum and maximum parameters to show progress from minimum to maximum.
On return, outControl points to the new control. For a description of this data type, see ControlRef.
A result code. See “Control Manager Result Codes.”
HIProgressViews.h
Creates a push button control.
OSStatus CreatePushButtonControl ( WindowRef window, const Rect *boundsRect, CFStringRef title, ControlRef *outControl );
The window in which the control is to be placed. This parameter may be NULL in Mac OS X v10.3 and later.
The bounds of the control in the window’s local coordinates.
The control title. May be NULL.
On return, the new control. For a description of this data type, see ControlRef.
A result code. See “Control Manager Result Codes.”
HIButtonViews.h
Creates a push button control containing an icon or other graphical content.
OSStatus CreatePushButtonWithIconControl ( WindowRef window, const Rect *boundsRect, CFStringRef title, ControlButtonContentInfo *icon, ControlPushButtonIconAlignment iconAlignment, ControlRef *outControl );
The window in which the control is to be placed. This parameter may be NULL in Mac OS X v10.3 and later.
The bounds of the control, in local coordinates of the window.
The control title. May be NULL.
The control graphic content. The value of this parameter can be kControlContentCIconRes in Mac OS X v10.0 and later. It can also be kControlContentCGImageRef in Mac OS X v10.4 and later.
The alignment of the control graphic content.For possible values, see “Control Push Button Icon Alignment Constants.”
On return, the new control. For a description of this data type, see ControlRef.
A result code. See “Control Manager Result Codes.”
HIButtonViews.h
Creates a radio button control.
OSStatus CreateRadioButtonControl ( WindowRef window, const Rect *boundsRect, CFStringRef title, SInt32 initialValue, Boolean autoToggle, ControlRef *outControl );
The window in which the control is to be placed. This parameter may be NULL in Mac OS X v10.3 and later.
The bounds of the control in the window’s local coordinates.
The control title. May be NULL.
The initial value of the control. Should be 0 (off), 1 (on), or 2 (mixed). The control is automatically given a minimum value of 0 and a maximum value of 2.
A Boolean whose value indicates whether this control should have auto-toggle behavior. If true, the control automatically toggles between on and off states when clicked. This parameter should be false if the control is embedded into a radio group control; in that case, the radio group handles setting the correct control value in response to a click.
On return, the new control.
A result code. See “Control Manager Result Codes.”
HIButtonViews.h
Creates a radio group control.
OSStatus CreateRadioGroupControl ( WindowRef window, const Rect *boundsRect, ControlRef *outControl );
The window that is to contain the control. This parameter may be NULL in Mac OS X v10.3 and later.
The bounds of the control in the window’s local coordinates.
On return, outControl points to the new control. For a description of this data type, see ControlRef.
A result code. See “Control Manager Result Codes.”
This control implements a radio group. It is an embedding control and can therefore only be used when a control hierarchy is established for its owning window. You should only embed radio buttons within it. As radio buttons are embedded into it, the group sets up its value, min, and max to represent the number of embedded items. The current value of the control is the index of the sub-control that is the current “on” radio button. To get the current radio button control handle, you can use the Control Manager call GetIndexedSubControl, passing in the value of the radio group.
Note that when creating radio buttons for use in a radio group control, you should not use the auto-toggle version of the radio button. The radio group control handles toggling the radio button values itself; auto-toggle radio buttons do not work properly in a radio group control on Mac OS 9.
HIButtonViews.h
Creates a relevance bar control.
OSStatus CreateRelevanceBarControl ( WindowRef window, const Rect *boundsRect, SInt32 value, SInt32 minimum, SInt32 maximum, ControlRef *outControl );
The window that is to contain the control. This parameter may be NULL in Mac OS X v10.3 and later.
The bounds of the control in the window’s local coordinates.
The initial value of the control.
The minimum value of the control.
The maximum value of the control.
On return, outControl points to the new control. For a description of this data type, see ControlRef.
A result code. See “Control Manager Result Codes.”
HIRelevanceBar.h
Creates the root control for a specified window.
OSErr CreateRootControl ( WindowRef inWindow, ControlRef *outControl );
A pointer to the window in which you wish to create a root control.
On input, a pointer to a ControlHandle value. On return, the ControlHandle value is set to a handle to the root control.
A result code. See “Control Manager Result Codes.”
Establishing an embedding hierarchy can be accomplished in two steps: creating a root control and embedding controls within it.
To embed controls in a window, you must create a root control for that window. The root control is the container for all other window controls. You create the root control in one of two ways—by calling the CreateRootControl function or by setting the appropriate dialog flag. The root control can be retrieved by calling the function GetRootControl.
The CreateRootControl function creates the root control for a window if no other controls are present. If there are any controls in the window prior to calling CreateRootControl, an error is returned and the root control is not created. Note that the minimum, maximum, and initial settings for a root control are reserved and should not be changed.
The root control is implemented as a user pane control. You can attach any application-defined user pane functions to the root control to perform actions such as hit testing, drawing, handling keyboard focus, erasing to the correct background, and processing idle and keyboard events.
Once you have created a root control, newly created controls will automatically be embedded in the root control when you call NewControl or GetNewControl. You can specify that a specific control be embedded into another by calling EmbedControl.
By acting on an embedder control, you can move, disable, or hide groups of items. For example, you can use a blank user pane control as the embedder control for all items in a particular “page” of a tab control. After creating as many user panes as you have tabs, you can hide one and show the next when a tab is clicked. All the controls embedded in the user pane will be hidden and shown automatically when the user pane is hidden and shown.
In addition to calling CreateRootControl, you can establish an embedding hierarchy in a dialog box by either setting the feature bit kDialogFlagsUseControlHierarchy in the extended dialog resource or passing it in the inFlags parameter of the Dialog Manager function NewFeaturesDialog. An embedding hierarchy can be created in an alert box by setting the kAlertFlagsUseControlHierarchy bit in the extended alert resource. It is important to note that a preexisting alert or dialog item will become a control if it is in an alert or dialog box that now uses an embedding hierarchy.
The embedding hierarchy enforces drawing order by drawing the embedding control before its embedded controls. Using an embedding hierarchy also enforces orderly hit-testing, since it performs an “inside-out” hit test to determine the most deeply nested control that is hit by the mouse. An embedding hierarchy is also necessary for controls to make use of keyboard focus, the default focusing order for which is a linear progression that uses the order the controls were added to the window. For more details on keyboard focus, see “Handling Keyboard Focus”.
Controls.h
Creates a new instance of the round button control.
OSStatus CreateRoundButtonControl ( WindowRef inWindow, const Rect *inBoundsRect, ControlRoundButtonSize inSize, ControlButtonContentInfo *inContent, ControlRef *outControl );
The WindowRef in which to create the control.
The bounds of the control in the window’s local coordinates. The height and width of the control are fixed (specified by the ControlRoundButtonSize parameter) and the control will be centered within the rectangle you specify.
The button size; either kControlRoundButtonNormalSize or kControlRoundButtonLargeSize.
Any optional content displayed in the button. In Mac OS X v10.0 and later, kControlContentIconRef is supported.
On return, the new control. For a description of this data type, see ControlRef.
A result code. See “Control Manager Result Codes.”
CreateRoundButtonControl is preferred over NewControl because it allows you to specify the exact set of parameters required to create the control without overloading parameter semantics.
HIButtonViews.h
Creates a scroll bar control.
OSStatus CreateScrollBarControl ( WindowRef window, const Rect *boundsRect, SInt32 value, SInt32 minimum, SInt32 maximum, SInt32 viewSize, Boolean liveTracking, ControlActionUPP liveTrackingProc, ControlRef *outControl );
The window in which the control is to be placed. This parameter may be NULL in Mac OS X v10.3 and later.
The bounds of the control in the window’s local coordinates.
The initial value of the control.
The minimum value of the control.
The maximum value of the control.
The size of the visible area of the scroll bar content. If this parameter is a non-zero value, this function creates a proportional scroll bar thumb; a value of 0 causes a non-proportional scroll bar thumb to be created.
A Boolean indicating whether or not live tracking is enabled for this scroll bar. If set to true and a valid liveTrackingProc is also passed in, the callback is called repeatedly as the thumb is moved during tracking. If set to false, a semi-transparent thumb called a “ghost thumb” draws and no live tracking occurs.
If the value of the liveTracking parameter is true, a ControlActionUPP callback is to be called as the control live tracks. This callback is called repeatedly as the scroll thumb is moved during tracking.
On return, the new control. For a description of this data type, see ControlRef.
A result code. See “Control Manager Result Codes.”
HIScrollView.h
Creates a scrolling text box control.
OSStatus CreateScrollingTextBoxControl ( WindowRef window, const Rect *boundsRect, SInt16 contentResID, Boolean autoScroll, UInt32 delayBeforeAutoScroll, UInt32 delayBetweenAutoScroll, UInt16 autoScrollAmount, ControlRef *outControl );
The window that is to contain the control. This parameter may be NULL in Mac OS X v10.3 and later.
The bounds of the control in the window’s local coordinates.
The resource ID of ‘TEXT’ and (optionally) ‘style’ resources whose contents are to be displayed.
A Boolean whose value is true to enable automatic scrolling; otherwise, false.
The number of ticks to wait before scrolling automatically. This parameter is ignored and can be set to 0 if the value of the autoScroll parameter is false.
The number of ticks to wait between automatic scrolls. This parameter is ignored and can be set to 0 if the value of the autoScroll parameter is false.
The number of pixels to scroll. This parameter is ignored and can be set to 0 if the value of the autoScroll parameter is false.
On return, outControl points to the newly-created control.
A result code. See “Control Manager Result Codes.”
This control implements a scrolling box of text that cannot be edited. This is useful for credits in about boxes.
The standard version of this control has a scroll bar, but the autoscrolling variant does not. The autoscrolling variant needs two pieces of information to work: delay (in ticks) before the scrolling starts, and time (in ticks) between scrolls. This control scrolls one pixel at a time if created by NewControl, unless changed by calling SetControlData.
ControlDefinitions.h
Creates a separator control.
OSStatus CreateSeparatorControl ( WindowRef window, const Rect *boundsRect, ControlRef *outControl );
The window that is to contain the control. This parameter may be NULL in Mac OS X v10.3 and later.
The bounds of the control in the window’s local coordinates.
On return, outControl points to the new control. For a description of this data type, see ControlRef.
A result code. See “Control Manager Result Codes.”
The horizontal or vertical orientation of a separator line is determined automatically based on the relative height and width of its control bounds.
HISeparator.h
Creates a slider control.
OSStatus CreateSliderControl ( WindowRef window, const Rect *boundsRect, SInt32 value, SInt32 minimum, SInt32 maximum, ControlSliderOrientation orientation, UInt16 numTickMarks, Boolean liveTracking, ControlActionUPP liveTrackingProc, ControlRef *outControl );
The window that is to contain the control. This parameter may be NULL in Mac OS X v10.3 and later.
The bounds of the control in the window’s local coordinates.
The initial value of the control.
The minimum value of the control.
The maximum value of the control.
The orientation of the control. For possible values, see “Control Slider Orientation Constants.”
The number of tick marks the slider control is to have.
A Boolean whose value is true to enable live tracking for the control; otherwise, false.
If the value of the liveTracking parameter is true, a ControlActionUPP callback is to be called as the control live tracks. This callback is called repeatedly as the slider is moved during tracking.
On return, outControl points to the new control. For a description of this data type, see ControlRef.
A result code. See “Control Manager Result Codes.”
Mac OS X has a “Scroll to here” option in the General pane of System Preferences that allows users to click in the page up or page down regions of a slider and have the indicator jump directly to the clicked position, which alters the value of the slider and moves any associated content appropriately. As long as the mouse button is held down, the click is treated as though the user clicked the indicator.
If you want the sliders in your application to work with the “Scroll to here” option, you must do the following:
Create live-tracking sliders, not sliders that show a “ghost” thumb when you click on it. You can request live-tracking sliders by passing true in the liveTracking parameter to CreateSliderControl. If you create sliders with NewControl, use the kControlSliderLiveFeedback variant.
Write an appropriate ControlActionProc and associate it with your slider by calling SetControlAction. This allows your application to update its content appropriately when the live-tracking slider is clicked.
When callingHandleControlClick or TrackControl TrackControl, pass -1 in the action proc parameter. This is a request for the Control Manager to use the action proc you associated with your control in step 2. If you rely on the standard window event handler to do your control tracking, this step is handled for you automatically.
HISlider.h
Creates a new static text control.
OSStatus CreateStaticTextControl ( WindowRef window, const Rect *boundsRect, CFStringRef text, const ControlFontStyleRec *style, ControlRef *outControl );
The window in which the control is to be placed. This parameter may be NULL in Mac OS X v10.3 and later.
The bounds of the control in the window’s local coordinates.
The text of the control. May be NULL.
The control’s font style, size, color, and so on. May be NULL.
On return, the new control. For a description of this data type, see ControlRef.
A result code. See “Control Manager Result Codes.”
HITextViews.h
Creates a tabs control.
OSStatus CreateTabsControl ( WindowRef window, const Rect *boundsRect, ControlTabSize size, ControlTabDirection direction, UInt16 numTabs, const ControlTabEntry *tabArray, ControlRef *outControl );
The window in which the control is to be placed. This parameter may be NULL in Mac OS X v10.3 and later.
The bounds of the control in the window’s local coordinates.
The control tab size. See “Control Tab Size Constants” for possible values.
The control tab direction. See “Control Tab Direction Constants” for possible values.
The initial number of tabs.
Information about each tab. There must be the same number of entries as specified by the numTabs parameter.
On return, the new control. For a description of this data type, see ControlRef.
A result code. See “Control Manager Result Codes.”
If you want to customize the accessibility information provided for individual tabs of a tabs control, such as by handling various kEventClassAccessibility Carbon Events and by calling HIObjectSetAuxiliaryAccessibilityAttribute, you need to know how to build or interpret AXUIElement reference that represent individual tabs. The AXUIElement representing an individual tab must be constructed using the tab control’s ControlRef and the UInt64 identifier of the one-based index of the tab to which the element refers. A UInt64 identifier of 0 represents the tabs control as a whole. You cannot interpret or create tab control elements whose identifiers are greater than the count of tabs in the tabs control.
HITabbedView.h
Creates a user pane control.
OSStatus CreateUserPaneControl ( WindowRef window, const Rect *boundsRect, UInt32 features, ControlRef *outControl );
The window in which the control is to be placed. This parameter may be NULL in Mac OS X v10.3 and later.
The bounds of the control in the window’s local coordinates.
The user pane features with which the user pane is to be created. For possible constants, see “Control Features Constants.”
On return, the new control. For a description of this data type, see ControlRef.
A result code. See “Control Manager Result Codes.”
User panes have two primary purposes: to allow easy implementation of a custom control by the developer, and to provide a generic container for embedding other controls.
In Carbon, with the advent of Carbon-event-based controls, you may find it easier to write a new control from scratch than to customize a user pane control. The set of callbacks provided by the user pane will not be extended to support new Control Manager features; instead, you should just write a real control.User panes do not, by default, support embedding. If you try to embed a control into a user pane, you will get the errControlIsNotEmbedder. You can make a user pane support embedding by passing the kControlSupportsEmbedding flag in the features parameter when you create the control.
HIContainerViews.h
Creates a window header control.
OSStatus CreateWindowHeaderControl ( WindowRef window, const Rect *boundsRect, Boolean isListHeader, ControlRef *outControl );
The window in which the control is to be placed. This parameter may be NULL in Mac OS X v10.3 and later.
The bounds of the control in the window’s local coordinates.
A Boolean whose value is true if the control should have an appropriate appearance to be the header of a list; otherwise, false.
On return, the new control. For a description of this data type, see ControlRef.
A result code. See “Control Manager Result Codes.”
HIContainerViews.h
Deactivates a control and any latent embedded controls.
OSErr DeactivateControl ( ControlRef inControl );
A handle to the control to deactivate. If you pass a window’s root control, DeactivateControl deactivates all controls in that window.
A result code. See “Control Manager Result Codes.”
The DeactivateControl function should be called instead of HiliteControl to deactivate a specified control and its latent embedded controls.
An embedded control is considered latent when it is deactivated or hidden due to its embedder control being deactivated or hidden. If you activate a latent embedded control whose embedder is deactivated, the embedded control becomes latent until the embedder is activated. However, if you deactivate a latent embedded control, it will not be activated when its embedder is activated.
If a control definition function supports activate events, it will receive a kControlMsgActivate message before redrawing itself in its inactive state.
Controls.h
Disables a control.
OSStatus DisableControl ( ControlRef inControl );
The control to disable. For a description of this data type, see ControlRef.
A result code. See “Control Manager Result Codes.”
Controls.h
Decrements a control’s reference count and destroys it if the reference count becomes 0.
void DisposeControl ( ControlRef theControl );
The control you want to dispose of. For a description of this data type, see ControlRef.
The DisposeControl function reduces the control’s reference count and, if the reference count becomes 0, releases the memory occupied by the control structure and any data structures associated with the control. Before destroying the control, DisposeControl removes the control (and any embedded controls it may possess) from the screen and deletes the control from the window’s control list.
To destroy all of the controls from a window you want to keep, use the function KillControls. If an embedding hierarchy is present, passing the root control to the DisposeControl function is the effectively the same as calling KillControls. In that situation, DisposeControl disposes of the controls embedded within a control before disposing of the container control.
You should use DisposeControl when you want to retain the window but remove one of its controls. The Window Manager functions CloseWindow and DisposeWindow automatically remove all controls associated with the window and release the memory the controls occupy.
Controls.h
Disposes of a control action UPP.
void DisposeControlActionUPP ( ControlActionUPP userUPP );
The UPP that is to be disposed of.
Controls.h
Disposes of a CNLT to collection UPP.
void DisposeControlCNTLToCollectionUPP ( ControlCNTLToCollectionUPP userUPP );
The UPP that is to be disposed of.
Controls.h
Not recommended
void DisposeControlColorUPP ( ControlColorUPP userUPP );
Instead of specifying a callback to redraw your background, you should make the background a control and then embed your other controls within it.
Controls.h
Disposes of an edit text validation UPP.
void DisposeControlEditTextValidationUPP ( ControlEditTextValidationUPP userUPP );
The UPP that is to be disposed of.
HITextViews.h
Disposes of a key filter UPP.
void DisposeControlKeyFilterUPP ( ControlKeyFilterUPP userUPP );
The UPP that is to be disposed of.
Controls.h
Disposes of a user pane activate UPP.
void DisposeControlUserPaneActivateUPP ( ControlUserPaneActivateUPP userUPP );
The UPP that is to be disposed of.
HIContainerViews.h
Disposes of a user pane background UPP.
void DisposeControlUserPaneBackgroundUPP ( ControlUserPaneBackgroundUPP userUPP );
The UPP that is to be disposed of.
HIContainerViews.h
Disposes of a user pane draw UPP.
void DisposeControlUserPaneDrawUPP ( ControlUserPaneDrawUPP userUPP );
The UPP that is to be disposed of.
HIContainerViews.h
Disposes of a user pane focus UPP.
void DisposeControlUserPaneFocusUPP ( ControlUserPaneFocusUPP userUPP );
The UPP that is to be disposed of.
HIContainerViews.h
Disposes of a user pane hit test UPP.
void DisposeControlUserPaneHitTestUPP ( ControlUserPaneHitTestUPP userUPP );
The UPP that is to be disposed of.
HIContainerViews.h
Disposes of a user pane idle UPP.
void DisposeControlUserPaneIdleUPP ( ControlUserPaneIdleUPP userUPP );
The UPP that is to be disposed of.
HIContainerViews.h
Disposes of a user pane key down UPP.
void DisposeControlUserPaneKeyDownUPP ( ControlUserPaneKeyDownUPP userUPP );
The UPP that is to be disposed of.
HIContainerViews.h
Disposes of a user pane tracking UPP.
void DisposeControlUserPaneTrackingUPP ( ControlUserPaneTrackingUPP userUPP );
The UPP that is to be disposed of.
HIContainerViews.h
Disposes of an edit unicode post update UPP.
void DisposeEditUnicodePostUpdateUPP ( EditUnicodePostUpdateUPP userUPP );
The UPP that is to be disposed of.
HITextViews.h
Draws and moves an outline of a control or its indicator while the user drags it. (Deprecated. Use Drag Manager functions if you want drag-and-drop support for controls. See Drag Manager Reference.)
Not recommended
void DragControl ( ControlRef theControl, Point startPoint, const Rect *limitRect, const Rect *slopRect, DragConstraint axis );
A handle to the control to drag. For a description of this data type, see ControlRef.
The location of the cursor at the time the mouse button was first pressed, in global coordinates. Your application retrieves this point from the where field of the event structure.
A pointer to a rectangle—whose coordinates should normally coincide with or be contained in the window’s content region—delimiting the area in which the user can drag the control’s outline.
A pointer to a rectangle that allows some extra space for the user to move the mouse while still constraining the control within the rectangle specified in the limitRect parameter.
The axis along which the user may drag the control’s outline. Specify the axis using one of the following values: noConstraint (no constraint), hAxisOnly (drag along horizontal axis only), vAxisOnly (drag along vertical axis only).
The DragControl function moves a dotted outline of a control, such as a scroll box, around the screen, following the movements of the cursor until the user releases the mouse button. When the user releases the mouse button, DragControl moves the control to the new location.
The function TrackControl automatically calls the DragControl function as appropriate; when you use TrackControl, you don’t need to call DragControl.
Before tracking the cursor, DragControl calls the control definition function. If you define your own control definition function, you can specify custom dragging behavior.
Controls.h
Draws a control and any embedded controls that are currently visible in the specified window.
void Draw1Control ( ControlRef theControl );
A handle to the control to draw. For a description of this data type, see ControlRef.
Although you should generally use the functionUpdateControls to update controls, you can use the DrawOneControl function to update a single control. If an embedding hierarchy exists and the control passed in has embedded controls, DrawOneControl draws the control and embedded controls. If the root control for a window is passed in, the result is the same as if DrawControls was called.
If you are using compositing mode, you generally do not need to call Draw1Control. If you call Draw1Control in compositing mode, keep in mind that it draws the specified control as well as all other controls that intersect the control.
Controls.h
Draws a control in the current graphics port.
void DrawControlInCurrentPort ( ControlRef inControl );
A handle to the control to draw. For a description of this data type, see ControlRef.
Typically, controls are automatically drawn in their owner’s graphics port with the functions DrawControls, Draw1Control, and UpdateControls. DrawControlInCurrentPort permits easy offscreen control drawing and printing. All standard system controls support this function.
Controls.h
Draws all controls currently visible in the specified window.
void DrawControls ( WindowRef theWindow );
A pointer to a window whose controls you want to display.
Because the UpdateControls function redraws only those controls that need updating, your application should generally use it instead of DrawControls when you receive an update event for a window that contains controls. You should typically call either DrawControls or UpdateControls after calling the Window Manager function BeginUpdate and before calling EndUpdate.
While the Dialog Manager automatically draws and updates controls in alert boxes and dialog boxes, Window Manager functions such as SelectWindow, ShowWindow, and BringToFront do not automatically update the window’s controls.
When the Appearance Manager is not available, the DrawControls function draws all controls currently visible in the specified window in reverse order of creation; thus, in case of overlapping controls, the control created first appears frontmost in the window. If you only wish to draw controls in need of update, call UpdateControls instead.
Note that DrawControls generally should not be called if you are using compositing mode.
Controls.h
Writes a textual representation of the control hierarchy for a specified window into a file.
OSErr DumpControlHierarchy ( WindowRef inWindow, const FSSpec *inDumpFile );
A pointer to the window whose control hierarchy you wish to examine.
A pointer to a file specification in which to place a text description of the window’s control hierarchy.
A result code. See “Control Manager Result Codes.”
The DumpControlHierarchy function places a text listing of the current control hierarchy for the window specified into the specified file, overwriting any existing file. If the specified window does not contain a control hierarchy, DumpControlHierarchy notes this in the text file. This function is useful for debugging embedding-related problems.
HIToolboxDebugging.h
Embeds one control inside another.
OSErr EmbedControl ( ControlRef inControl, ControlRef inContainer );
The control that is to be embedded. For a description of this data type, see ControlRef.
The control in which the control specified by inControl is to be is to embedded. For a description of this data type, see ControlRef.
A result code. See “Control Manager Result Codes.”
Establishing an embedding hierarchy can be accomplished in two steps: creating a root control and embedding controls within it.
To embed controls in a window, you must create a root control for that window. The root control is the container for all other window controls. You create the root control in one of two ways—by calling the CreateRootControl function or by setting the appropriate dialog flag. The root control can be retrieved by calling GetRootControl.
The root control is implemented as a user pane control. You can attach any application-defined user pane functions to the root control to perform actions such as hit testing, drawing, handling keyboard focus, erasing to the correct background, and processing idle and keyboard events.
Once you have created a root control, newly created controls will automatically be embedded in the root control when you call NewControl or GetNewControl. You can specify that a specific control be embedded into another by calling EmbedControl.
Note that an embedding hierarchy must be established before your application calls the EmbedControl function. If the specified control does not support embedding or there is no root control in the owning window, an error is returned. Prior to Mac OS X, if the control you wish to embed is in a different window from the embedder control, an error is returned. On Mac OS X, however, you can use EmbedControl to move a control from one window to another. On Mac OS X v.10.0 and v.10.1, you can move all controls except for the edit text and unicode edit text controls. Support for the edit text controls is available in Mac OS X v.10.2 and later.
By acting on an embedder control, you can move, disable, or hide groups of items. For example, you can use a blank user pane control as the embedder control for all items in a particular “page” of a tab control. After creating as many user panes as you have tabs, you can hide one and show the next when a tab is clicked. All the controls embedded in the user pane will be hidden and shown automatically when the user pane is hidden and shown.
In addition to calling CreateRootControl, you can establish an embedding hierarchy in a dialog box by either setting the feature bit kDialogFlagsUseControlHierarchy in the extended dialog resource or passing it in the inFlags parameter of the Dialog Manager function NewFeaturesDialog. An embedding hierarchy can be created in an alert box by setting the kAlertFlagsUseControlHierarchy bit in the extended alert resource. It is important to note that a preexisting alert or dialog item will become a control if it is in an alert or dialog box that now uses an embedding hierarchy.
The embedding hierarchy enforces drawing order by drawing the embedding control before its embedded controls. Using an embedding hierarchy also enforces orderly hit-testing, since it performs an “inside-out” hit test to determine the most deeply nested control that is hit by the mouse. An embedding hierarchy is also necessary for controls to make use of keyboard focus, the default focusing order for which is a linear progression that uses the order the controls were added to the window. For more details on keyboard focus, see “Handling Keyboard Focus”.
Controls.h
Enables a control.
OSStatus EnableControl ( ControlRef inControl );
The control that is to be enabled.
A result code. See “Control Manager Result Codes.”
Controls.h
Obtains the location of a mouse-down event in a control.
ControlPartCode FindControl ( Point testPoint, WindowRef theWindow, ControlRef *theControl );
A point, specified in coordinates local to the window, where the mouse-down event occurred. Before calling FindControl, use the GlobalToLocal function to convert the point stored in the where field of the event structure (which describes the location of the mouse-down event) to coordinates local to the window.
A pointer to the window in which the mouse-down event occurred. Pass the window pointer returned by the FindWindow function.
A pointer to a control handle. On output, FindControl returns a handle to the control in which the mouse-down event occurred or NULL if the point was not over a control. For a description of this data type, see ControlRef.
The control part code of the control in which the mouse-down event occurred; see “Control Meta Part Code Constants,” “Control Part Code Constants ,” and“ Control State Part Code Constants.” For a description of this data type, see ControlPartCode.
The FindControl function is not recommended when the Appearance Manager is available. When the Appearance Manager is available, you should call FindControlUnderMouse to determine the location of a mouse-down event in a control. FindControlUnderMouse will return a handle to the control even if no part was hit and can determine whether a mouse-down event has occurred even if the control is deactivated, while FindControl does not.
If the Appearance Manager is not available, then, when a mouse-down event occurs, your application can call FindControl after using the Window Manager function FindWindow to ascertain that a mouse-down event has occurred in the content region of a window containing controls.
When the user presses the mouse button while the cursor is in a visible, active control, FindControl returns as its function result a part code identifying the control’s part the function also returns a handle to the control in the parameter theControl.
If the mouse-down event occurs in an invisible or inactive control, or if it occurs outside a control, FindControl sets the value referenced through theControl to NULL and returns 0 as its function result.
The FindControl function also returns NULL in the value referenced through the parameter theControl and 0 as its function result if the window is invisible or if it doesn’t contain the given point. (However, FindWindow won’t return a window pointer to an invisible window or to one that doesn’t contain the point where the mouse-down event occurred. As long as you call FindWindow before FindControl, this situation won’t arise.)
After using FindControl to determine that a mouse-down event has occurred in a control, you typically call the function TrackControl to follow and respond to the cursor movements in that control, and then to determine in which part of the control the mouse-up event occurs.
The pop-up control definition function does not define part codes for pop-up menus. Instead, your application should store the handles for your pop-up menus when you create them. Your application should then test the handles you store against the handles returned by FindControl before responding to users’ choices in pop-up menus.
The Dialog Manager automatically calls FindControl and TrackControl for mouse-down events inside controls of alert boxes and dialog boxes.
Controls.h
Obtains the location of a mouse-down event in a control.
ControlRef FindControlUnderMouse ( Point inWhere, WindowRef inWindow, ControlPartCode *outPart );
A point, specified in coordinates local to the window, where the mouse-down event occurred. Before calling FindControlUnderMouse, use the QuickDraw GlobalToLocal function to convert the point stored in the where field of the event structure (which describes the location of the mouse-down event) to coordinates local to the window.
A pointer to the window in which the mouse-down event occurred.
On input, a pointer to a signed 16-bit integer value. On return, the value is set to the part code of the control part that was selected; see “Control Part Code Constants ,” “Control Part Code Constants ,” and “ Control State Part Code Constants.”
A handle to the control that was selected. If the mouse-down event did not occur over a control part, FindControlUnderMouse returns NULL. For a description of this data type, see ControlRef.
You should call the FindControlUnderMouse function instead of FindControl to determine whether a mouse-down event occurred in a control, particularly if an embedding hierarchy is present. FindControlUnderMouse will return a handle to the control even if no part was hit and can determine whether a mouse-down event has occurred even if the control is deactivated, while FindControl does not.
When a mouse-down event occurs, your application should call FindControlUnderMouse after using the Window Manager function FindWindow to ascertain that a mouse-down event has occurred in the content region of a window containing controls.
Controls.h
Obtains a control’s optimal size and text placement.
OSErr GetBestControlRect ( ControlRef inControl, Rect *outRect, SInt16 *outBaseLineOffset );
A handle to the control to be examined.
On input, a pointer to an empty rectangle (0, 0, 0, 0). On return, the rectangle is set to the optimal size for the control. If the control doesn’t support getting an optimal size rectangle, the control’s bounding rectangle is passed back.
On input, a pointer to a signed 16-bit integer value. On return, the value is set to the offset from the bottom of control to the base of the text (usually a negative value). If the control doesn’t support optimal sizing or has no text, 0 is passed back.
A result code. See “Control Manager Result Codes.”
You can call the GetBestControlRect function to automatically position and size controls in accordance with human interface guidelines. This function is particularly helpful in determining the correct placement of control text whose length is not known until run-time. For example, the StandardAlert function uses GetBestControlRect to automatically size and position buttons in a newly created alert box.
Controls.h
Gets the content information for a bevel button.
OSErr GetBevelButtonContentInfo ( ControlRef inButton, ControlButtonContentInfoPtr outContent );
The control reference for the button to query.
A value of type ControlButtonContentInfoPtr for the bevel button’s content information.
A result code. See “Control Manager Result Codes.”
HIButtonViews.h
Gets the menu handle for a bevel button.
OSErr GetBevelButtonMenuHandle ( ControlRef inButton, MenuHandle *outHandle );
The control reference for the button to query.
A pointer to the menu handle.
A result code. See “Control Manager Result Codes.”
HIButtonViews.h
Gets the value of a bevel button menu.
OSErr GetBevelButtonMenuValue ( ControlRef inButton, MenuItemIndex *outValue );
The control reference for the button to query.
A pointer to the value of the bevel button menu.
A result code. See “Control Manager Result Codes.”
HIButtonViews.h
Obtains the maximum setting of a control.
SInt32 GetControl32BitMaximum ( ControlRef theControl );
A handle to the control whose maximum setting you wish to obtain. For a description of this data type, see ControlRef.
The maximum setting of the control.
Your application may use the GetControl32BitMaximum function to obtain a 32-bit value previously set with the function SetControl32BitMaximum.
If your application uses a 32-bit control maximum value, it should not attempt to obtain this value by calling the pre–Mac OS 8.5 function GetControlMaximum because the 16-bit value that is returned does not accurately reflect the current 32-bit control value.
Controls.h
Obtains the minimum setting of a control.
SInt32 GetControl32BitMinimum ( ControlRef theControl );
A handle to the control whose minimum setting you wish to obtain. For a description of this data type, see ControlRef.
The minimum setting of the control.
Your application may use the GetControl32BitMinimum function to obtain a 32-bit value previously set with the function SetControl32BitMinimum.
If your application uses a 32-bit control minimum value, it should not attempt to obtain this value by calling the pre–Mac OS 8.5 function GetControlMinimum because the 16-bit value that is returned does not accurately reflect the current 32-bit control value.
Controls.h
Obtains the current setting of a control.
SInt32 GetControl32BitValue ( ControlRef theControl );
A handle to the control whose current setting you wish to obtain.
The current setting of the control.
Your application may use the GetControl32BitValue function to obtain a 32-bit value previously set with the function SetControl32BitValue.
If your application uses a 32-bit control value, it should not attempt to obtain this value by calling the pre–Mac OS 8.5 function GetControlValue because the 16-bit value that is returned does not accurately reflect the current 32-bit control value.
Controls.h
Returns a pointer to the action function associated with a control structure.
ControlActionUPP GetControlAction ( ControlRef theControl );
A handle to a control.
The action function associated with the control. The action function is called by the HandleControlClick and TrackControl functions if you set the InAction parameter to (ControlActionUPP)-1. See ControlActionProcPtr for an example of an action function.
The action function returned by the GetControlAction function defines an action to take in response to a mouse button being held down while the cursor is in the control. An action function is usually specified in the InAction parameter of the functions HandleControlClick and TrackControl. You can use the function SetControlAction to change the action function.
Controls.h
Gets the bounds of a control.
Rect * GetControlBounds ( ControlRef control, Rect *bounds );
The control to query. For a description of this data type, see ControlRef.
On input, a pointer to a QuickDraw rectangle. On output, the rectangle contains the bounds of the control in local coordinates.
A pointer to the rectangle passed in the bounds parameter.
When called in a composited window, this function returns the view’s frame, which is equivalent to calling HIViewGetFrame.
Controls.h
Finds a control in a window by its unique ID.
OSStatus GetControlByID ( WindowRef inWindow, const ControlID *inID, ControlRef *outControl );
The window to query.
The control ID.
A pointer to a value of type ControlRef that, on output, is filled in with the control reference for the control specified by inID. For a description of this data type, see ControlRef.
A result code. See “Control Manager Result Codes.”
As of Mac OS X v10.3, this function is superseded by the HIViewFindByID function, which is preferred over the GetControlByID function. The first parameter to the HIViewFindByID function is a view and not a window, so you can start the search at any point in the hierarchy.
Controls.h
Gets the control’s preferred behavior for responding to particular click.
OSStatus GetControlClickActivation ( ControlRef inControl, Point inWhere, EventModifiers inModifiers, ClickActivationResult *outResult );
The location at which the control was clicked.
Information from the modifiers field of the event structure specifying the state of the modifier keys and the mouse button at the time the event was posted. .
A pointer to a value of type ClickActivationResult containing the result. For possible values, see “Click Activation Constants.”
A result code. See “Control Manager Result Codes.”
Some complex controls, such as Data Browser, require proper sequencing of window activation and click processing. In some cases, the control might want the window to be left inactive yet still handle the click, or vice- versa. This function lets a control client ask the control how it wants to behave for a particular click.
Controls.h
Gets the command ID for a control.
OSStatus GetControlCommandID ( ControlRef inControl, UInt32 *outCommandID );
A pointer to the command ID.
A result code. See “Control Manager Result Codes.”
Controls.h
Obtains control-specific data.
OSErr GetControlData ( ControlRef inControl, ControlPartCode inPart, ResType inTagName, Size inBufferSize, void *inBuffer, Size *outActualSize );
A handle to the control to be examined.
“Control Meta Part Code Constants”The part code of the control part from which data is to be obtained; see , “Control Part Code Constants ,” and “ Control State Part Code Constants.” Passing kControlEntireControl indicates that either the control has no parts or the data is not tied to any specific part of the control. For a description of this data type, see ControlPartCode.
A constant representing the control-specific data you wish to obtain see the data tag constants in the “Control Manager Constants” section.
The size (in bytes) of the data pointed to by the inBuffer parameter. For variable-length control data, pass the value returned in the outMaxSize parameter of GetControlDataSize in the inBufferSize parameter. The number of bytes must match the actual data size.
On input, a pointer to a buffer allocated by your application. On return, the buffer contains a copy of the control-specific data. If you pass NULL on input, it is equivalent to calling GetControlDataSize. The actual size of the control-specific data will be returned in the outActualSize parameter. For variable-length data, the number of bytes must match the actual data size.
On input, a pointer to a Size value. On return, the value is set to the actual size of the data. You can pass NULL if you don’t care about this value.
A result code. See “Control Manager Result Codes.” The result code errDataNotSupported indicates that the inTagName parameter is not valid.
The GetControlData function will only copy the amount of data specified in the inBufferSize parameter, but will tell you the actual size of the buffer so you will know if the data was truncated.
Controls.h
Obtains a handle to control-specific data. (Deprecated. Use custom HIViews instead of custom CDEFs. See HIView Programming Guide.)
Handle GetControlDataHandle ( ControlRef control );
A handle to control-specific data.
The control data handle is for control-specific data used by a control’s implementation. The control data handle is set by calling SetControlDataHandle.
In general, you should not attempt to interpret the contents of this handle if you did not implement the control yourself. For controls that are provided by the operating system, the format of the data handle may change from one release of the operating system to the next.
Controls.h
Obtains the size of a control’s tagged data.
OSErr GetControlDataSize ( ControlRef inControl, ControlPartCode inPart, ResType inTagName, Size *outMaxSize );
A handle to the control to be examined.For a description of this data type, see ControlRef.
The part code of the control part with which the data is associated; see“Control Meta Part Code Constants,” “Control Part Code Constants ,” and “ Control State Part Code Constants.” Passing kControlEntireControl indicates that either the control has no parts or the data is not tied to any specific part of the control.
A constant representing the control-specific data whose size is to be obtained see the data tag constants in the “Control Manager Constants” section.
On input, a pointer to a Size value. On return, the value is set to the size (in bytes) of the control’s tagged data. This value should be passed to SetControlData and GetControlData to allocate a sufficiently large buffer for variable-length data.
A result code. See “Control Manager Result Codes.” The result code errDataNotSupported indicates that the inTagName parameter is not valid.
Pass the value returned in the outMaxSize parameter of GetControlDataSize in the inBufferSize parameter of SetControlData and GetControlData to allocate an adequate buffer for variable-length data.
Controls.h
Obtains the features a control supports.
Not recommended
OSErr GetControlFeatures ( ControlRef inControl, UInt32 *outFeatures );
A handle to the control to be examined. For a description of this data type, see ControlRef.
On input, a pointer to an unsigned 32-bit integer value. On return, the value contains a bit field specifying the features the control supports. For a list of the features a control may support, see ControlDefProcPtr.
A result code. See “Control Manager Result Codes.” The result code errMsgNotSupported indicates that the control does not support Appearance-compliant features.
The GetControlFeatures function obtains the Appearance-compliant features a control definition function supports, in response to a kControlMsgGetFeatures message.
Some feature bits may not be relevant when using Carbon event-based messages.
Controls.h
Gets the highlight status of a control.
UInt16 GetControlHilite ( ControlRef control );
The control to query. For a description of this data type, see ControlRef.
Controls.h
Gets the control ID for a control.
OSStatus GetControlID ( ControlRef inControl, ControlID *outID );
The control to query. For a description of this data type, see ControlRef.
A pointer to a value of type ControlID that, on return, contains the control ID of the control specified by inControl.
A result code. See “Control Manager Result Codes.”
Controls.h
Returns the kind of the given control.
OSStatus GetControlKind ( ControlRef inControl, ControlKind *outControlKind );
The control to query. For a description of this data type, see ControlRef.
On successful exit, this will contain the control signature and kind. See ControlDefinitions.h for the kinds of each system control. For a description of this data type, see ControlKind.
A result code. See “Control Manager Result Codes.”
GetControlKind allows you to query the kind of any control.
Controls.h
Obtains a control’s maximum setting. (Deprecated. Use GetControl32BitMaximum instead.)
Not recommended
SInt16 GetControlMaximum ( ControlRef theControl );
A handle to the control whose maximum value you wish to determine. For a description of this data type, see ControlRef.
The specified control’s maximum setting.
When you create a control, you specify an initial maximum setting either in the control resource or in the max parameter of the function NewControl. You can change the maximum setting by using the function SetControlMaximum.
Controls.h
Obtains a control’s minimum setting. (Deprecated. Use GetControl32BitMinimum instead.)
Not recommended
SInt16 GetControlMinimum ( ControlRef theControl );
A handle to the control whose minimum value you wish to determine.
The specified control’s minimum setting.
When you create a control, you specify an initial minimum setting either in the control resource or in the min parameter of the function NewControl. You can change the minimum setting by using the function SetControlMinimum.
Controls.h
Returns the window to which a control is bound.
WindowRef GetControlOwner ( ControlRef control );
The control to query. For a description of this data type, see ControlRef.
The window reference to which the control is bound, or NULL if the control is not bound to a window.
Controls.h
Gets the menu handle for a pop-up control.
MenuRef GetControlPopupMenuHandle ( ControlRef control );
The pop-up control to query.
See the Menu Manager documentation for a description of the MenuRef data type.
Controls.h
Gets the menu ID of a pop-up menu.
short GetControlPopupMenuID ( ControlRef control );
The pop-up control to query.
The menu ID.
Controls.h
Obtains a piece of data that has been previously associated with a control.
OSStatus GetControlProperty ( ControlRef control, OSType propertyCreator, OSType propertyTag, ByteCount bufferSize, ByteCount *actualSize, void *propertyBuffer );
A handle to the control whose associated data you wish to obtain.
Your program’s signature, as registered through Apple Developer Technical Support. If your program is of a type that would not normally have a signature (for example, a plug-in), you should still register and use a signature in this case, even though your program’s file may not have the same creator code as the signature that you register. The ‘macs' property signature is reserved for the system and should not be used.
The application-defined code identifying the data.
A value specifying the size of the data to be obtained. If the size of the data is unknown, use the function GetControlPropertySize to get the data’s size. If the size specified in the bufferSize parameter does not match the actual size of the property, GetControlProperty only retrieves data up to the size specified or up to the actual size of the property, whichever is smaller, and an error is returned.
On input, a pointer to an unsigned 32-bit integer. On return, this value is set to the actual size of the associated data. You may pass NULL for the actualSize parameter if you are not interested in this information.
On input, a pointer to a buffer. On return, this buffer contains a copy of the data that is associated with the specified control.
A result code. See “Control Manager Result Codes.”
You may use the function GetControlProperty to obtain a copy of data previously set by your application with the function SetControlProperty.
Controls.h
Gets the property attributes for a control.
OSStatus GetControlPropertyAttributes ( ControlRef control, OSType propertyCreator, OSType propertyTag, OptionBits *attributes );
The control to query. For a description of this data type, see ControlRef.
The OSType signature, usually the signature of your application, for the property creator of the attributes that are to be obtained.
The OSType signature for the property tag for the attributes that are to be obtained.
A pointer to a value of type UInt32 that, on return, contains the attributes of the control specified by control.
A result code. See “Control Manager Result Codes.”
Controls.h
Obtains the size of a piece of data that has previously been associated with a control.
OSStatus GetControlPropertySize ( ControlRef control, OSType propertyCreator, OSType propertyTag, ByteCount *size );
A handle to the control whose associated data you wish to examine. For a description of this data type, see ControlRef.
Your program’s signature, as registered through Apple Developer Technical Support. If your program is of a type that would not normally have a signature (for example, a plug-in), you should still register and use a signature in this case, even though your program’s file may not have the same creator code as the signature that you register. The ‘macs' property signature is reserved for the system and should not be used.
The application-defined code identifying the data.
On input, a pointer to an unsigned 32-bit integer. On return, this value is set to the actual size of the data.
A result code. See “Control Manager Result Codes.”
If you want to retrieve a piece of associated data with the function GetControlProperty, you will typically need to use the GetControlPropertySize function beforehand to determine the size of the associated data.
Controls.h
Obtains a control’s current reference value.
SRefCon GetControlReference ( ControlRef theControl );
A handle to the control whose current reference value you wish to determine.
The current reference value for the specified control.
When you create a control, you specify an initial reference value, either in the control resource or in the refCon parameter of the function NewControl. The reference value is stored in the contrlRfCon field of the control structure. You can use this field for any purpose, and you can use the function SetControlReference to change this value.
Controls.h
Obtains the region corresponding to a given control part.
OSStatus GetControlRegion ( ControlRef inControl, ControlPartCode inPart, RgnHandle outRegion );
A handle to the control whose part region you want to obtain.
A constant identifying the control part for which a region is to be obtained. You may specify the kControlStructureMetaPart and kControlContentMetaPart control part codes, as well as the standard control part codes. See “Control Meta Part Code Constants,” “Control Part Code Constants ,” and “ Control State Part Code Constants” for descriptions of possible values.
On input, a value of type RgnHandle. On return, GetControlRegion sets the region to contain the actual dimensions and position of the control part, in local coordinates.
A result code. See “Control Manager Result Codes.”
Controls.h
Obtains a control’s current setting. (Deprecated. Use GetControl32BitValue instead.)
Not recommended
SInt16 GetControlValue ( ControlRef theControl );
On input, a handle to a control.
The current setting of the control.
When you create a control, you specify an initial setting either in the control resource or in the value parameter of the function NewControl. You can change the setting by calling SetControlValue.
Controls.h
Returns the variation code specified in the control definition function for a particular control. (Deprecated. Use custom HIViews instead of custom CDEFs. See HIView Programming Guide.)
Not recommended
ControlVariant GetControlVariant ( ControlRef theControl );
A handle to the control whose variation code you wish to determine.
The variation code for the specified control see the control definition IDs in the “Control Manager Constants” section for descriptions of control variation codes. For a description of this data type, see ControlVariant.
A control definition function can use a variation code to describe variations of the same basic control. For example, all pop-up arrows share the same basic control definition function, which is stored in a resource of type 'CDEF' and has a resource ID of 12. The standard pop-up arrow is large and points to the right; it has a control definition ID of 192. A variation of this is a large, left-pointing arrow, which has a control definition ID of 193. Still another variation, in which the arrow points up, has a control definition ID of 194.
Use only if you are using message-based custom controls (CDEFs).
Controls.h
Obtains the size of the content to which a control’s size is proportioned.
SInt32 GetControlViewSize ( ControlRef theControl );
A value of type ControlHandle. Pass a handle to the control whose view size you wish to obtain.
A value equal to the current size of the content being displayed, expressed in terms of the same units of measurement as are used for the minimum, maximum, and current settings of the control.
Your application should call the GetControlViewSize function to obtain the current view size of a control. This value is used by the scrollbar control to support proportional scroll boxes.
Controls.h
Gets information about the content of an image well.
OSErr GetImageWellContentInfo ( ControlRef inButton, ControlButtonContentInfoPtr outContent );
The control reference to query.
On return, the value type ControlButtonContentInfoPtr for the control specified by inButton.
A result code. See “Control Manager Result Codes.”
HIImageViews.h
Obtains a handle to a specified embedded control.
OSErr GetIndexedSubControl ( ControlRef inControl, UInt16 inIndex, ControlRef *outSubControl );
The control from which an embedded control handle is to be obtained. For a description of this data type, see ControlRef.
A one-based index—an integer between 1 and the value returned in the outNumChildren parameter of CountSubControls—specifying the control you wish to access.
On input, a pointer to a ControlHandle value. On return, the ControlHandle value is set to a handle to the embedded control.
A result code. See “Control Manager Result Codes.” If the index passed in is invalid, the paramErr result code is returned.
The GetIndexedSubControl function is useful for iterating over the control hierarchy. Also, the value of a radio group control is the index of its currently selected embedded radio button control. So, passing the current value of a radio group control into GetIndexedSubControl will give you a handle to the currently selected radio button control.
Controls.h
Obtains a handle to the control with the current keyboard focus for a specified window.
OSErr GetKeyboardFocus ( WindowRef inWindow, ControlRef *outControl );
A pointer to the window for which to obtain keyboard focus.
On input, a pointer to a ControlHandle value. On return, the ControlHandle value is set to a handle to the control that currently has keyboard focus. Produces NULL if no control has focus.
A result code. See “Control Manager Result Codes.”
The GetKeyboardFocus function returns the handle of the control with current keyboard focus within a specified window.
Controls.h
Creates a control from a control resource.
ControlRef GetNewControl ( SInt16 resourceID, WindowRef owningWindow );
The resource ID of the control you wish to create.
A pointer to the window in which to place the control.
A handle to the control created from the specified control resource. If GetNewControl can’t read the control resource from the resource file, it returns NULL. For a description of this data type, see ControlRef.
The GetNewControl function creates a control structure from the information in the specified control resource, adds the control structure to the control list for the specified window, and returns as its function result a handle to the control. You use this handle when referring to the control in most other Control Manager functions. After making a copy of the control resource, GetNewControl releases the memory occupied by the original control resource before returning.
The control resource specifies the rectangle for the control, its initial setting, its visibility state, its maximum and minimum settings, its control definition ID, a reference value, and its title (if any). After you use GetNewControl to create the control, you can change the control characteristics with other Control Manager functions.
If the control resource specifies that the control should be visible, the Control Manager draws the control. If the control resource specifies that the control should initially be invisible, you can use the function ShowControl to make the control visible.
When an embedding hierarchy is established within a window, GetNewControl automatically embeds the newly created control in the root control of the owning window.
Controls.h
Obtains a handle to a window’s root control.
OSErr GetRootControl ( WindowRef inWindow, ControlRef *outControl );
A pointer to the window to be examined.
Pass a pointer to a ControlHandle value. On return, the ControlHandle value is set to a handle to the root control.
A result code. See “Control Manager Result Codes.”
You can call GetRootControl to determine whether or not a root control (and therefore an embedding hierarchy) exists within a specified window. Once you have the root control’s handle, you can pass it to functions such as DisposeControl, ActivateControl,and DeactivateControl to apply specified actions to the entire embedding hierarchy.
Note that the minimum, maximum, and initial settings for a root control are reserved and should not be changed.
Controls.h
Obtains a handle to an embedder control.
OSErr GetSuperControl ( ControlRef inControl, ControlRef *outParent );
A handle to an embedded control. For a description of this data type, see ControlRef.
A pointer to a ControlHandle value. On return, the ControlHandle value is set to a handle to the embedder control. For a description of this data type, see ControlRef.
A result code. See “Control Manager Result Codes.”
The GetSuperControl function gets a handle to the parent control of the control passed in.
Controls.h
Gets the content rectangle for a tab.
OSErr GetTabContentRect ( ControlRef inTabControl, Rect *outContentRect );
The tab control reference to query.
On return, the value of this parameter is a pointer to the content rectangle for the tab specified by inTabControl.
A result code. See “Control Manager Result Codes.”
HITabbedView.h
Responds to cursor movements in a control while the mouse button is down and returns the location of the next mouse-up event.
ControlPartCode HandleControlClick ( ControlRef inControl, Point inWhere, EventModifiers inModifiers, ControlActionUPP inAction );
A handle to the control in which the mouse-down event occurred. Pass the control handle returned by FindControl or FindControlUnderMouse.
A point, specified in local coordinates, where the mouse-down event occurred. Supply the same point you passed to FindControl or FindControlUnderMouse.
Information from the modifiers field of the event structure specifying the state of the modifier keys and the mouse button at the time the event was posted.
A universal procedure pointer to an action function defining what action your application takes while the user holds down the mouse button. See ControlActionProcPtr for a description of such an action function. The value of the inAction parameter can be a valid procPtr, NULL, or -1. A value of -1 indicates that the control should either perform auto tracking, or if it is incapable of doing so, do nothing (like NULL). For custom controls, what you pass in this parameter depends on how you define the control. If the part index is greater than 128, the pointer must be of type DragGrayRegionUPP unless the control supports live feedback, in which case it should be a ControlActionUPP.
Returns a value of type ControlPartCode identifying the control’s part see “Control Meta Part Code Constants,” “Control Part Code Constants ,” and“ Control State Part Code Constants.” For a description of this data type, see ControlPartCode.
Call the HandleControlClick function after a call to FindControl or FindControlUnderMouse. The HandleControlClick function should be called instead of TrackControl to follow the user’s cursor movements in a control and provide visual feedback until the user releases the mouse button. Unlike TrackControl, HandleControlClick allows modifier keys to be passed in so that the control may use these if the control (such as a list box or editable text field) is set up to handle its own tracking.
The visual feedback given by HandleControlClick depends on the control part in which the mouse-down event occurs. When highlighting is appropriate, for example, HandleControlClick highlights the control part (and removes the highlighting when the user releases the mouse button). When the user holds down the mouse button while the cursor is in an indicator (such as the scroll box of a scroll bar) and moves the mouse, HandleControlClick responds by dragging a dotted outline or a ghost image of the indicator. If the user releases the mouse button when the cursor is in an indicator such as the scroll box, HandleControlClick calls the control definition function to reposition the indicator.
While the user holds down the mouse button with the cursor in one of the standard controls, HandleControlClick performs the following actions, depending on the value you pass in the parameter inAction.
If you pass NULL in the inAction parameter, HandleControlClick uses no action function and therefore performs no additional actions beyond highlighting the control or dragging the indicator. This is appropriate for push buttons, checkboxes, radio buttons, and the scroll box of a scroll bar.
If you pass a pointer to an action function in the inAction parameter, it must define some action that your application repeats as long as the user holds down the mouse button. This is appropriate for the scroll arrows and gray areas of a scroll bar.
If you pass (ControlActionUPP)-1L in the inAction parameter, HandleControlClick calls the control action function associated with the control. This is appropriate when you are tracking the cursor in a pop-up menu. You can call GetControlAction to get a pointer to the control action function that is associated with the control, and you can call SetControlAction to set the control action function that is associated with the control.
For 'CDEF' resources that implement custom dragging, you usually call HandleControlClick, which returns 0 regardless of the user’s changes of the control setting. To avoid this, you should use another method to determine whether the user has changed the control setting, for instance, comparing the control’s value before and after your call to HandleControlClick.
Controls.h
Allows a control to display a contextual menu.
OSStatus HandleControlContextualMenuClick ( ControlRef inControl, Point inWhere, Boolean *menuDisplayed );
The location that was clicked.
Pointer to a Boolean whose value is true if the control displayed a contextual menu; otherwise, false.
A result code. See “Control Manager Result Codes.”
Controls.h
Tells a control to accept the data from a drag.
OSStatus HandleControlDragReceive ( ControlRef inControl, DragReference inDrag );
The drag reference that was dropped on the control.
A result code. See “Control Manager Result Codes.”
Call this function when the user drops a drag on a control in your window to give the control an opportunity to take any interesting data from the drag. Before calling this function, you must call SetControlDragTrackingEnabled to enable drag and drop support for the control.Note that this function should not be called in a composited window. Instead, the SetAutomaticControlDragTrackingEnabledForWindow API should be used to enable automatic control drag tracking.
Controls.h
Tells a control to respond visually to a drag.
OSStatus HandleControlDragTracking ( ControlRef inControl, DragTrackingMessage inMessage, DragReference inDrag, Boolean *outLikesDrag );
A drag message indicating the state of the drag above the control. The meaning of the value you pass in must be relative to the control, not the whole window. For when the drag first enters the control, you should pass kDragTrackingEnterControl. While the drag stays within the control, pass kDragTrackingInControl. When the drag leaves the control, pass kDragTrackingLeaveControl.
The drag reference that is over the control.
On output, a pointer to a Boolean whose value is true if the control can accept the data in the drag reference or false if the control cannot accept the data. If the value is false,there is no need to call HandleControlDragReceive when the user drops the dragged object onto the control because the control cannot accept the data.
A result code. See “Control Manager Result Codes.”
Call this function when a drag is above a control in your window and you want to give that control a chance to draw appropriately in response to the drag. Before calling this function, you must call SetControlDragTrackingEnabled to enable drag and drop support for the control.Note that this function should not be called in a composited window. Instead, the SetAutomaticControlDragTrackingEnabledForWindow API should be used to enable automatic control drag tracking.
Controls.h
Requests that a control set the cursor based on the mouse location.
OSStatus HandleControlSetCursor ( ControlRef control, Point localPoint, EventModifiers modifiers, Boolean *cursorWasSet );
.
The location of the mouse.
Information from the modifiers field of the event structure specifying the state of the modifier keys and the mouse button at the time the event was posted.
Out output, a pointer to a Boolean whose value is true if the cursor was set; otherwise, false.
A result code. See “Control Manager Result Codes.”
Controls.h
Makes a control, and any latent embedded controls, invisible.
void HideControl ( ControlRef theControl );
A handle to the control to hide.
The HideControl function makes the specified control invisible. This can be useful, for example, before adjusting a control’s size and location. It also adds the control’s rectangle to the window’s update region, so that anything else that was previously obscured by the control will reappear on the screen. If the control is already invisible, HideControl has no effect.
When hiding groups of controls, the state of an embedded control that is hidden or deactivated is preserved so that when the embedder control is shown or activated, the embedded control appears in the same state as the embedder. If the specified control has embedded controls, HideControl makes the embedded controls invisible as well.
An embedded control is considered latent when it is deactivated or hidden due to its embedder control being deactivated or hidden. If you call HideControl on a latent embedded control, it would not be displayed the next time ShowControl was called on its embedder control.
To make the control visible again, call ShowControl.
You can also call SetControlVisibility to hide or show a control without causing it to redraw.
Controls.h
Changes the highlighting of a control.
Not recommended
void HiliteControl ( ControlRef theControl, ControlPartCode hiliteState );
A handle to the control. For a description of this data type, see ControlRef.
A value from 0 to 255 that specifies the highlighting state of the control. The value of 0 signifies an active control with no highlighting. A value from 1 through 253 signifies a part code designating the part of the (active) control to highlight. Values 254 and 255 signify that the control is to be made disabled or inactive, respectively, and drawn accordingly. For a description of part code constants, see “Control Part Code Constants ,” “Control Part Code Constants ,” and “ Control State Part Code Constants.”
If the Appearance Manager is available, you should call the functions ActivateControl and DeactivateControl instead of HiliteControl to activate or deactivate a control. This is important if the control is in an embedding hierarchy, since calling these functions will ensure that any latent embedded controls will be activated and deactivated correctly.
If the Appearance Manager is not available, then when you need to make a control inactive (such as when its window is not frontmost) or in any other way change the highlighting of a control, you can use the HiliteControl function.
The HiliteControl function calls the control definition function to redraw the control with the highlighting specified in the hiliteState parameter. The HiliteControl function uses the value in this parameter to change the value of the contrlHilite field of the control structure.
Except for scroll bars, which you should hide using HideControl, you should use HiliteControl to make all controls inactive when their windows are not frontmost. The function TrackControl automatically uses the HiliteControl function as appropriate; when you use TrackControl, you don’t need to call HiliteControl.
If you are activating or deactivating a control, you should use ActivateControl or DeactivateControl instead. Otherwise okay to use.
Controls.h
Invokes a control action UPP.
void InvokeControlActionUPP ( ControlRef theControl, ControlPartCode partCode, ControlActionUPP userUPP );
The control for which the control action UPP is to be invoked. For a description of this data type, see ControlRef.
The part code for which the control action UPP is to be invoked. For possible values, see “Control Meta Part Code Constants,” “Control Part Code Constants ,” and “ Control State Part Code Constants.”
The UPP that is to be invoked.
Controls.h
Invokes a control-to-collection UPP.
OSStatus InvokeControlCNTLToCollectionUPP ( const Rect *bounds, SInt16 value, Boolean visible, SInt16 max, SInt16 min, SInt16 procID, SRefCon refCon, ConstStr255Param title, Collection collection, ControlCNTLToCollectionUPP userUPP );
The bounds of the control.
The value of the control.
A Boolean whose value is true if the control is visible; otherwise, false.
The maximum value of the control.
The minimum value of the control.
The proc ID.
The refcon.
The title of the control.
The collection.
The UPP that is to be invoked.
A result code. See “Control Manager Result Codes.”
Controls.h
Not recommended
OSStatus InvokeControlColorUPP ( ControlRef inControl, SInt16 inMessage, SInt16 inDrawDepth, Boolean inDrawInColor, ControlColorUPP userUPP );
A result code. See “Control Manager Result Codes.”
Instead of specifying a callback to redraw your background, you should make the background a control and then embed your other controls within it.
Controls.h
Invokes a control edit text validation UPP.
void InvokeControlEditTextValidationUPP ( ControlRef control, ControlEditTextValidationUPP userUPP );
The control. For a description of this data type, see ControlRef.
The UPP that is to be invoked.
HITextViews.h
Invokes a control key filter UPP.
ControlKeyFilterResult InvokeControlKeyFilterUPP ( ControlRef theControl, SInt16 *keyCode, SInt16 *charCode, EventModifiers *modifiers, ControlKeyFilterUPP userUPP );
The control. For a description of this data type, see ControlRef.
The key code.
The character code.
Information from the modifiers field of the event structure specifying the state of the modifier keys and the mouse button at the time the event was posted. .
The UPP that is to be invoked.
For a description of this data type, see ControlKeyFilterResult.
Controls.h
Invokes a control user pane activate UPP.
void InvokeControlUserPaneActivateUPP ( ControlRef control, Boolean activating, ControlUserPaneActivateUPP userUPP );
The control.
A Boolean whose value is true if the user pane is being activated; otherwise, false.
The UPP that is to be invoked.
HIContainerViews.h
Invokes a user pane background UPP.
void InvokeControlUserPaneBackgroundUPP ( ControlRef control, ControlBackgroundPtr info, ControlUserPaneBackgroundUPP userUPP );
The control.
A pointer to information such as the depth and type of the drawing device. For a description of the ControlBackgroundPtr data type, see ControlBackgroundRec.
The UPP that is to be activated.
HIContainerViews.h
Invokes a user pane draw UPP.
void InvokeControlUserPaneDrawUPP ( ControlRef control, ControlPartCode part, ControlUserPaneDrawUPP userUPP );
The control.
The part.
The UPP that is to be activated.
HIContainerViews.h
Invokes a user pane focus UPP.
ControlPartCode InvokeControlUserPaneFocusUPP ( ControlRef control, ControlFocusPart action, ControlUserPaneFocusUPP userUPP );
The control.
The action.
The UPP that is to be activated.
For a description of this data type, see ControlPartCode.
HIContainerViews.h
Invokes a user pane hit test UPP.
ControlPartCode InvokeControlUserPaneHitTestUPP ( ControlRef control, Point where, ControlUserPaneHitTestUPP userUPP );
The control.
The location.
The UPP that is to be activated.
See ControlPartCode for a description of the ControlPartCode data type.
HIContainerViews.h
Invokes a user pane idle UPP.
void InvokeControlUserPaneIdleUPP ( ControlRef control, ControlUserPaneIdleUPP userUPP );
The control.
The UPP that is to be activated.
HIContainerViews.h
Invokes a user pane key down UPP.
ControlPartCode InvokeControlUserPaneKeyDownUPP ( ControlRef control, SInt16 keyCode, SInt16 charCode, SInt16 modifiers, ControlUserPaneKeyDownUPP userUPP );
The control.
The key code.
The character code.
The modifiers.
The UPP that is to be activated.
For a description of this data type, see ControlPartCode.
HIContainerViews.h
Invokes a user pane tracking UPP.
ControlPartCode InvokeControlUserPaneTrackingUPP ( ControlRef control, Point startPt, ControlActionUPP actionProc, ControlUserPaneTrackingUPP userUPP );
The control.
The starting point.
The action proc.
The UPP that is to be activated.
For a description of this data type, see ControlPartCode.
HIContainerViews.h
Invokes a Unicode post update UPP.
Boolean InvokeEditUnicodePostUpdateUPP ( UniCharArrayHandle uniText, UniCharCount uniTextLength, UniCharArrayOffset iStartOffset, UniCharArrayOffset iEndOffset, void *refcon, EditUnicodePostUpdateUPP userUPP );
The UPP that is to be activated.
The length of text in Unitext parameter.
The starting offset.
The ending offset.
The refcon.
The UPP that is to be activated.
HITextViews.h
Indicates whether automatic drag tracking is enabled for the specified window.
OSStatus IsAutomaticControlDragTrackingEnabledForWindow ( WindowRef inWindow, Boolean *outTracks );
On output, a pointer to a Boolean whose value is true if the Control Manager’s automatic drag tracking is enabled for the window; otherwise, false.
A result code. See “Control Manager Result Codes.”
For more information on automatic drag tracking, see SetAutomaticControlDragTrackingEnabledForWindow.
Controls.h
Returns whether a control is active.
Boolean IsControlActive ( ControlRef inControl );
A handle to the control to be examined.
A Boolean whose value is true if the control is active; otherwise, false.
If you wish to determine whether a control is active, you should call IsControlActive instead of testing the contrlHilite field of the control structure.
Controls.h
Indicates whether a control’s drag track and receive support is enabled.
OSStatus IsControlDragTrackingEnabled ( ControlRef inControl, Boolean *outTracks );
.
On output, a pointer to a Boolean whose value is true if automatic drag tracking and receive support is enabled for the control; otherwise, false.
A result code. See “Control Manager Result Codes.”
Call this function to determine whether drag and drop support is enabled for a control. Some controls don’t support drag and drop; these controls don’t track or receive drags even if the outTracks parameter indicates a value of true.
Controls.h
Indicates whether a control is enabled.
Boolean IsControlEnabled ( ControlRef inControl );
The control that is to be queried.
A Boolean whose value is true if the control is enabled; otherwise, false.
Controls.h
Indicates whether or not the control is highlighted.
Boolean IsControlHilited ( ControlRef control );
The control that is to be queried.
A Boolean whose value is true if the control is highlighted; otherwise, false.
Controls.h
Determines whether a control is visible.
Boolean IsControlVisible ( ControlRef inControl );
A handle to the control to be examined.
If true, the control is visible. If false, the control is hidden.
If you want to determine whether a control is visible, call IsControlVisible. Note that this function indicates the actual user visibility; if the control is marked visible, but its owning window or view is hidden, isControlVisible returns false. (In compositing mode, if a window is hidden, its root view is also marked as hidden. Similarly, any subviews of a hidden view are considered hidden.) A control’s latent visibility (its visibility ignoring the visibility of its parents) can be determined by calling the HIView function HIViewIsLatentlyVisible.
Controls.h
Reports whether a given handle is a control handle.
Boolean IsValidControlHandle ( ControlRef theControl );
A value of type ControlHandle. Pass the handle to be examined.
true if the specified handle is a valid control handle; otherwise, false.
The IsValidControlHandle function confirms whether a given handle is a valid control handle, but it does not check the validity of the data contained in the control itself.
Controls.h
Removes all of the controls from a window that you wish to keep.
void KillControls ( WindowRef theWindow );
A pointer to the window whose controls you wish to remove.
The KillControls function disposes of all controls associated with the specified window. To remove just one control, use DisposeControl. If an embedding hierarchy is present, KillControls disposes of the controls embedded within a control before disposing of the container control.
You should use KillControls when you wish to retain the window but dispose of its controls. The Window Manager functions CloseWindow and DisposeWindow automatically remove all controls associated with the window and release the memory the controls occupy.
Controls.h
Moves a control within its window.
void MoveControl ( ControlRef theControl, SInt16 h, SInt16 v );
A handle to the control you wish to move.
The horizontal coordinate (local to the control’s window) of the new location of the upper-left corner of the control’s rectangle.
The vertical coordinate (local to the control’s window) of the new location of the upper-left corner of the control’s rectangle.
The MoveControl function moves the control to the new location specified by the h and v parameters, using them to change the rectangle specified in the contrlRect field of the control structure. When the control is visible, MoveControl first hides it and then redraws it at its new location.
For example, if the user resizes a document window that contains a scroll bar, your application can use MoveControl to move the scroll bar to its new location.
Controls.h
Creates a UPP for a control action callback function.
ControlActionUPP NewControlActionUPP ( ControlActionProcPtr userRoutine );
A pointer to your control action callback function. See ControlActionProcPtr for information about defining this function.
A UPP to your control action callback function.
Controls.h
Creates a UPP for a control-to-collection callback function.
ControlCNTLToCollectionUPP NewControlCNTLToCollectionUPP ( ControlCNTLToCollectionProcPtr userRoutine );
A UPP to your control-to-collection callback function.
Controls.h
Not recommended
ControlColorUPP NewControlColorUPP ( ControlColorProcPtr userRoutine );
Instead of specifying a callback to redraw your background, you should make the background a control and then embed your other controls within it.
Controls.h
Creates a UPP for a control edit text validation callback function.
ControlEditTextValidationUPP NewControlEditTextValidationUPP ( ControlEditTextValidationProcPtr userRoutine );
HITextViews.h
ControlKeyFilterUPP NewControlKeyFilterUPP ( ControlKeyFilterProcPtr userRoutine );
Controls.h
ControlUserPaneActivateUPP NewControlUserPaneActivateUPP ( ControlUserPaneActivateProcPtr userRoutine );
HIContainerViews.h
ControlUserPaneBackgroundUPP NewControlUserPaneBackgroundUPP ( ControlUserPaneBackgroundProcPtr userRoutine );
HIContainerViews.h
ControlUserPaneDrawUPP NewControlUserPaneDrawUPP ( ControlUserPaneDrawProcPtr userRoutine );
HIContainerViews.h
ControlUserPaneFocusUPP NewControlUserPaneFocusUPP ( ControlUserPaneFocusProcPtr userRoutine );
HIContainerViews.h
ControlUserPaneHitTestUPP NewControlUserPaneHitTestUPP ( ControlUserPaneHitTestProcPtr userRoutine );
HIContainerViews.h
ControlUserPaneIdleUPP NewControlUserPaneIdleUPP ( ControlUserPaneIdleProcPtr userRoutine );
HIContainerViews.h
ControlUserPaneKeyDownUPP NewControlUserPaneKeyDownUPP ( ControlUserPaneKeyDownProcPtr userRoutine );
HIContainerViews.h
ControlUserPaneTrackingUPP NewControlUserPaneTrackingUPP ( ControlUserPaneTrackingProcPtr userRoutine );
HIContainerViews.h
EditUnicodePostUpdateUPP NewEditUnicodePostUpdateUPP ( EditUnicodePostUpdateProcPtr userRoutine );
HITextViews.h
Registers an old-style control definition.
OSStatus RegisterControlDefinition ( SInt16 inCDEFResID, const ControlDefSpec *inControlDef, ControlCNTLToCollectionUPP inConversionProc );
The virtual resource ID you want to assign to the control definition.
A pointer to the control definition function you want to register. Pass NULL if you want to unregister a given CDEF proc ID.
A UPP to a callback function to place initialization data (such as the bounds, min and max values, and so on) into a collection.
A result code. See “Control Manager Result Codes.”
Mac OS X does not allow you to store custom control definitions in resources. However, some older functions such as GetNewControl expect a resource ID when creating controls. To work around this, you can use RegisterControlDefinition to register “virtual” resource IDs for your control definition functions.
Since custom control definitions receive initialization data as a collection in the param parameter, you must provide a callback to properly package this information. See “Control Collection Tag Constants” for a list of tags you can apply to the collection. If you do not supply a conversion callback, the Control Manager sends an empty collection to your control definition.
To unregister a control definition, pass NULL in the inDefSpec parameter for a given CDEF proc ID.
In Mac OS X v10.2 and later, you should consider reimplementing your custom control code using custom HIViews. See Introducing HIView for more information.
Controls.h
Removes a piece of data that has been previously associated with a control.
OSStatus RemoveControlProperty ( ControlRef control, OSType propertyCreator, OSType propertyTag );
A handle to the control whose associated data you wish to remove.
Your program’s signature, as registered through Apple Developer Technical Support. If your program is of a type that would not normally have a signature (for example, a plug-in), you should still register and use a signature in this case, even though your program’s file may not have the same creator code as the signature that you register. The ’macs' property signature is reserved for the system and should not be used.
The application-defined code identifying the associated data.
A result code. See “Control Manager Result Codes.”
Your application may dissociate data it has previously set with the SetControlProperty function by calling the RemoveControlProperty function.
Controls.h
Returns keyboard focus to the prior focusable control in a window.
OSErr ReverseKeyboardFocus ( WindowRef inWindow );
A pointer to the window for which to reverse keyboard focus.
A result code. See “Control Manager Result Codes.”
The ReverseKeyboardFocus function reverses the progression of keyboard focus, skipping over deactivated and hidden controls until it finds the previous control to receive keyboard focus in the window.
When ReverseKeyboardFocus is called, the Control Manager calls your control definition function and passes kControlMsgFocus in its message parameter and kControlFocusPrevPart in its param parameter. In response to this message, your control definition function should change keyboard focus to its previous part, the entire control, or remove keyboard focus from the control, depending upon the circumstances. See ControlDefProcPtr for a discussion of possible responses to this message.
Controls.h
Sends a message to a control definition function. (Deprecated. For custom controls, use a custom HIView instead of a control definition function. See HIView Programming Guide.)
Not recommended
SInt32 SendControlMessage ( ControlRef inControl, SInt16 inMessage, void *inParam );
A handle to the control that is to receive a low-level message. For a description of this data type, see ControlRef.
A bit field representing the message(s) you wish to send; see ControlDefProcPtr.
The message-dependent data passed in the param parameter of the control definition function.
Varying data, depending upon the message sent in the inMessage parameter.
Your application does not normally need to call the SendControlMessage function. If you have a special need to call a control definition function directly, call SendControlMessage to access and manipulate the control’s attributes.
Before calling SendControlMessage, you should determine whether the control supports the specific message you wish to send by calling GetControlFeatures and examining the feature bit field returned. If there are no feature bits returned that correspond to the message you wish to send (for messages 0 through 12), you can assume that all system controls support that message.
Don’t send messages to standard system control definitions.
Controls.h
Enables or disables automatic drag tracking for a window.
OSStatus SetAutomaticControlDragTrackingEnabledForWindow ( WindowRef inWindow, Boolean inTracks );
A Boolean whose value is true to enable the Control Manager’s automatic drag tracking support or false to disable automatic drag tracking support.
A result code. See “Control Manager Result Codes.”
By default, your application is responsible for installing drag tracking and receive handlers on a given window. The Control Manager, however, has support for automatically tracking and receiving drags over controls that you can enable by calling this function with the inTracks parameter set to true.
The Control Manager automatic drag tracking detects the control the drag is over and calls HandleControlDragTracking and HandleControlDragReceive appropriately. By default, the Control Manager’s automatic drag tracking is disabled.
Earlier versions of system software enabled automatic drag tracking by default, but as of Mac OS X v10.1.3, Mac OS 9.2, and CarbonLib 1.4, you must call this function to enable automatic drag tracking.
Controls.h
Sets the content information for a bevel button.
OSErr SetBevelButtonContentInfo ( ControlRef inButton, ControlButtonContentInfoPtr inContent );
The control reference for the bevel button whose content information is to be set.
A value of type ControlButtonContentInfoPtr for the content information that is to be set.
A result code. See “Control Manager Result Codes.”
HIButtonViews.h
Sets the alignment for a bevel button.
OSErr SetBevelButtonGraphicAlignment ( ControlRef inButton, ControlButtonGraphicAlignment inAlign, SInt16 inHOffset, SInt16 inVOffset );
The control reference for the bevel button that is to be aligned.
The alignment that is to be set. For possible values, see “Bevel Button Graphic Alignment Constants.”
The horizontal offset, in pixels, that is to be applied to the alignment specified by the inAlign parameter.
The vertical offset, in pixels, that is to be applied to the alignment specified by the inAlign parameter.
A result code. See “Control Manager Result Codes.”
HIButtonViews.h
Sets the value of a bevel button menu.
OSErr SetBevelButtonMenuValue ( ControlRef inButton, MenuItemIndex inValue );
The control reference for the bevel button whose menu value is to be set.
The value that is to be set.
A result code. See “Control Manager Result Codes.”
HIButtonViews.h
Sets the alignment of the text for a bevel button.
OSErr SetBevelButtonTextAlignment ( ControlRef inButton, ControlButtonTextAlignment inAlign, SInt16 inHOffset );
The control reference for the bevel button whose text is to be aligned.
The alignment that is to be set. For possible values, see“Bevel Button Text Alignment Constants .”
The horizontal offset, in pixels, that is to be applied to the alignment specified by the inAlign parameter.
A result code. See “Control Manager Result Codes.”
HIButtonViews.h
Sets the placement for bevel button text.
OSErr SetBevelButtonTextPlacement ( ControlRef inButton, ControlButtonTextPlacement inWhere );
The control reference for the bevel button whose text is to be placed.
The placement that is to be set. For possible values, see “Bevel Button Text Placement Constants .”
A result code. See “Control Manager Result Codes.”
HIButtonViews.h
Sets the transform for a bevel button.
OSErr SetBevelButtonTransform ( ControlRef inButton, IconTransformType transform );
The control reference for the bevel button whose text is to be placed.
The transform that is to be set. For possible values, see the IconTransformType enumeration described in the Icon Services and Utilities Reference.
A result code. See “Control Manager Result Codes.”
HIButtonViews.h
Changes the maximum setting of a control and, if appropriate, redraws it accordingly.
void SetControl32BitMaximum ( ControlRef theControl, SInt32 newMaximum );
A handle to the control whose maximum setting you wish to change. For a description of this data type, see ControlRef.
The new maximum setting of the control. In general, to avoid unpredictable behavior, do not set the maximum control value lower than the current minimum value.
Your application may use the SetControl32BitMaximum function to set a 32-bit value as the maximum setting for a control.
If your application uses a 32-bit control maximum value, it should not attempt to obtain this value by calling the pre–Mac OS 8.5 function GetControlMaximum because the 16-bit value that is returned does not accurately reflect the current 32-bit control value. Instead, use the function GetControl32BitMaximum.
Controls.h
Changes the minimum setting of a control and, if appropriate, redraws it accordingly.
void SetControl32BitMinimum ( ControlRef theControl, SInt32 newMinimum );
A handle to the control whose minimum setting you wish to change. For a description of this data type, see ControlRef.
A value specifying the new minimum setting of the control. In general, to avoid unpredictable behavior, do not set the minimum control value higher than the current maximum value.
Your application may use the SetControl32BitMinimum function to set a 32-bit value as the minimum setting for a control.
If your application uses a 32-bit control minimum value, it should not attempt to obtain this value by calling the pre–Mac OS 8.5 function GetControlMinimum because the 16-bit value that is returned does not accurately reflect the current 32-bit control value. Instead, use the function GetControl32BitMinimum.
Controls.h
Changes the current setting of a control and redraws it accordingly.
void SetControl32BitValue ( ControlRef theControl, SInt32 newValue );
A handle to the control whose current setting you wish to change. For a description of this data type, see ControlRef.
A value specifying the new setting of the control. If the specified value is less than the minimum setting for the control, SetControl32BitValue sets the current setting of the control to its minimum setting. If the specified value is greater than the maximum setting, SetControl32BitValue sets the control to its maximum.
Your application may use the SetControl32BitValue function to set a 32-bit value as the current setting for a control.
If your application uses a 32-bit control value, it should not attempt to obtain this value by calling the pre–Mac OS 8.5 function GetControlValue because the 16-bit value that is returned does not accurately reflect the current 32-bit control value. Instead, use the function GetControl32BitValue.
Controls.h
Sets the action function for a control.
void SetControlAction ( ControlRef theControl, ControlActionUPP actionProc );
A handle to the control whose action function is to be changed.
A universal procedure pointer to an action function defining what action your application takes while the user holds down the mouse button. See ControlActionProcPtr for a description of an action function.
The SetControlAction function associates the action function specified by actionProc with the control specified by theControl. If the cursor is in the specified control, the HandleControlClick and TrackControl functions call the specified action function when the user holds down the mouse button. You must provide the action function, and it must define some action to perform repeatedly as long as the user holds down the mouse button. HandleControlUnderClick and TrackControl always highlight and drag the control as appropriate.
SetControlAction should be used to set the application-defined action function for providing live feedback for standard system scroll bar controls.
Note that the action function associated with a control is used by TrackControl only if you set the action function to TrackControl to Pointer(–1). Also, an action function can be specified in the actionProc parameter to TrackControl, so you don’t have to call SetControlAction to change it.
Controls.h
Sets the bounds of a control.
void SetControlBounds ( ControlRef control, const Rect *bounds );
Controls.h
Associates a ControlColorUPP with a given Control, thereby allowing you to bypass the embedding hierarchy-based color setup of SetUpControlBackground/SetUpControlTextColor and replace it with your own.
Not recommended
OSStatus SetControlColorProc ( ControlRef inControl, ControlColorUPP inProc );
The ControlRef with whom the color proc should be associated. For a description of this data type, see ControlRef.
The color proc to associate with the ControlRef. If you pass NULL, the ControlRef will be dissociated from any previously installed color proc. For a description of the ControlColorUPP data type,
A result code. See “Control Manager Result Codes.” An OSStatus code indicating success or failure. The most likely error is a controlHandleInvalidErr resulting from a bad ControlRef.
Before an embedded Control can erase, it calls SetUpControlBackground to have its background color set up by any parent controls. Similarly, any Control that draws text calls SetUpControlTextColor to have the appropriate text color set up. This allows certain controls (such as tabs and placards) to offer special backgrounds and text colors for any child controls. By default, the set up functions only move up the Control Manager embedding hierarchy looking for a parent which has a special background.
This is fine in a plain vanilla embedding case, but many application frameworks find it troublesome; if there are interesting views between two controls in the embedding hierarchy, the framework needs to be in charge of the background and text colors, otherwise drawing defects will occur.
You can only associate a single color proc with a given ControlRef.
Instead of specifying a callback to redraw your background, you should make the background a control and then embed your other controls within it.
Controls.h
Sets the command ID for a control.
OSStatus SetControlCommandID ( ControlRef inControl, UInt32 inCommandID );
The control to set.
The command ID that is to be set.
A result code. See “Control Manager Result Codes.”
Controls.h
Sets control-specific data.
OSErr SetControlData ( ControlRef inControl, ControlPartCode inPart, ResType inTagName, Size inSize, const void *inData );
A handle to the control for which data is to be set.
The part code of the control part for which data is to be set; see “Control Meta Part Code Constants,” “Control Part Code Constants ,” and “ Control State Part Code Constants.” Passing kControlEntireControl indicates that either the control has no parts or the data is not tied to any specific part of the control.
A constant representing the control-specific data you wish to set see the data tag constants in the “Control Manager Constants” section.
The size (in bytes) of the data pointed to by the inData parameter. For variable-length control data, pass the value returned in the outMaxSize parameter of GetControlDataSize in the inSize parameter. The number of bytes must match the actual data size.
A pointer to a buffer allocated by your application. This buffer contains the data that you are sending to the control. After calling SetControlData, your application is responsible for disposing of this buffer, if necessary, as information is copied by control.
A result code. See “Control Manager Result Codes.” The result code errDataNotSupported indicates that the inTagName parameter is not valid.
The SetControlData function sets control-specific data represented by the value in the inTagName parameter to the data pointed to by the inData parameter. SetControlData could be used, for example, to switch a progress indicator from a determinate to indeterminate state. For a list of the control attributes that can be set, see the data tag constants in the “Control Manager Constants” section.
Controls.h
(Deprecated. Use custom HIViews instead of custom CDEFs. See HIView Programming Guide.)
Not recommended
void SetControlDataHandle ( ControlRef control, Handle dataHandle );
Only useful for message-based custom controls (CDEFs).
Controls.h
Sets the drag tracking state for a control.
OSStatus SetControlDragTrackingEnabled ( ControlRef inControl, Boolean inTracks );
The control for which the drag tracking state is to be set.
A Boolean whose value is true if you want the control to track and receive drags or false if want to disable support for drag and drop.
A result code. See “Control Manager Result Codes.”
Call this function to enable a control’s support for drag and drop. If you don’t enable drag and drop support, the control won’t track drags.
Some controls don’t support drag and drop; these controls won’t track or receive drags even if you call this function with the inTracks parameter set to true.
Controls.h
Sets the font style for a control.
OSErr SetControlFontStyle ( ControlRef inControl, const ControlFontStyleRec *inStyle );
A handle to the control whose font style is to be set. For a description of this data type, see ControlRef.
A pointer to a ControlFontStyleRec structure. If the flags field is cleared, the control uses the system font unless the control variant kControlUsesOwningWindowsFontVariant has been specified (control uses window font).
A result code. See “Control Manager Result Codes.”
The SetControlFontStyle function sets the font style for a given control. To specify the font for controls in a dialog box, it is generally easier to use the dialog font table resource. SetControlFontStyle allows you to override a control’s default font (system or window font, depending upon whether the control variant kControlUsesOwningWindowsFontVariant has been specified). Once you have set a control’s font with this function, you can cause the control to revert to its default font by passing a control font style structure with a cleared flags field in the inStyle parameter.
Controls.h
Sets a control’s ID.
OSStatus SetControlID ( ControlRef inControl, const ControlID *inID );
A result code. See “Control Manager Result Codes.”
Controls.h
Changes the maximum setting of a control and redraws its indicator or scroll box accordingly. (Deprecated. Use SetControl32BitMaximum instead.)
Not recommended
void SetControlMaximum ( ControlRef theControl, SInt16 newMaximum );
A handle to the control whose maximum setting you wish to change.
The new maximum setting.
The SetControlMaximum function changes the maximum value of a control to the value specified by the newMaximum parameter and redraws its indicator or scroll box to reflect its new range.
When you set the maximum setting of a scroll bar equal to its minimum setting, the control definition function makes the scroll bar inactive. When you make the maximum setting exceed the minimum, the control definition function makes the scroll bar active again.
When you create a control, you specify an initial maximum setting either in the control resource or in the max parameter of the function NewControl. To determine a control’s current maximum setting, use the function GetControlMaximum.
Controls.h
Changes the minimum setting of a control and redraws its indicator or scroll box accordingly. (Deprecated. Use SetControl32BitMinimum instead.)
Not recommended
void SetControlMinimum ( ControlRef theControl, SInt16 newMinimum );
A handle to the control whose minimum setting you wish to change. For a description of this data type, see ControlRef.
The new minimum setting.
The SetControlMinimum function changes the control’s minimum value to the value specified by the newMinimum parameter and redraws its indicator or scroll box to reflect its new range.
When you create a control, you specify an initial minimum setting either in the control resource or in the min parameter of the NewControl function. To obtain a control’s current minimum setting, use the function GetControlMinimum.
Controls.h
Sets the menu handle for a pop-up control.
void SetControlPopupMenuHandle ( ControlRef control, MenuRef popupMenu );
The pop-up control.
The menu handle to set.
Controls.h
Sets the menu ID for a pop-up control
void SetControlPopupMenuID ( ControlRef control, short menuID );
The pop-up control.
The menu ID to set.
Controls.h
Associates data with a control.
OSStatus SetControlProperty ( ControlRef control, OSType propertyCreator, OSType propertyTag, ByteCount propertySize, const void *propertyData );
A handle to the control with which you wish to associate data. For a description of this data type, see ControlRef.