Taxonomy Categories:
Member Functions:
Interface Category:
API.
Inherits From:
TSimpleView, MMouseEventHandler, MControl, MDelegatingFloatControl
Inherited By:
TLineSlider
Purpose:
TSliderControl derives from TSimpleView, MMouseEventHandler, MControl and MDelegatingFloatControl. Sliders are controls that display a single floating-point value and allow that value to be changed following appropriate user interaction. By default, the floating-point value ranges between 0 and 1 inclusive. However, you can set minimum, maximum, and interval constraints.
Instantiation:
Abstract base class; do not allocate.
Deriving Classes:
Classes deriving from TSliderControl must override the pure virtual functions MouseDown, CreateInteractor, MoveThumbToGlobalPoint, MoveThumbToTrackValue, MoveThumbToFloatValue, and SetThumbBounds.
Concurrency:
Not multithread safe.
Resource Use:
No special requirements.
- TSliderControl ()
- TSliderControl (TLabel *label)
- TSliderControl (MFloatControlState * state, TLabel *label =NIL)
- TSliderControl (const TSliderControl & that)
Interface Category:
API.
Purpose:
- Default constructor.
- Creates a new TSliderControl and adopts the specified label.
- Creates a new TSliderControl and adopts the specified control state and the specified label.
- Copy constructor.
Calling Context:
- Called by the stream-in operators.
- Call this function directly.
- Call this function directly.
- Called to copy an object.
Parameters:
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
virtual ~ TSliderControl ()
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.
TSliderControl & operator =(const TSliderControl &)
Interface Category:
API.
Purpose:
Assignment operator.
Calling Context:
Call this function by using the operator in an assignment statement.
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: TSliderControl::operator>>=
virtual TStream & operator >>=(TStream &) const
Interface Category:
API.
Purpose:
Stream-out operator.
Calling Context:
Called to stream out data.
Parameters:
- TStream & -The stream the object streams itself out to.
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: TSliderControl::operator<<=
virtual TStream & operator <<= (TStream &)
Interface Category:
API.
Purpose:
Stream-in operator.
Calling Context:
Called to stream in data.
Parameters:
- TStream & -The stream the object streams itself in from.
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: TSliderControl::AdoptLabel
virtual void AdoptLabel (TLabel * label)
Interface Category:
API.
Purpose:
Adopts the specified label. The label is displayed to the user along with the slider's track and thumb. The label typically indicates what the slider is controlling, such as page number. This function deletes the previously adopted label and invalidates the slider's layout (forcing it to redraw).
Calling Context:
Call this function directly.
Parameters:
- TLabel * label -The label to be adopted.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TSliderControl::SetEnabled
virtual void SetEnabled (bool)
Interface Category:
API.
Purpose:
Enables or disables this slider according to the specified Boolean flag. A disabled slider is not interactive, while an enabled control functions normally.
Calling Context:
Call this function directly.
Parameters:
- bool -The flag indicating whether to enable or disable this slider--true enables the slider; false disables it.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
Overrides the inherited MControl function.
Member Function: TSliderControl::SetPressed
virtual void SetPressed (bool)
Interface Category:
API.
Purpose:
Sets this slider as either pressed or unpressed according to the specified Boolean flag. Normally, a slider becomes pressed when the user clicks over it with the mouse. By default, sliders are unpressed.
Calling Context:
Call this function directly.
Parameters:
- bool -The flag indicating whether this slider should become pressed or unpressed--true presses the slider; false unpresses it.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
Overrides the inherited MControl function.
Member Function: TSliderControl::SetControlLayout
virtual void SetControlLayout (ELayout layout)
Interface Category:
API.
Purpose:
Sets the layout orientation of this slider. The control layout determines how the components of the slider are laid out with respect to each other. For example, kLeftToRight specifies that the label is on the left of the track. By default, sliders are laid out kLeftToRight.
Calling Context:
Call this function directly.
Parameters:
- ELayout layout -The orientation to set.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
Overrides the inherited MControl function.
Member Function: TSliderControl::SetFloatValue
virtual void SetFloatValue (double newValue)
Interface Category:
API.
Purpose:
Sets the value of this slider. This function calls MoveThumbToFloatValue to adjust the position of the slider's thumb.
Calling Context:
Call this function directly.
Parameters:
- double newValue -The new value to pass on to the state object.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
Overrides the inherited MDelegatingFloatControl function.
Member Function: TSliderControl::GetTrackPaint
virtual const TPaint * GetTrackPaint () const
Interface Category:
API.
Purpose:
Returns the paint used to draw the slider's track. This function can never return NIL. If the track paint is NIL when this function is called, this function creates a default track paint.
Calling Context:
Call this function directly.
Parameters:
Return Value:
Returns the paint used to draw the slider's track.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TSliderControl::SetTrackPaint
virtual void SetTrackPaint (const TPaint & paint)
Interface Category:
API.
Purpose:
Sets the paint used to draw the slider's track. This function adopts a copy of the specified paint object and deletes the previous track paint.
Calling Context:
Call this function directly.
Parameters:
- const TPaint & paint -The new track paint.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TSliderControl::AdoptTrackPaint
virtual void AdoptTrackPaint (TPaint * paint)
Interface Category:
API.
Purpose:
Adopts the specified paint object as the slider's track paint. This function deletes the previous track paint.
Calling Context:
Call this function directly.
Parameters:
- TPaint * paint -The new track paint.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TSliderControl::GetTrackFillType
ETrackFillType GetTrackFillType () const
Interface Category:
API.
Purpose:
Returns the fill type used to fill the slider's track. The fill type determines how much of the slider's track is filled. This function returns a value of type ETrackFillType defined by this class.
Calling Context:
Call this function directly.
Parameters:
Return Value:
Returns the track fill type setting.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TSliderControl::SetTrackFillType
virtual void SetTrackFillType (ETrackFillType type)
Interface Category:
API.
Purpose:
Sets the fill type used to fill the slider's track. The fill type determines how much of the slider's track is filled.
Calling Context:
Call this function directly.
Parameters:
- ETrackFillType type -The new track fill type for this slider.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TSliderControl::GetTrackFillPaint
virtual const TPaint * GetTrackFillPaint () const
Interface Category:
API.
Purpose:
Returns the paint used to fill the slider's track. This function can never return NIL. If the track fill paint is NIL when this function is called, this function creates a default fill paint.
Calling Context:
Call this function directly.
Parameters:
Return Value:
Returns the paint used to fill the slider's track.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TSliderControl::SetTrackFillPaint
virtual void SetTrackFillPaint (const TPaint & paint)
Interface Category:
API.
Purpose:
Sets the paint used to fill the slider's track. This function adopts a copy of the specified paint object and deletes the previous track fill paint.
Calling Context:
Call this function directly.
Parameters:
- const TPaint & paint -The new track fill paint.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TSliderControl::AdoptTrackFillPaint
virtual void AdoptTrackFillPaint (TPaint * paint)
Interface Category:
API.
Purpose:
Adopts the specified paint object as the slider's track fill paint. This function deletes the previous track fill paint.
Calling Context:
Call this function directly.
Parameters:
- TPaint * paint -The new track fill paint.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TSliderControl::GetThumbPaint
virtual const TPaint * GetThumbPaint () const
Interface Category:
API.
Purpose:
Returns the fill paint used for drawing the unpressed thumb. This function can never return NIL. If the thumb paint is NIL when this function is called, this function creates a new default thumb paint.
Calling Context:
Call this function directly.
Parameters:
Return Value:
Returns the fill paint for the unpressed thumb.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TSliderControl::SetThumbPaint
virtual void SetThumbPaint (const TPaint & paint)
Interface Category:
API.
Purpose:
Sets the paint used to draw the unpressed thumb. This function adopts a copy of the specified paint object and deletes the previous thumb paint.
Calling Context:
Call this function directly.
Parameters:
- const TPaint & paint -The new thumb paint.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TSliderControl::AdoptThumbPaint
virtual void AdoptThumbPaint (TPaint * paint)
Interface Category:
API.
Purpose:
Adopts the specified paint object used to draw the unpressed thumb. This function deletes the previous thumb paint.
Calling Context:
Call this function directly.
Parameters:
- TPaint * paint -The new thumb paint.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TSliderControl::GetThumbPressedPaint
virtual const TPaint * GetThumbPressedPaint () const
Interface Category:
API.
Purpose:
Returns the fill paint used to draw the pressed thumb. This function can never return NIL. If the pressed thumb paint is NIL when this function is called, this function creates a new default pressed thumb paint.
Calling Context:
Call this function directly.
Parameters:
Return Value:
Returns the fill paint for the pressed thumb.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TSliderControl::SetThumbPressedPaint
virtual void SetThumbPressedPaint (const TPaint & paint)
Interface Category:
API.
Purpose:
Sets the paint used to draw the pressed thumb. This function adopts a copy of the specified paint object and deletes the previous pressed thumb paint.
Calling Context:
Call this function directly.
Parameters:
- const TPaint & paint -The new pressed thumb paint.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TSliderControl::AdoptThumbPressedPaint
virtual void AdoptThumbPressedPaint (TPaint * paint)
Interface Category:
API.
Purpose:
Adopts the specified paint object used to draw the pressed thumb. This function deletes the previous pressed thumb paint.
Calling Context:
Call this function directly.
Parameters:
- TPaint * paint -The new pressed thumb paint.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TSliderControl::CreateInteractor
virtual TInteractor * CreateInteractor (const TGPoint & pt)
Interface Category:
API.
Purpose:
Creates an interactor for the slider.
Calling Context:
Called from MouseDown in classes deriving from TSliderControl.
Parameters:
- const TGPoint & pt -The location of the input event that started the interaction on this slider.
Return Value:
Returns the newly created interactor.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
This function overrides the inherited MControl function. It is a pure virtual function and must be overridden by classes deriving from TSliderControl.
Member Function: TSliderControl::SetThumbBounds
virtual void SetThumbBounds ()
Interface Category:
API.
Purpose:
Adjusts the thumb position based upon the current thumb location and orientation of the slider track.
Calling Context:
Called directly by friend classes or classes deriving from TSliderControl.
Parameters:
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
This function is a pure virtual function and must be overridden by classes deriving from TSliderControl. This function is also protected.
Member Function: TSliderControl::SetFloatValueDuringInteraction
virtual void SetFloatValueDuringInteraction (double newValue)
Interface Category:
API.
Purpose:
Sets the value of this slider's float control state object. This function is similar to SetFloatValue except that it does not call MoveThumbToFloatValue.
Calling Context:
Called during interaction on the slider.
Parameters:
- double newValue -The new value for this slider.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
This is a protected member function.
Member Function: TSliderControl::IsLayoutValid
virtual bool IsLayoutValid ()
Interface Category:
API.
Purpose:
Determines whether the slider's layout is valid. The layout becomes invalid if the slider's bounds, constraints, margins, or other visible characteristics change and the slider needs to be laid out again.
Calling Context:
Called directly by friend classes or classes deriving from TSliderControl.
Parameters:
Return Value:
Returns true if the layout is valid.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
This is a protected member function.
Member Function: TSliderControl::SetLayoutValid
virtual void SetLayoutValid (bool flag)
Interface Category:
API.
Purpose:
Sets the slider's layout to be valid or invalid according to the specified flag.
Calling Context:
Called directly by friend classes or classes deriving from TSliderControl.
Parameters:
- bool flag -The flag indicating whether to validate or invalidate the slider's layout.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
This is a protected member function.
virtual void Layout ()
Interface Category:
API.
Purpose:
Lays out the slider's components according to the slider's current paint, label, and other settings. This function also calls SetLayoutValid to validate the layout.
Calling Context:
Called directly by friend classes or classes deriving from TSliderControl.
Parameters:
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
This is a protected member function.
Member Function: TSliderControl::HandleStateChanged
virtual void HandleStateChanged ()
Interface Category:
API.
Purpose:
Handles notification that the float control's state has changed. This can be the float value, or the float constraints. This function is also called if other aspects of the slider control are changed and the slider needs to relayout. Classes deriving from TSliderControl override this function to update their presentation of the state.
Calling Context:
Called from AdoptState, SetState, OrphanState, and StateChanged.
Parameters:
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
HandleStateChanged is a protected member function.
Member Function: TSliderControl::ForceRedraw
virtual void ForceRedraw ()
Interface Category:
API.
Purpose:
Forces the slider to relayout and consequently draw its contents by invalidating the slider.
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.
virtual bool IsEnabled () const
Interface Category:
API.
Purpose:
Determines whether this slider's state object is enabled. IsEnabled is defined in MDelegatingFloatControl and MControl--both of which are parent classes to TSliderControl. This function returns true if both MDelegatingFloatControl and MControl return true; otherwise it returns false.
Calling Context:
Called by MouseDown to see if an interaction can take place. You can also call this function directly.
Parameters:
Return Value:
Returns true if this slider's state object is enabled, false otherwise.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
Overrides the inherited MDelegatingFloatControl function.
Member Function: TSliderControl::MoveThumbToFloatValue
virtual void MoveThumbToFloatValue (double value)
Interface Category:
API.
Purpose:
Moves the slider's thumb to the specified value.
Calling Context:
Called during mouse interaction on the slider.
Parameters:
- double value -The value at which the thumb should be placed.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
This function is a pure virtual function and must be overridden by classes deriving from TSliderControl.
Member Function: TSliderControl::MoveThumbToTrackValue
virtual void MoveThumbToTrackValue (GCoordinate value)
Interface Category:
API.
Purpose:
Moves the slider's thumb to the specified location on the track.
Calling Context:
Called during mouse interaction on the slider.
Parameters:
- GCoordinate value -The track location to which to move the thumb.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
This function is a pure virtual function and must be overridden by classes deriving from TSliderControl.
Member Function: TSliderControl::MoveThumbToGlobalPoint
virtual GCoordinate MoveThumbToGlobalPoint (const TGPoint & point)
Interface Category:
API.
Purpose:
Moves the slider's thumb to the specified global position.
Calling Context:
Called during mouse interaction on the slider.
Parameters:
- const TGPoint & point -The global position to which to move the thumb.
Return Value:
Returns the track value where the thumb was actually moved.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
This function is a pure virtual function and must be overridden by classes deriving from TSliderControl.
Member Function: TSliderControl::OrphanLabel
virtual TLabel * OrphanLabel ()
Interface Category:
API.
Purpose:
Orphans the slider's label. This function invalidates the layout.
Calling Context:
Call this function directly.
Parameters:
Return Value:
Returns the orphaned label.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TSliderControl::HandleAllocatedAreaChanged
virtual void HandleAllocatedAreaChanged (const TGArea & newArea)
Interface Category:
API.
Purpose:
Handles the situation where the control's allocated area has changed. Calls Layout to relayout the control, and also redraws the control.
Calling Context:
Called by the framework when the slider control's allocated area is changed. If you derive the TSliderControl and override this same function in your derived class, be sure to call TSliderControl::HandleAllocatedAreaChanged in your implementation.
Parameters:
- const TGArea & newArea -A reference to the new TGArea object.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
This protected function overrides the inherited TView function.
Member Function: TSliderControl::HandleBeforeDisconnectionFromViewRoot
virtual void HandleBeforeDisconnectionFromViewRoot ()
Interface Category:
API.
Purpose:
Performs actions required before disconnecting from the view root. Breaks the notification connection with the state, and delegates to TSimpleView.
Calling Context:
Called before disconnecting from the view root.
Parameters:
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
This protected function overrides the inherited TView function.
Member Function: TSliderControl::HandleAfterConnectionToViewRoot
virtual void HandleAfterConnectionToViewRoot ()
Interface Category:
API.
Purpose:
Performs setup actions required after connection to the view root. Delegates to TSimpleView, and establishes a notification connection to the state.
Calling Context:
Called by the View system after the view is connected (directly or indirectly) to the view root.
Parameters:
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
This protected function overrides the inherited TView function.
virtual void GetBounds (TGArea & area) const
Interface Category:
API.
Purpose:
Returns an area of the preferred size for the slider control. The preferred size of a control is the smallest rectangle that contains all of the control's components laid out according to the control's layout orientation.
Calling Context:
Called externally and internally by the View system. Clients or derived classes can call this function directly.
Parameters:
- TGArea & area -Receives the area of the preferred size.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
Overrides the inherited TView function.
Member Function: TSliderControl::GetVisibility
virtual bool GetVisibility () const
Interface Category:
API.
Purpose:
Delegates to TView to determine whether this control is visible.
Calling Context:
Called directly by clients or derived classes.
Parameters:
Return Value:
Returns true if this control is visible, false otherwise.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
Overrides the inherited MControl function.
Member Function: TSliderControl::SetVisibility
virtual void SetVisibility (bool)
Interface Category:
API.
Purpose:
Sets this slider control to be visible or invisible. Delegates to TView to draw the control (if it has become visible) or to refresh the previously visible area (if the control has been set to invisible) to make the newly exposed areas appear on the display.
Calling Context:
Called directly by clients or derived classes.
Parameters:
- bool -The flag indicating whether this control should become visible or invisible--true makes the control visible; false makes it invisible.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
Overrides the inherited MControl function.
virtual bool MouseDown (TMouseDownEvent & mouseEvent)
Interface Category:
API.
Purpose:
Receives the mouse-down events that occur inside the slider. Classes deriving from TSliderControl override this function to implement specific mouse-down handling, such as creating an interactor on the slider (using CreateInteractor) and starting the interactor.
Calling Context:
Called by the Input System framework.
Parameters:
- TMouseDownEvent & mouseEvent -The event that caused this function to be called.
Return Value:
Returns true if this slider handled the mouse-down event, false otherwise.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
This function overrides the inherited MMouseEventHandler function. It is a pure virtual function and must be overridden by classes deriving from TSliderControl.
virtual const TLabel * GetLabel () const
Interface Category:
API.
Purpose:
Returns the slider's label.
Calling Context:
Call this function directly.
Parameters:
Return Value:
Returns the slider's label.
Exceptions:
Throws no exceptions, 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.