Class: TScrollbar

Declaration: Scrollbar.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

TSimpleView, MControl, MActionTarget, MViewActionHandler

Inherited By:

None.

Purpose:

TScrollbar represents a scroll bar for a TScrollingView. TScrollbar can be used as a substitute in any place you might use TLineSlider.

Instantiation:

Allocate on the heap or the stack.

Deriving Classes:

While it is a complete class, you may derive classes from TScrollbar.

Concurrency:

Not multithread safe.

Resource Use:

No special requirements.

Other Considerations:

None.

Member Function: TScrollbar::TScrollbar

  1. TScrollbar ()
  2. TScrollbar (TScrollbarState * stateToAdopt)
  3. TScrollbar (MControl :: ELayout layout)
  4. TScrollbar (const TScrollbar &)

Interface Category:

API.

Purpose:

  1. Default constructor.
  2. Creates a scroll bar with adopted state.
  3. Creates a scroll bar with the specified layout.
  4. Copy constructor.

Calling Context:

  1. Called create TScrollbar suitable for streaming into.
  2. Called to create a scroll bar with the adopted state.
  3. Called to create a scroll bar with a specific layout.
  4. 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: TScrollbar::~TScrollbar

virtual ~ TScrollbar ()

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: TScrollbar::operator=

TScrollbar & operator =(const TScrollbar &)

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: TScrollbar::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 to which the object streams itself.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TScrollbar::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 from which the object streams itself.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TScrollbar::GetFloatValueChangedMessage

TSemanticActionType GetFloatValueChangedMessage () const

Interface Category:

API.

Purpose:

Returns the semantic action type that identifies the action generated when the float value represented by the scroll bar is changed.

Calling Context:

Called to return the semantic action type that identifies the action generated by this scroll bar.

Parameters:

Return Value:

Returns the semantic action type that identifies the action generated by this scroll bar.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TScrollbar::AdoptState

virtual void AdoptState (TScrollbarState * stateToAdopt)

Interface Category:

API.

Purpose:

Adopts the specified TScrollbarState object.

Calling Context:

Call this function directly to adopt a scroll bar state object for this scroll bar.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TScrollbar::OrphanState

virtual TScrollbarState * OrphanState ()

Interface Category:

API.

Purpose:

Orphans the current scroll bar state object and returns a reference to the object. A client of TScrollBarState might want to orphan the current state, adjust its values, and then call AdoptState for this same object.

Calling Context:

Call this function directly to orphan the current scroll bar state object.

Parameters:

Return Value:

Returns a reference to the orphaned state object. A NIL pointer is returned if there is no current state object.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TScrollbar::SetControlLayout

virtual void SetControlLayout (MControl :: ELayout layout)

Interface Category:

API.

Purpose:

Sets this scroll bar's control layout to the specified layout.

Calling Context:

Call this function directly to set this scroll bar's control layout.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TScrollbar::GetControlLayout

virtual MControl :: ELayout GetControlLayout () const

Interface Category:

API.

Purpose:

Returns a const reference to this scroll bar's current layout.

Calling Context:

Call this function directly to obtain this scroll bar's current layout.

Parameters:

Return Value:

Returns a const reference to this scroll bar's current layout.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TScrollbar::SetVisibility

virtual void SetVisibility (bool visible)

Interface Category:

API.

Purpose:

Enables or disables the displaying of this scroll bar on the screen.

Calling Context:

Call this function directly to make this scroll bar visible or invisible on the screen.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TScrollbar::GetVisibility

virtual bool GetVisibility () const

Interface Category:

API.

Purpose:

Determines if the scroll bar is currently visible on the screen.

Calling Context:

Call this function directly to determine if the scroll bar is currently visible on the screen.

Parameters:

Return Value:

Returns true if the scroll bar is currently visible on the screen.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TScrollbar::SetLineSize

virtual void SetLineSize (double newValue)

Interface Category:

API.

Purpose:

Sets the float value increment or decrement that will result when the scroll bar's arrow buttons are pressed.

Calling Context:

Call this function directly to set the float value increment or decrement that will result when the scroll bar's arrow buttons are pressed.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TScrollbar::GetLineSize

virtual double GetLineSize () const

Interface Category:

API.

Purpose:

Returns the current line size.

Calling Context:

Call this function directly to obtain the current line size.

Parameters:

Return Value:

Returns the current line size.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TScrollbar::SetPageSize

virtual void SetPageSize (double newValue)

Interface Category:

API.

Purpose:

Sets the float value increment or decrement that results when the user clicks in the scroll bar trough.

Calling Context:

Call this function directly to set the the float value increment or decrement that results when the user clicks in the scroll bar trough.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TScrollbar::GetPageSize

virtual double GetPageSize () const

Interface Category:

API.

Purpose:

Returns the current page size.

Calling Context:

Call this function directly to obtain the current page size.

Parameters:

Return Value:

Returns the current page size.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TScrollbar::SetFloatValue

virtual void SetFloatValue (double newValue)

Interface Category:

API.

Purpose:

Sets the value, which is the primary state of this class.

Calling Context:

Call this function directly to set the float value.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TScrollbar::GetFloatValue

virtual double GetFloatValue () const

Interface Category:

API.

Purpose:

Returns the current value.

Calling Context:

Call this function directly to obtain the current value.

Parameters:

Return Value:

Returns the current value.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TScrollbar::SetFloatConstraints

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

Interface Category:

API.

