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:
Data Members:
The data members in this class are:
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:
Ancestors:
Purpose:
The constructor creates objects from the passed-in parameters.
Access:
Prototype:
LActiveScroller();
LActiveScroller( LStream *inStream );
LActiveScroller( const LScroller &inOriginal );
LActiveScroller( const SPaneInfo &inPaneInfo,Parameters:
const SViewInfo &inViewInfo,
SInt16 inHBLeftIndent,
SInt16 inHBRightIndent,
SInt16 inVBTopIndent,
SInt16 inVBBottomIndent,
LView *inScrollingView);
These constructors have the following parameters:
Purpose:
The destructor destroys the object.
Access:
Prototype:
virtual ~LActiveScroller();
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:
Prototype:
static pascal void LActiveThumbScroll();Parameters:
Return:
Purpose:
This method is where to do the scroll of the scrolling view based on the new value for the tracking control.
Access:
Prototype:
virtual void AdaptToNewThumbValue(Parameters:
SInt32 inNewValue);
This method has the following parameter:
Return:
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.
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:
Prototype:
virtual void AssignThumbProcs();Parameters:
Return:
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:
Prototype:
virtual SInt32 CalcValueFromPoint(Point inPoint);Parameters:
This method has the following parameter:
Return:
SInt32 indicating the new value for the control.
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:
Prototype:
virtual void EndThumbTracking();Parameters:
Return:
Purpose:
This method is where the actual thumb action is handled.
Access:
Prototype:
virtual void HandleThumbScroll(Parameters:
LStdControl *inWhichControl);
This method has the following parameter:
Return:
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.
Purpose:
Correct way to check to see if we're currently in the tracking loop.
Access:
Prototype:
virtual Boolean IsTrackingThumb();Parameters:
Return:
Boolean indicating whether the tracking loop is currently executing.
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.
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:
Prototype:
virtual void StartThumbTracking(Parameters:
LStdControl *inWhichControl);
This method has the following parameter:
Return:
Purpose:
This data member is the pointer to the thumb standard control.
Access:
Prototype:
LStdControl *mThumbControl;
Purpose:
This data member is the value of the track bar units.
Access:
Prototype:
SInt32 mTrackBarUnits;
Purpose:
This data member is the value of the track bar pin.
Access:
Prototype:
SInt32 mTrackBarPin;
Purpose:
This data member is the value of the track bar size.
Access:
Prototype:
SInt32 mTrackBarSize;
Purpose:
This data member is the original value of the control before any changes.
Access:
Prototype:
SInt32 mOriginalValue;
Purpose:
This data member stores the Rect value for tracking.
Access:
Prototype:
Rect mTrackRect;
Purpose:
This data member stores the slop factor to apply to the value.
Access:
Prototype:
SInt32 mValueSlop;
Purpose:
This data member stores the vertical thumb action UPP.
Access:
Prototype:
ThumbActionUPP mVertThumbAction;
Purpose:
This data member stores the horizontal thumb action UPP.
Access:
Prototype:
ThumbActionUPP mHorizThumbAction;