Class ScrollView
All Packages Class Hierarchy This Package Previous Next Index
Class ScrollView
public class netscape.application.ScrollView
extends netscape.application.View
implements netscape.application.Scrollable
{
/* Constructors
*/
public ScrollView();
public ScrollView(Rect);
public ScrollView(int, int, int, int);
/* Methods
*/
public DragDestination acceptsDrag(DragSession, int, int);
public void addScrollBar(Target);
public void addSubview(View);
public Color backgroundColor();
public void computeVisibleRect(Rect);
public View contentView();
public int cursorForPoint(int, int);
public void decode(Decoder);
public void describeClassInfo(ClassInfo);
public void didSizeBy(int, int);
public void drawSubviews(Graphics);
public void drawView(Graphics);
public void encode(Encoder);
public boolean isTransparent();
public int lengthOfContentViewForAxis(int);
public int lengthOfScrollViewForAxis(int);
public boolean mouseDown(MouseEvent);
public int positionOfContentViewForAxis(int);
public void removeScrollBar(Target);
public boolean scrollBarUpdatesEnabled();
public void scrollBy(int, int);
public void scrollRectToVisible(Rect);
public void scrollTo(int, int);
public void setBackgroundColor(Color);
public void setContentView(View);
public void setScrollBarUpdatesEnabled(boolean);
public void setTransparent(boolean);
public void subviewDidResize(View);
public void updateScrollBars();
}
View subclass that manages the display of a larger View. This View,
the ScrollView's "contentView," is a subview of the ScrollView. A
ScrollView can be told to essentially move its contentView's origin
to different locations, resulting in different portions of the contentView
becoming visible through the ScrollView's bounds. A scroll command
causes the entire visible portion of the contentView to be redrawn. If
the ScrollView has been configured to use a drawing buffer, it uses the
buffer to hold the visible portion of the contentView. Scroll requests
copy as much as possible from the buffer, and ask the contentView to
redraw just the newly exposed regions. Whenever a ScrollView moves
its contentView, it sends a message to all of its ScrollBars so that
they can update their knob size and position. A ScrollView maintains a
Vector of ScrollBars (or other objects) wishing to receive these
notifications. ScrollView's addScrollBar() and
removeScrollBar() methods manage this Vector. ScrollGroups typically
instantiate ScrollViews, but need not be. You can create a
ScrollView and a ScrollBar, and connect them by calling the ScrollBar's
setScrollableObject() method and ScrollView's addScrollBar()
method.
- See Also:
- ScrollBar, ScrollGroup, Scrollable
Constructors
ScrollView
public ScrollView()
- Constructs a ScrollView with origin (0, 0) and zero
width and height.
ScrollView
public ScrollView(Rect rect)
- Constructs a ScrollView with bounds rect.
ScrollView
public ScrollView(int x,
int y,
int width,
int height)
- Constructs a ScrollView with bounds
(x, y, width, height).
Methods
addSubview
public void addSubview(View aView)
- Overridden to prevent multiple Views from being added to the
ScrollView. Use the setContentView() method to set the View
scrolled by the ScrollView.
- Overrides:
- addSubview in class View
- See Also:
- setContentView
setContentView
public void setContentView(View aView)
- Sets the View scrolled by the ScrollView to aView.
contentView
public View contentView()
- Returns the View scrolled by the ScrollView.
- See Also:
- setContentView
cursorForPoint
public int cursorForPoint(int x,
int y)
- Overridden to return the ScrollView's contentView's cursor for this
point.
- Overrides:
- cursorForPoint in class View
setBackgroundColor
public void setBackgroundColor(Color aColor)
- Returns the ScrollView's background Color. If not transparent, the
ScrollView uses the background Color to paint the portions of itself
not covered by its contentView.
backgroundColor
public Color backgroundColor()
- Returns the ScrollView's background Color.
- See Also:
- setBackgroundColor
setTransparent
public void setTransparent(boolean flag)
- Sets the ScrollView to be transparent or opaque.
isTransparent
public boolean isTransparent()
- Overridden to return true if the ScrollView is transparent.
- Overrides:
- isTransparent in class View
- See Also:
- setTransparent
addScrollBar
public void addScrollBar(Target aScrollBar)
- Adds aScrollBar to the ScrollView's Vector of Targets interested
in scroll changes. Whenever the ScrollView scrolls its contentView,
it sends the ScrollBar.UPDATE command to all Targets in this
Vector, with itself as the object. A Target need not be a ScrollBar.
removeScrollBar
public void removeScrollBar(Target aScrollBar)
- Removes aScrollBar from its Vector of Targets interested in
scroll changes.
- See Also:
- addScrollBar
setScrollBarUpdatesEnabled
public void setScrollBarUpdatesEnabled(boolean flag)
- Enables (or disables) the ScrollView to (from) send messages to Targets
in its ScrollBar Targets Vector when the ScrollView scrolls its
contentView.
- See Also:
- addScrollBar
scrollBarUpdatesEnabled
public boolean scrollBarUpdatesEnabled()
- Returns true if ScrollBar updates are enabled.
- See Also:
- setScrollBarUpdatesEnabled
updateScrollBars
public void updateScrollBars()
- If ScrollBar updates are enabled, sends the ScrollBar.UPDATE command
to all Targets in the ScrollView's ScrollBar Vector with itself as
the object. Upon receiving this command, a ScrollBar should verify
that its knob's size and position accurately reflect the ScrollView's
state.
scrollRectToVisible
public void scrollRectToVisible(Rect contentRect)
- Overridden to scroll the contentView such that aRect within the
contentView becomes visible. Calls scrollBy().
- Overrides:
- scrollRectToVisible in class View
- See Also:
- scrollBy
scrollTo
public void scrollTo(int x,
int y)
- Moves the contentView's origin to (x, y). If
the ScrollView has a drawing buffer, scrolling moves as much of the
contentView's area
as possible and then calls draw() to redraw the newly exposed
portions, otherwise just calls the contentView's draw() method
to completely redraw the contentView's visible portion.
scrollBy
public void scrollBy(int deltaX,
int deltaY)
- Computes the contentView's new coordinates and calls scrollTo().
- See Also:
- scrollTo
subviewDidResize
public void subviewDidResize(View aSubview)
- Overridden to react to contentView resizes.
- Overrides:
- subviewDidResize in class View
didSizeBy
public void didSizeBy(int deltaWidth,
int deltaHeight)
- Overridden to ensure that the contentView is correctly positioned.
- Overrides:
- didSizeBy in class View
computeVisibleRect
public void computeVisibleRect(Rect aRect)
- Overidden to perform additional clipping.
- Overrides:
- computeVisibleRect in class View
drawView
public void drawView(Graphics g)
- Overidden to draw the area not covered by the contentView, unless
transparent.
- Overrides:
- drawView in class View
drawSubviews
public void drawSubviews(Graphics g)
- Overridden to perform post-drawing processing.
- Overrides:
- drawSubviews in class View
mouseDown
public boolean mouseDown(MouseEvent event)
- Overridden to pass any mouse down Event received by the ScrollView on
to its contentView.
- Overrides:
- mouseDown in class View
acceptsDrag
public DragDestination acceptsDrag(DragSession session,
int x,
int y)
- Overridden to forward the acceptsDrag() message to its
contentView.
- Overrides:
- acceptsDrag in class View
lengthOfScrollViewForAxis
public int lengthOfScrollViewForAxis(int axis)
- Scrollable interface method returning the appropriate bounds value.
- See Also:
- Scrollable
lengthOfContentViewForAxis
public int lengthOfContentViewForAxis(int axis)
- Scrollable interface method returning the appropriate contentView
bounds value.
- See Also:
- Scrollable
positionOfContentViewForAxis
public int positionOfContentViewForAxis(int axis)
- Scrollable interface method returning the appropriate contentView
bounds value.
- See Also:
- Scrollable
describeClassInfo
public void describeClassInfo(ClassInfo info)
- Describes the ScrollView class' information.
- Overrides:
- describeClassInfo in class View
- See Also:
- describeClassInfo
encode
public void encode(Encoder encoder) throws CodingException
- Encodes the ScrollView instance.
- Overrides:
- encode in class View
- See Also:
- encode
decode
public void decode(Decoder decoder) throws CodingException
- Decodes the ScrollView instance.
- Overrides:
- decode in class View
- See Also:
- decode
All Packages Class Hierarchy This Package Previous Next Index