Purpose:

Sets the constraints currently applied to this float control state's value. The first two parameters indicate the range within which this float control state's value must fall. The third parameter indicates the discrete interval by which to constrain this float control state's value. For example, if the interval is 1.0, then the float control state's value is constrained to whole numbers. An interval of 0.0 indicates that there is no interval constraint.

Calling Context:

Called from ConstrainValue. 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:

None.

Member Function: TScrollbar::GetFloatConstraints

virtual void GetFloatConstraints (double & minimum, double & maximum, double & intervalSize) const

Interface Category:

API.

Purpose:

Gets the constraints currently applied to this float control state's value. The first two parameters indicate the range within which this float control state's value must fall. The third parameter indicates the discrete interval by which to constrain this float control state's value. For example, if the interval is 1.0, then the float control state's value is constrained to whole numbers. An interval of 0.0 indicates that there is no interval constraint.

Calling Context:

Called from ConstrainValue. 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:

None.

Member Function: TScrollbar::SetScrollbarTrackingEnabled

virtual void SetScrollbarTrackingEnabled (bool shouldTrack)

Interface Category:

API.

Purpose:

Enables or disables scroll bar tracking. If scroll bar tracking is enabled, then TScrollbar posts view actions for every float value change while the scroll bar thumb is being dragged. If it is false, then one view action is posted when the mouseUp occurs that ends the current thumb drag.

Calling Context:

Call this function directly to enable or disable scroll bar tracking

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TScrollbar::IsScrollbarTrackingEnabled

virtual bool IsScrollbarTrackingEnabled () const

Interface Category:

API.

Purpose:

Determines if scroll bar tracking is enabled.

Calling Context:

Call this function directly to determine if scroll bar tracking is enabled.

Parameters:

Return Value:

Returns true if scroll bar tracking is enabled.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TScrollbar::HandleViewAction

virtual bool HandleViewAction (TViewAction & action)

Interface Category:

API.

Purpose:

Handles actions posted to this scroll bar by Rocker buttons and scroll bar sliders, both subviews of TScrollbar. For example, arrow button actions caught by TScrollbar causes TScrollbar to adjust its float value, adjust the slider, and post a FloatValueChangedMessage view action.

Calling Context:

Called when an rocker button or scroll bar slider posts an action to this scroll bar.

Parameters:

Return Value:

Returns true if the action was handled.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TScrollbar::SetAllocatedAreaInParent

virtual void SetAllocatedAreaInParent (const TGArea &)

Interface Category:

API.

Purpose:

Handles changes in the size and layout of the scroll bar that result from from resizing.

Calling Context:

Called to handle changes in the size and layout of the scroll bar within the parent view.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

Note that the proper way to catch area changes is to override TView::HandleAllocatedAreaChanged.

Member Function: TScrollbar::SetAllocatedArea

  1. virtual void SetAllocatedArea (const TGArea &)
  2. virtual void SetAllocatedArea (const TGRect &)

Interface Category:

API.

Purpose:

Handles changes in the size and layout of the scroll bar that result from from resizing.

Calling Context:

Called to handle changes in the size and layout of the scroll bar.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

Note that the proper way to catch area changes is to override TView::HandleAllocatedAreaChanged.

Member Function: TScrollbar::Layout

virtual void Layout ()

Interface Category:

API.

Purpose:

Used by TScrollbar to layout its subcontrols within its view.

Calling Context:

Called by TScrollbar to layout its subcontrols within its view.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

You should not call this member function directly.

Member Function: TScrollbar::Constrain

virtual void Constrain ()

Interface Category:

API.

Purpose:

Normalizes the slider's float constraints based on TScrollbar's float constraints and size.

Calling Context:

Called to normalize the slider's float constraint.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

You should not call this member function directly.

Member Function: TScrollbar::ConstructSubControls

virtual void ConstructSubControls ()

Interface Category:

API.

Purpose:

Creates the subcontrols for this scroll bar.

Calling Context:

Called to create the subcontrols for this scroll bar.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

You should not call this member function directly.

Member Function: TScrollbar::DestroySubControls

virtual void DestroySubControls ()

Interface Category:

API.

Purpose:

Destroys the subcontrols for this scroll bar.

Calling Context:

Called to destroy the subcontrols for this scroll bar.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

You should not call this member function directly.

Member Function: TScrollbar::CreateLessArrowControlState

virtual MMomentaryControlState * CreateLessArrowControlState (TMemoryHeap * whichHeap =NIL)

Interface Category:

API.

Purpose:

Creates the MMomentaryControlState derived class for the less arrow button.

Calling Context:

Called to create the control state for the less arrow button.

Parameters:

Return Value:

Returns the newly created control state.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

You can override this member function to use a different control state class.

Member Function: TScrollbar::CreateMoreArrowControlState

virtual MMomentaryControlState * CreateMoreArrowControlState (TMemoryHeap * whichHeap =NIL)

Interface Category:

API.

Purpose:

Creates the MMomentaryControlState derived class for the more arrow button.

Calling Context:

Called to create the control state for the more arrow button.

Parameters:

Return Value:

Returns the newly created control state.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

You can override this member function to use a different control state class.

Member Function: TScrollbar::SetEnabled

virtual void SetEnabled (bool enabled)

Interface Category:

API.

Purpose:

Enables or disables this scroll bar.

Calling Context:

Call this function directly to enable or disable this scroll bar.

Parameters:

Return Value:

None.

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.