Class: TSliderRuler

Declaration: FloatControls.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

MGraphic, MGUIAttributeUser

Inherited By:

None.

Purpose:

TSliderRuler, derived from MGraphic, is a concrete class for providing a ruler for use with slider controls. This class implements the drawing of the ruler and the specifications of the minimum and maximum values on the ruler, the interval between ruler values, the ruler layout relative to the slider track, and the number formatter and styles used to display the ruler numbers. When you construct a TSliderRuler, initialize its parameters before adopting the ruler into the slider control. If you need to change the parameters (such as the ruler coordinates) later, then you should first orphan the TSliderRuler from the slider control. Then, make your changes and adopt the TSliderRuler back into the slider control. Changes to the ruler while it is adopted in the slider control will foul up the layout of the slider, and are not supported.

Instantiation:

Allocate on the heap or the stack.

Deriving Classes:

This class is designed to be used directly.

Concurrency:

Not multithread safe.

Resource Use:

No special requirements.

Other Considerations:

None.

Member Function: TSliderRuler::TSliderRuler

  1. TSliderRuler ()
  2. TSliderRuler (const TSliderRuler &)

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:

None.

Member Function: TSliderRuler::~TSliderRuler

virtual ~ TSliderRuler ()

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:

None.

Member Function: TSliderRuler::operator=

TSliderRuler & operator =(const TSliderRuler &)

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: TSliderRuler::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: TSliderRuler::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 no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TSliderRuler::GetRulerCoordinates

virtual void GetRulerCoordinates (double & mimimum, double & maximum, double & intervalSize) const

Interface Category:

API.

Purpose:

Gets the current ruler constraints.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TSliderRuler::SetRulerCoordinates

virtual void SetRulerCoordinates (double minimum, double maximum, double intervalSize)

Interface Category:

API.

Purpose:

Sets the ruler constraints. The minimum is the first number in the ruler, the maximum is the last number in the ruler, and the intervalSize is the amount by which the numbers increase (or decrease). Remember that the numbers shown on the ruler have no bearing on the numbers stored in the float state. The float constraints defined in the float state can be completely different from the numbers displayed on the ruler. The ruler is purely for presentation purposes only. Specify an interval size greater than zero to force the display of the optional ruler. This does not do a relayout, nor a redraw. After calling this function, you should call GetPreferredSize and then SetBounds to set the new bounds.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TSliderRuler::GetLayout

virtual MControl :: ELayout GetLayout () const

Interface Category:

API.

Purpose:

Gets the layout orientation of this ruler relative to the slider track.

Calling Context:

Call this function directly.

Parameters:

Return Value:

The current layout orientation of this ruler.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TSliderRuler::SetLayout

virtual void SetLayout (MControl :: ELayout rulerLayout)

Interface Category:

API.

Purpose:

Sets the layout orientation of this ruler relative to the slider track. A kLeftToRight layout indicates (for a vertical slider) that the ruler appears on the left and the track appears on the right. The order is reversed for a kRightToLeft layout. A kTopToBottom layout indicates (for a horizontal slider) that the ruler appears above and the track appears below. The order is reversed for a kBottomToTop layout.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TSliderRuler::GetSpacing

virtual void GetSpacing (GCoordinate & tickLength, GCoordinate & thumbMargin, GCoordinate & numberMargin) const

Interface Category:

API.

Purpose:

Returns the current tick mark length, thumb margin, and number margin of the ruler. The tick mark length determines how long each ruler tick mark should be. The thumb margin determines the amount of space between the edge of the thumb and the tick marks. The number margin determines the amount of space between each tick mark and the number displayed next to it.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TSliderRuler::SetSpacing

virtual void SetSpacing (GCoordinate tickLength, GCoordinate thumbMargin, GCoordinate numberMargin)

Interface Category:

API.

Purpose:

Sets the current tick mark length, thumb margin, and number margin of the ruler. The tick mark length determines how long each tick mark should be. The thumb margin determines the amount of space between the edge of the thumb and the tick marks. The number margin determines the amount of space between each tick mark and the number displayed next to it.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TSliderRuler::AdoptNumberFormatter

virtual void AdoptNumberFormatter (TNumberFormatter * formatter)

Interface Category:

API.

Purpose:

Adopts the specified formatter to format the numbers displayed on the ruler. The initial formatter is a TFloatingPointNumberFormat with no integer separators, a maximum of 3 fractional digits, and a maximum number of 9999999. Adopting a NIL formatter removes the number formatter altogether, which results in no numbers. This is useful if you just want tick marks only.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TSliderRuler::OrphanNumberFormatter

virtual TNumberFormatter * OrphanNumberFormatter ()

Interface Category:

API.

Purpose:

Orphans the current ruler number formatter. If no new formatter is adopted, this results in no numbers at all. This is useful if you just want tick marks only.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns the orphaned ruler number formatter.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TSliderRuler::GetNumberFormatter

virtual TNumberFormatter * GetNumberFormatter () const

Interface Category:

API.

Purpose:

Gets the current ruler number formatter, which can be NIL if the formatter was orphaned.

Calling Context:

Call this function directly.

Parameters:

Return Value:

The current ruler number formatter.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TSliderRuler::AdoptNumberStyles

virtual void AdoptNumberStyles (TStyleSet * styles)

Interface Category:

API.

Purpose:

Adopts the specified style set to use to display the numbers on the ruler. This function deletes the previously adopted style set.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TSliderRuler::OrphanNumberStyles

virtual TStyleSet * OrphanNumberStyles ()

Interface Category:

API.

Purpose:

Orphans the current ruler number style set.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns the orphaned ruler number style set.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TSliderRuler::GetNumberStyles

virtual TStyleSet * GetNumberStyles () const

Interface Category:

API.

Purpose:

Returns the current ruler number style set.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns the current ruler number style set, which will never be NIL because a default set is created if none was adopted.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TSliderRuler::Draw

virtual void Draw (TGrafPort & port) const

Interface Category:

API.

Purpose:

Draws the ruler to the specific TGrafPort.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

Overrides the inherited MGraphic function.

Member Function: TSliderRuler::GetGeometricBounds

virtual TGRect GetGeometricBounds () const

Interface Category:

API.

Purpose:

Gets the bounding rectangle of the ruler. Note: this function is identical to GetLooseFitBounds.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns the bounding rectangle, which is the smallest axis-aligned rectangle that encloses the ruler.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

Overrides the inherited MGraphic function.

Member Function: TSliderRuler::GetLooseFitBounds

virtual TGRect GetLooseFitBounds (const TGrafPort *) const

Interface Category:

API.

Purpose:

Gets the bounding rectangle of the ruler. Note: this function is identical to GetGeometricBounds.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns the bounding rectangle, which is the smallest axis-aligned rectangle that encloses the ruler.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

Overrides the inherited MGraphic function.

Member Function: TSliderRuler::TransformBy

virtual void TransformBy (const TGrafMatrix &)

Interface Category:

API.

Purpose:

Transforms the ruler graphic's shape and position by applying the specified transformation matrix.

Calling Context:

Called by the Graphics system. You can also call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

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