[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

 

LActiveScroller



Overview:

LActiveScroller is a PowerPlant class that is used for scrolling views. Scroller views implement all the functionality of scroll bars, including creation, resizing, moving, hiding, showing, enabling and other operations. Sometimes you will see scrolling views referred to simply as "scrollers" in the PowerPlant documentation.

The only functional difference between LActiveScroller and LScroller is that LActiveScroller supports dynamic scrolling of the view.

Methods :

The methods in this class are:

 

LActiveScroller()  
~LActiveScroller()  
ActiveThumbScroll()  
AdaptToNewThumbValue()  
AdjustScrollBars()  
AssignThumbProcs()  
CalcValueFromPoint()  
EndThumbTracking()  
HandleThumbScroll()  
IsTrackingThumb()  
ListenToMessage()  
StartThumbTracking()  

Data Members:

The data members in this class are:

 

mThumbControl  
mTrackBarUnits  
mTrackBarPin  
mTrackBarSize  
mOriginalValue  
mTrackRect  
mValueSlop  
mVertThumbAction  
mHorizThumbAction  
 

Operation:

The most important feature of a scroller view is that it has only one subpane, which is a view. The subview may contain an arbitrary number of panes and views. The net effect is that the scroller view may contain any number of panes of any type.

Source files:

(Pane Classes)

LActiveScroller.h

LActiveScroller.cp

Ancestors:

LListener

LPane

LScroller

LView

LActiveScroller()

Purpose:

The constructor creates objects from the passed-in parameters.

Access:

Public

Prototype:

LActiveScroller();

LActiveScroller( LStream *inStream );

LActiveScroller( const LScroller &inOriginal );

LActiveScroller( const SPaneInfo &inPaneInfo,
const SViewInfo &inViewInfo,
SInt16 inHBLeftIndent,
SInt16 inHBRightIndent,
SInt16 inVBTopIndent,
SInt16 inVBBottomIndent,
LView *inScrollingView);
Parameters:

These constructors have the following parameters:

 

const   LScroller&  
inOriginal  
A reference to the LScroller object you want to copy.  
const   SPaneInfo&  
inPaneInfo  
A reference to the SPaneInfo object that is the super view.  
const   SViewInfo&  
inViewInfo  
A reference to the SViewInfo object that contains information about the SuperView.  
SInt16  
inHBLeftIndent  
The indentation to use on the left side for the horizontal scrolling. A good initial value for this parameter is 15.  
SInt16  
inHBRightIndent  
The indentation to use on the right side for the horizontal scrolling. A good initial value for this parameter is 15.  
SInt16  
inVBTopIndent  
The indentation to use on the top for the vertical scrolling. A good initial value for this parameter is 15.  
SInt16  
inVBBottomIndent  
The indentation to use on the bottom for the vertical scrolling. A good initial value for this parameter is 15.  
LView  
inScrollingView  
A pointer to the view that corresponds to this Scroller.  
LStream*  
inStream  
A pointer to a stream object that contains the information to create the LScroller object.  

~LActiveScroller()

Purpose:

The destructor destroys the object.

Access:

Virtual, Public

Prototype:

virtual ~LActiveScroller();

ActiveThumbScroll()

Purpose:

This is the static callback for the scroll bars when the thumb is tracked. The LScroller implementation embeds a pointer to the scroller object in the control reference field of the control record.

Access:

Static, Protected

Prototype:

static pascal void LActiveThumbScroll();
Parameters:

None

Return:

None

AdaptToNewThumbValue()

Purpose:

This method is where to do the scroll of the scrolling view based on the new value for the tracking control.

Access:

Virtual, Protected

Prototype:

virtual void AdaptToNewThumbValue(
SInt32 inNewValue);
Parameters:

This method has the following parameter:

 

SInt32  
inNewValue  
This is the new value to set for the scroller.  

Return:

None

AdjustScrollBars()

Purpose:

This method gets called as a result of the view scrolling. We want this to function the same as the LScroller implementation, except while we're tracking. We maintain the scroll bar during the track, so there's no need to calculate the value and draw the control twice per scroll.

This method is an override of AdjustScrollBars() in the LScroller class.

AssignThumbProcs()

Purpose:

Create new UPP's (Universal Procedure Pointers) and assign them to the thumbs of each of the scroll bars (if they exist).

To learn more about UPP's, refer to Inside Macintosh: PowerPC System Software, published by Addison-Wesley.

Access:

Virtual, Protected

Prototype:

virtual void AssignThumbProcs();
Parameters:

None

Return:

None

CalcValueFromPoint()

Purpose:

Given a point, calculate the value for the control. The instance varaibles used in this calculation are initialized in the StartThumbTracking() method. The returned value is adjusted for slop.

Access:

Virtual, Protected

Prototype:

virtual SInt32 CalcValueFromPoint(Point inPoint);
Parameters:

This method has the following parameter:

 

Point  
inPoint  
This is the point coordinates from which the control value is calculated.  

Return:

SInt32 indicating the new value for the control.

EndThumbTracking()

Purpose:

Register the fact that we're done tracking. The most important thing is to NULL out the instance variable that keeps track of the current tracking control. When that variable is nil we're assumed to not be tracking.

Access:

Virtual, Protected

Prototype:

virtual void EndThumbTracking();
Parameters:

None

Return:

None

HandleThumbScroll()

Purpose:

This method is where the actual thumb action is handled.

Access:

Virtual, Protected

Prototype:

virtual void HandleThumbScroll(
LStdControl *inWhichControl);
Parameters:

This method has the following parameter:

 

LStdControl*  
inWhichControl  
This is the pointer to the standard control.  

Return:

None

Remarks:

We could eliminate the click loop if we could guarantee to get called if the drag didn't change the value of the control. Currently, if the value doesn't change, no notification is issued, therefore there's no way for us to reset the tracking state.

IsTrackingThumb()

Purpose:

Correct way to check to see if we're currently in the tracking loop.

Access:

Virtual, Public

Prototype:

virtual Boolean IsTrackingThumb();
Parameters:

None

Return:

Boolean indicating whether the tracking loop is currently executing.

ListenToMessage()

Purpose:

In this method we want to do exactly like we do in the LScroller implementaion except when we have finished tracking. Usually the msg_ThumbDragged message causes the scrolling view to adjust, but since we did live tracking, we're already scrolled to the correct location. So we just ignore that particular message.

This method is an override of ListenToMessage() in the LListener class.

StartThumbTracking()

Purpose:

This method sets up the tracking instance variables. We also calclulate the value slop constant so that clicks in the thumb of a scroll bar with a large scroll unit will not cause unnecessary jumps in the view.

Access:

Virtual, Protected

Prototype:

virtual void StartThumbTracking(
LStdControl *inWhichControl);
Parameters:

This method has the following parameter:

 

LStdControl*  
inWhichControl  
This is the pointer to the standard control.  

Return:

None

mThumbControl

Purpose:

This data member is the pointer to the thumb standard control.

Access:

Protected

Prototype:

LStdControl *mThumbControl;

mTrackBarUnits

Purpose:

This data member is the value of the track bar units.

Access:

Protected

Prototype:

SInt32 mTrackBarUnits;

mTrackBarPin

Purpose:

This data member is the value of the track bar pin.

Access:

Protected

Prototype:

SInt32 mTrackBarPin;

mTrackBarSize

Purpose:

This data member is the value of the track bar size.

Access:

Protected

Prototype:

SInt32 mTrackBarSize;

mOriginalValue

Purpose:

This data member is the original value of the control before any changes.

Access:

Protected

Prototype:

SInt32 mOriginalValue;

mTrackRect

Purpose:

This data member stores the Rect value for tracking.

Access:

Protected

Prototype:

Rect mTrackRect;

mValueSlop

Purpose:

This data member stores the slop factor to apply to the value.

Access:

Protected

Prototype:

SInt32 mValueSlop;

mVertThumbAction

Purpose:

This data member stores the vertical thumb action UPP.

Access:

Protected

Prototype:

ThumbActionUPP mVertThumbAction;

mHorizThumbAction

Purpose:

This data member stores the horizontal thumb action UPP.

Access:

Protected

Prototype:

ThumbActionUPP mHorizThumbAction;

 


[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
Copyright © 2000, Metrowerks Corp. All rights reserved.

Last updated: July 21, 2000