IBaseSpinButton

IBaseSpinButton is an abstract base class for spin button controls. Use the IBaseSpinButton-derived classes, INumericSpinButton, and ITextSpinButton, to create and manage numeric and text spin-button controls.

AIX Considerations

Spin buttons created during object construction of IBaseSpinButton-derived classes can use the following Motif widgets:

The Open Class Library provides the behavior of an IBaseSpinButton object via private callbacks and a default handler. The IBaseSpinButton-derived classes use a default handler derived from the class IKeyboardHandler. Therefore, attach user-defined handlers derived from IKeyboardHandler to the INumericSpinButton or ITextSpinButton object rather than to its owner window. Doing so enables events to be dispatched to user-defined handlers before the default handler.


IBaseSpinButton - Member Functions and Data by Group

Constructors & Destructor

The only way to create objects of this class is from a derived class. To enforce this, the only constructor provided for this class is protected. This default constructor can be used by derived classes to create objects of this class. You can destruct objects of this class.


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

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
IBaseSpinButton
protected:
IBaseSpinButton()

Derived classes use this protected constructor to construct objects of this class. This is the default constructor and accepts no parameters.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Attributes

Use these members to query and change characteristics of the spin button control.


[view class]
alignment
public:
Alignment alignment() const

Returns the current alignment in the spin field of this spin button object. The returned value is an enumerator provided by Alignment.

Supported Platforms

Windows OS/2 AIX
Yes Yes Ignored

AIX Considerations

This function always returns left.


[view class]
hasFocus
public:
virtual bool hasFocus() const

Returns true if the spin button has the input focus.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


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

If the spin button is a master, true is returned. Otherwise, false is returned.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


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

Returns true if the control was created with the pmCompatible style.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


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

If the spin button is a servant, true is returned. Otherwise, false is returned.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
setAlignment
public:
virtual IBaseSpinButton& setAlignment( Alignment alignment = left )

Changes the text or number alignment in the spin field.

alignment
Use the enumeration Alignment to specify the alignment of the text or number. The default is left.

Supported Platforms

Windows OS/2 AIX
Ignored Yes Ignored

Windows Considerations

The alignment cannot be changed after the control is created. Use the styles leftAlign, centerAlign or rightAlign on the constructor to specify alignment.


Borders

Use these members to query and change the border style of the spin button object. The border style determines if the spin button control is drawn with a border around the spin field.


[view class]
addBorder
public:
virtual IBaseSpinButton& addBorder(bool add = true)

Adds a border to the spin button.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


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

If the spin button has a border, true is returned. Otherwise, false is returned.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
removeBorder
public:
virtual IBaseSpinButton& removeBorder()

Removes the border from the spin button.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Colors

Use these members to query, set, and reset colors for IBaseSpinButton and derived classes.


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

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

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes

Portability Considerations

This member is overridden in this derived class for specific operating system behavior.


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

Returns the foreground color value of the spin button area. If you have not set a color for the area, the default is returned.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes

Portability Considerations

This member is overridden in this derived class for specific operating system behavior.


[view class]
resetBackgroundColor
public:
virtual IBaseSpinButton& resetBackgroundColor()

Resets the background color by undoing a previous set.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes

Portability Considerations

This member is overridden in this derived class for specific operating system behavior.


[view class]
resetForegroundColor
public:
virtual IBaseSpinButton& resetForegroundColor()

Resets the foreground color by undoing a previous set.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes

Portability Considerations

This member is overridden in this derived class for specific operating system behavior.


[view class]
setBackgroundColor
public:
virtual IBaseSpinButton& setBackgroundColor( const IColor& color )

Sets the background color to the indicated color.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes

Portability Considerations

This member is overridden in this derived class for specific operating system behavior.


[view class]
setForegroundColor
public:
virtual IBaseSpinButton& setForegroundColor( const IColor& color )

Sets the foreground color to the indicated color.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes

Portability Considerations

This member is overridden in this derived class for specific operating system behavior.


[view class]
setColor
protected:
virtual IBaseSpinButton& setColor( unsigned long colorArea, const IColor& color )

Sets the colorArea to the indicated color.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Fast Spin

Use these members to query and change the fastSpin style of the spin button object. The fastSpin style specifies the spin speed of the spin button is increased with time. The speed doubles every two seconds.


[view class]
disableFastSpin
public:
virtual IBaseSpinButton& disableFastSpin()

Disables fast spinning of the spin button.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
enableFastSpin
public:
virtual IBaseSpinButton& enableFastSpin(bool fast = true)

Enables or disables fast spinning of the spin button. The style fastSpin causes the spin button to increase the spin speed relative to the length of time the button is pressed. The speed doubles every two seconds until the spin button reaches the upper or lower bound. At this point, the speed resets to the original speed and again doubles every two seconds.
Note: Do not use this function on a master spin button that has servants spun from it.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


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

If the spin speed is doubled every two seconds, true is returned. Otherwise, false is returned.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Implementation

These members provide utilities used to implement this class.


[view class]
initialize

Used by several of the constructors to create a spin button control.


Overload 1
protected:
virtual void initialize()

Supported Platforms

Windows OS/2 AIX
Yes Yes No


Overload 2
protected:
void initialize( unsigned long windowId, const IWindowHandle& parent, const IWindowHandle& owner, unsigned long style, const IRectangle& initial )

Exception

IInvalidParameter The parent window pointer specified was invalid. You must specify a valid IWindow pointer as the parent.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Layout Support

Layout support members supply information used by the canvas classes to provide dialog-like behavior.


[view class]
visibleRectangle
public:
virtual IRectangle visibleRectangle() const

