Class: MIntegerControlState

Declaration: BooleanControlGroups.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

MCollectible

Inherited By:

None.

Purpose:

MIntegerControlState is an abstract base class. Classes deriving from MIntegerControlState are acted upon by a TBooleanControlGroup object when that control group is manipulated by the user. An integer control state object potentially acts on another object known as its client object or its target object. In other words, integer control states are functors that translate integer control protocol into the protocol of some target object. Boolean control groups adopt an MIntegerControlState and translate user input (for example, selection of an individual control in the group) into calls to this object.

Instantiation:

Abstract base class; do not allocate.

Deriving Classes:

This class must be derived from to be used by a Boolean control group. A derived class of MIntegerControlState could be designed to act upon a target object, translating TBooleanControlGroup protocol into the protocol of the target. Classes deriving from MIntegerControlState must override GetInteger and SetInteger. Taligent provides the TDefaultIntegerControlState derived class; a TBooleanControlGroup will use this class to create a default state if none is adopted or set.

Concurrency:

Not multithread safe.

Resource Use:

No special requirements.

Other Considerations:

None.

Member Function: MIntegerControlState::MIntegerControlState

  1. MIntegerControlState ()
  2. MIntegerControlState (const MIntegerControlState &)

Interface Category:

API.

Purpose:

  1. Default constructor.
  2. Copy constructor.

Calling Context:

  1. Called by the stream-in operators.
  2. Called to copy an object.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

You might want to override this function.

Member Function: MIntegerControlState::~MIntegerControlState

virtual ~ MIntegerControlState ()

Interface Category:

API.

Purpose:

Destructor.

Calling Context:

Called to destroy an object.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

You might want to override this function.

Member Function: MIntegerControlState::operator=

MIntegerControlState & operator =(const MIntegerControlState &)

Interface Category:

API.

Purpose:

Assignment operator.

Calling Context:

Called when an object is assigned to another compatible object.

Parameters:

Return Value:

A non-const reference to the left-hand side object.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: MIntegerControlState::SetInteger

virtual void SetInteger (long)

Interface Category:

API.

Purpose:

Sets the value that is the primary state of this control state mixin. Classes deriving from MIntegerControlState are responsible for overriding this pure virtual function. If the control state acts on a target object, then the derived class is responsible for updating the target object, translating the given value into the semantics of the target object.

Calling Context:

Generally called for you by the control group that maintains this state object.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

The converse of this function is GetInteger. This is a pure virtual function; you must override it to operate on the target object using a command or other mechanism.

Member Function: MIntegerControlState::GetInteger

virtual long GetInteger () const

Interface Category:

API.

Purpose:

Returns the value that is the primary state of this control state mixin. Classes deriving from MIntegerControlState are responsible for overriding this pure virtual function. If the control state acts on a target object, then the derived class is responsible for extracting a value from the target data and translating it into the semantics of the control. This function is called by TBooleanControlGroup when a Boolean control is added to the group. If the ordinal value of the Boolean control matches the value returned from GetInteger, the Boolean control is turned on.

Calling Context:

Your control group might call this function; usually called by the owning control.

Parameters:

Return Value:

long stateValue -The value of the Boolean control group's state.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

This is a pure virtual function; you must override it to extract the value from the target data and translate it into the semantics of the control.

Member Function: MIntegerControlState::CreateInterests

virtual void CreateInterests (TCollectionOf < TInterest > &) const

Interface Category:

API.

Purpose:

Establishes a notification connection from this state object to the Boolean control group that owns it. The notification connection is used to notify the control group that the state associated with it has changed, outside the user's control, or indirectly as a result of the user manipulating something else. When the control group receives such a notification, it calls IsEnabled and updates the presentation accordingly. MIntegerControlState's implementation of this function provides an empty collection of TInterests, indicating that no notification connection is established. Classes deriving from MIntegerControlState can implement this function and provide one or more TInterest objects if they want to establish a notification connection with the Boolean control group that owns this state object.

Calling Context:

Called by the Boolean control group that owns this state object during initialization of the control and just after this state object gets adopted, orphaned, or set into the control group.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

This function is similar to MBooleanControlState::AddInterests.

Member Function: MIntegerControlState::GetLabel

virtual const TLabel * GetLabel () const

Interface Category:

API.

Purpose:

Allows a class derived from MIntegerControlState to have a label and pass a pointer to the label. No useful default behavior is supplied for this function (it returns NIL), but you can associate various labels with various control state values, then override this function to return the label corresponding to the current value. A class derived from TBooleanControlGroup can then use this function to display different labels when the control state had different values. The labels could display graphical or textual indications of the current control group state value.

Calling Context:

You can call this function from an overridden version of HandleStateChanged in a class you derived from TBooleanControlGroup.

Parameters:

Return Value:

A pointer to the label.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

As supplied by MIntegerControlState, this function returns NIL. You can override this default behavior.

Member Function: MIntegerControlState::IsEnabled

virtual bool IsEnabled () const

Interface Category:

API.

Purpose:

Determines whether the target object of this control state is enabled. A return value of true indicates that the target object is enabled and can accept state changes (the Boolean control group owning this state object can call SetInteger). A return value of false indicates that the target object is disabled and cannot accept state changes (the control group owning this state object can not call SetInteger). Typically, control groups present a different look to the user when disabled. MIntegerControlState's implementation of this function returns true. Classes deriving from MIntegerControlState can override this function if it is not always valid to call SetInteger.

Calling Context:

Ordinarily called from your derived class of TBooleanControlGroup during initialization or when a change notification is received from this state object.

Parameters:

Return Value:

Returns true if the control group is enabled. The default version supplied by MIntegerControlState always returns true.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

As supplied by MIntegerControlState, this function always returns true. You can override this default behavior.

Member Function: MIntegerControlState::GetVisibility

virtual bool GetVisibility () const

Interface Category:

API.

Purpose:

Reports whether the control group is visible. The default behavior supplied by MIntegerControlState always reports true.

Calling Context:

Ordinarily called from your derived class of TBooleanControlGroup.

Parameters:

Return Value:

Returns true if if the control group is visible. The default version supplied by MIntegerControlState always returns true.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

As supplied by MIntegerControlState, this function always returns true. You can override this default behavior.

Member Function: MIntegerControlState::operator>>=

virtual TStream & operator >>=(TStream &) const

Interface Category:

API.

Purpose:

Stream-out operator.

Calling Context:

Called to stream out data.

Parameters:

Return Value:

Returns a reference to the stream the object streams itself out to.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: MIntegerControlState::operator<<=

virtual TStream & operator <<= (TStream &)

Interface Category:

API.

Purpose:

Stream-in operator.

Calling Context:

Called to stream in data.

Parameters:

Return Value:

Returns a reference to the stream the object streams itself in from.

Exceptions:

Throws TInvalidVersionError if it encounters an object whose version number indicates that it cannot be streamed in. Passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.