IButton

The IButton class is the base class for the button control classes. This class contains the common functions for all button controls. You can construct button objects by using classes derived from IButton.


IButton - Member Functions and Data by Group

Constructors & Destructor

You can construct and destruct objects of the IButton class from derived classes. You cannot copy or assign IButton objects because both the copy constructor and assignment operator are private functions.


[view class]
~IButton
public:
virtual ~IButton()

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
IButton
protected:
IButton()

Derived classes use this protected constructor to create objects of this class.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Colors

Use these members to query or set the color used for various areas of a window.


[view class]
backgroundColor
public:
virtual IColor backgroundColor() const

Returns the background color value of the window area. If you have not set the color for the area, the default color is returned.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
disabledForegroundColor
public:
virtual IColor disabledForegroundColor() const

Returns the disabled foreground color value of the window area. If you have not set the color for the area, the default color is returned.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes

AIX Considerations

Returns the default disabled foreground color value of the window area.

Windows Considerations

Returns the default disabled foreground color value of the window area.


[view class]
foregroundColor
public:
virtual IColor foregroundColor() const

Returns the foreground color value of the window area or the default if no color for the area has been set.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
hiliteBackgroundColor
public:
virtual IColor hiliteBackgroundColor() const

Returns the highlight background color value of the window area or the default if no color for the area has been set.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes

AIX Considerations

Returns the default highlight background color value of the window area.

Windows Considerations

Returns the default highlight background color value of the window area.


[view class]
hiliteForegroundColor
public:
virtual IColor hiliteForegroundColor() const

Returns the highlight foreground color value of the window area or the default if no color for the area has been set.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes

AIX Considerations

Returns the default highlight foreground color value of the window area.

Windows Considerations

Returns the default highlight foreground color value of the window area.


Highlighting

Use these members to query and modify the highlight state of the button. A button in the highlighted state has the same appearance as if the mouse selection button (mouse button 1) was pressed while the mouse pointer was over the button control.


[view class]
highlight
public:
virtual IButton& highlight(bool highlight = true)

Sets the button's highlight state.

Supported Platforms

Windows OS/2 AIX
Yes Yes Ignored

AIX Considerations

Setting a button's highlight state is not supported in the AIX environment. This function has no effect in that environment.


[view class]
isHighlighted
public:
bool isHighlighted() const

If the button's highlight state is set, true is returned. Otherwise, false is returned.

Supported Platforms

Windows OS/2 AIX
Yes Yes Ignored

AIX Considerations

Setting a button's highlight state is not supported in the AIX environment. This function always returns false.


[view class]
unhighlight
public:
virtual IButton& unhighlight()

Turns off the button's highlight state.

Supported Platforms

Windows OS/2 AIX
Yes Yes Ignored

AIX Considerations

Setting a button's highlight state is not supported in the AIX environment. This function has no effect in that environment.


Mouse Focus

Mouse focus describes a button's capability to receive the input focus when the mouse is clicked with the pointer over the button. Use these members to query and modify this capability of a button object.


[view class]
allowsMouseClickFocus
public:
bool allowsMouseClickFocus() const

If the button can receive the focus when clicked with the mouse, true is returned. Otherwise, false is returned.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
disableMouseClickFocus
public:
virtual IButton& disableMouseClickFocus()

Prevents the button from receiving the focus when the user selects it using the mouse.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
enableMouseClickFocus
public:
virtual IButton& enableMouseClickFocus(bool enable = true)

Enables or disables the button to receive the focus when the user selects it using the mouse.

enable
Flag indicating whether the mouse can have focus.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Notification Members

Use these members to identify and enable notifications sent to observer objects.


[view class]
enableNotification
public:
virtual IButton& enableNotification(bool enable = true)

Enables or disables the button to send notifications to any observer objects.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
buttonClickId
public:
static INotificationId const buttonClickId

Notification identifier provided to observers when the button control is clicked by the user.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Selection

These members change the selection state of the button. The selection state of a button is typically changed by the user clicking on it using the mouse or pressing a key to select it. You can also change or query the state using other Open Class Library functions.


[view class]
click
public:
virtual IButton& click()

Simulates the user clicking on the button control using the mouse selection button. The click function calls ISelectHandler. You might use this function instead of ISettingButton::select, which does not call ISelectHandler.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Styles

These style members provide a set of valid styles for use in classes derived from IButton. Use these members to query and set button styles. You can use these styles with the styles in the IWindow Styles class.


[view class]
noPointerFocus
public:
static const Style noPointerFocus

Enables the cursor to stay on a control for which information is required, rather than moving to the button clicked on by the user. A typical usage is for a help push button that shows contextual help.
Note: This has no effect on keyboard interaction except on AIX, where the button cannot be accessed with the keyboard.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Text

Use these functions to set the button text. Button text is the label string placed on or beside the button.


[view class]
setText

Sets the text for the button. If appropriate, this function notifies a parent canvas to update the layout for its children.

text
Reference to the text object or text for the button. The function is overloaded so the text can be set from a char* or from a string table ID.


Overload 1
public:
virtual IButton& setText(const IResourceId& text)

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 2
public:
virtual IButton& setText(const char* text)

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


IButton - Inherited Member Functions and Data

Inherited Public Functions

IControl
INotifier
ITextControl
IWindow

Inherited Public Data

IWindow
INotifier
ITextControl

Inherited Protected Functions

IWindow
INotifier
IControl
ITextControl

Inherited Protected Data