Returns the painted rectangle for the spin button where the painted rectangle of the control is different from its actual rectangle. The default behavior of this function returns the actual rectangle.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
calcMinimumSize
protected:
virtual ISize calcMinimumSize() const

Returns the recommended minimum size of this spin button control. The size is based on the font and the text limit.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Limit and Spin

Use these members to manage the spin field for objects of this class.


[view class]
isSpinFieldValid
public:
virtual bool isSpinFieldValid(bool caseSensitive) const = 0

Determines if the contents of the spin field are valid. It is a pure virtual function that derived classes use.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
limit
public:
unsigned long limit() const

Returns the number of characters permitted in the spin field.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
setLimit
public:
virtual IBaseSpinButton& setLimit( unsigned long aNumber = 255 )

Sets the number of characters permitted in the spin field. The Open Class Library defines this limit as 255 at the time of construction.

Exception

IInvalidParameter The specified limit value is invalid.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
setMaster
public:
virtual IBaseSpinButton& setMaster(IBaseSpinButton& master)

Defines a servant spin button's master. The spin button for which you call this function must be a servant.

Exception

IInvalidRequest. This spin button is not a servant.
IInvalidParameter The specified spin button is not a master spin button.
IAccessError The operating system's request to set the master spin button has failed.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes

Windows Considerations

The presence or absence of the pmCompatible style must be the same for a master spin button and its associated servant spin buttons.


[view class]
spinDown
public:
virtual IBaseSpinButton& spinDown(unsigned long spinBy = 1)

Spins the button down the specified number of times.

Exception

IInvalidRequest The spin value is invalid.

Supported Platforms

Windows OS/2 AIX
Yes Yes Ignored


[view class]
spinUp
public:
virtual IBaseSpinButton& spinUp(unsigned long spinBy = 1)

Spins the button up the specified number of times.

Exception

IInvalidRequest The spin value is invalid.

Supported Platforms

Windows OS/2 AIX
Yes Yes Ignored


Notification Members

Use these members to identify notifications sent to observer objects.


[view class]
textId
public:
static INotificationId const textId

Notification identifier provided to observers when the text value of a spin button changes.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
valueId
public:
static INotificationId const valueId

Notification identifier provided to observers when the value of a numeric spin button changes.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overrides

These members have been overridden to provide the correct behavior for this class.


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

Enables or disables the window from accepting keyboard and mouse input.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Read-Only Operations

These members query and modify the read-only mode in the spin button, which specifies if the user can directly change the spin field text.


[view class]
disableDataUpdate
public:
virtual IBaseSpinButton& disableDataUpdate()

Disables direct editing of the spin field data by the end user.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
enableDataUpdate
public:
virtual IBaseSpinButton& enableDataUpdate( bool writeable = true )

Enables or disables direct editing of spin field data by the end user.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


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

If the user can type in the spin field, true is returned. Otherwise, false is returned.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Styles

These style members provide a set of valid styles for the IBaseSpinButton class. Use these members to query and set spin button styles. You can use these styles with the styles in IWindow.


[view class]
convertToGUIStyle
public:
virtual unsigned long convertToGUIStyle( const IBitFlag& style, bool extendedOnly = false ) const

Converts a style object into a value appropriate for the presentation system. The default action is to return the base GUI styles for the platform. Extended styles, those defined by the application and the Open Class Library, are returned if you set extendedOnly to true.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
border3D
public:
static const Style border3D

Adds an etched 3D border to the control. This style is ignored if the pmCompatible or noBorder styles are chosen.

Supported Platforms

Windows OS/2 AIX
Yes Ignored Ignored


[view class]
centerAlign
public:
static const Style centerAlign

Centers the text in the spin field.

Supported Platforms

Windows OS/2 AIX
Yes Yes Ignored


[view class]
fastSpin
public:
static const Style fastSpin

Increases the spin speed of the spin button with time. The speed doubles every two seconds.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
leftAlign
public:
static const Style leftAlign

Left-justifies the text in the spin field.

Supported Platforms

Windows OS/2 AIX
Yes Yes Ignored


[view class]
master
public:
static const Style master

Specifies that the spin button component consists of the following:

When the spin button contains more than one spin field, the master component contains the spin arrows. If the component contains only one spin field, it must be a master.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
noBorder
public:
static const Style noBorder

Suppresses the drawing of a border.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
pmCompatible
public:
static const Style pmCompatible

Creates a control with a Presentation Manager look and feel.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes

OS/2 Considerations

This style is always set.

Windows Considerations

Specify this style to create a control with a look and feel similar to the Presentation Manager spin button control.

The presence or absence of the pmCompatible style must be the same for a master spin button and its associated servant spin buttons.


[view class]
readOnly
public:
static const Style readOnly

Prevents entering input into the spin field.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
rightAlign
public:
static const Style rightAlign

Right-justifies the text in the spin field.

Supported Platforms

Windows OS/2 AIX
Yes Yes Ignored


[view class]
servant
public:
static const Style servant

Creates a multiple-field spin button by spinning servants from the master. This style requires that you call ISpinButton::setMaster to define the master spin field.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


IBaseSpinButton - Enumerations


[view class]
Alignment
enum Alignment { left, 
                 right, 
                 center }

Use these enumerators to specify the alignment of text in the spin field:

left
Left-justifies the text or number.
center
Centers the text or number.
right
Right-justifies the text or number.

Supported Platforms

Windows OS/2 AIX
Yes Yes Ignored

AIX Considerations

Alignment enumeration is ignored. All spin buttons have left alignment.


IBaseSpinButton - Inherited Member Functions and Data

Inherited Public Functions

IControl
INotifier
IWindow

Inherited Public Data

IWindow
INotifier

Inherited Protected Functions

IWindow
INotifier
IControl

Inherited Protected Data