com.threerings.opengl.gui
Class ScrollBar

java.lang.Object
  extended by com.threerings.opengl.gui.Component
      extended by com.threerings.opengl.gui.Container
          extended by com.threerings.opengl.gui.ScrollBar
All Implemented Interfaces:
ConfigUpdateListener<ManagedConfig>, UIConstants

public class ScrollBar
extends Container
implements UIConstants

Displays a scroll bar for all your horizontal and vertical scrolling needs.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.threerings.opengl.gui.Container
Container.ChildOp
 
Field Summary
protected  ActionListener _buttoner
           
protected  Button _less
           
protected  BoundedRangeModel _model
           
protected  Button _more
           
protected  int _orient
           
protected  Component _thumb
           
protected  MouseAdapter _thumbListener
           
protected  ChangeListener _updater
           
protected  Component _well
           
protected  MouseListener _wellListener
           
protected  MouseWheelListener _wheelListener
           
 
Fields inherited from class com.threerings.opengl.gui.Container
_children, _layout
 
Fields inherited from class com.threerings.opengl.gui.Component
_alpha, _backgrounds, _borders, _colors, _ctx, _cursor, _enabled, _height, _hover, _hoverable, _insets, _listeners, _parent, _preferredSize, _properties, _rect, _styleConfigs, _tipmouse, _tiptext, _tooltipStyle, _transferHandler, _valid, _visible, _width, _x, _y, DEFAULT, DISABLED, HOVER, STATE_COUNT, STATE_PCLASSES
 
Fields inherited from interface com.threerings.opengl.gui.UIConstants
BOTTOM, CENTER, DEFAULT_SIZE, DEFAULT_SPACING, GLOW, HORIZONTAL, LEFT, NORMAL, OUTLINE, OVERLAPPING, PLAIN, RIGHT, SHADOW, TOP, VERTICAL
 
Constructor Summary
ScrollBar(GlContext ctx)
          Creates a vertical scroll bar with the default range, value and extent.
ScrollBar(GlContext ctx, int orientation)
          Creates a scroll bar with the default range, value and extent.
ScrollBar(GlContext ctx, int orientation, BoundedRangeModel model)
          Creates a scroll bar with the specified orientation which will interact with the supplied model.
ScrollBar(GlContext ctx, int orientation, int min, int value, int extent, int max)
          Creates a scroll bar with the specified orientation, range, value and extent.
 
Method Summary
protected  String getDefaultStyleConfig()
          Returns the name of the default config to be used for all instances of this component.
 Component getHitComponent(int mx, int my)
          Returns the component "hit" by the specified mouse coordinates which might be this component or any of its children.
 BoundedRangeModel getModel()
          Returns a reference to the scrollbar's range model.
protected  void layout()
          Instructs this component to lay itself out.
protected  void update()
          Recomputes and repositions the scroll bar thumb to reflect the current configuration of the model.
 void wasAdded()
          This method is called when we are added to a hierarchy that is connected to a top-level window (at which point we can rely on having a look and feel and can set ourselves up).
 void wasRemoved()
          This method is called when we are removed from a hierarchy that is connected to a top-level window.
 
Methods inherited from class com.threerings.opengl.gui.Container
add, add, add, add, applyOperation, computePreferredSize, getComponent, getComponentCount, getComponentIndex, getFirstDescendantFocus, getLastDescendantFocus, getLayoutManager, getNextFocus, getPreviousFocus, remove, remove, removeAll, renderComponent, replace, setAlpha, setEnabled, setHoverable, setLayoutManager, validate
 
Methods inherited from class com.threerings.opengl.gui.Component
acceptsFocus, addListener, boundsToString, changeCursor, configUpdated, contains, createDefaultTooltipComponent, createDefaultTooltipComponent, createTooltipComponent, dispatchEvent, emitEvent, getAbsoluteX, getAbsoluteY, getAlpha, getBackground, getBorder, getBounds, getColor, getContext, getCursor, getFallbackState, getFocusTarget, getHeight, getInsets, getNextFocus, getParent, getPreferredSize, getPreviousFocus, getProperty, getState, getStateCount, getStatePseudoClass, getStyleConfigs, getTooltipText, getTooltipTimeout, getTooltipWindowStyle, getTransferHandler, getWidth, getWindow, getX, getY, hasFocus, intersectScissor, invalidate, isAdded, isEnabled, isHoverable, isShowing, isTooltipRelativeToMouse, isValid, isVisible, removeAllListeners, removeAllListeners, removeListener, render, renderBackground, renderBorder, requestFocus, scrollRectToVisible, scrollRectToVisible, setBackground, setBounds, setCursor, setLocation, setParent, setPreferredSize, setPreferredSize, setProperty, setSize, setStyleConfig, setStyleConfig, setStyleConfig, setStyleConfigs, setTooltipRelativeToMouse, setTooltipText, setTransferHandler, setVisible, stateDidChange, updateCursor, updateFromStyleConfig, updateFromStyleConfig
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_updater

protected ChangeListener _updater

_wellListener

protected MouseListener _wellListener

_thumbListener

protected MouseAdapter _thumbListener

_buttoner

protected ActionListener _buttoner

_model

protected BoundedRangeModel _model

_orient

protected int _orient

_less

protected Button _less

_more

protected Button _more

_well

protected Component _well

_thumb

protected Component _thumb

_wheelListener

protected MouseWheelListener _wheelListener
Constructor Detail

ScrollBar

public ScrollBar(GlContext ctx)
Creates a vertical scroll bar with the default range, value and extent.


ScrollBar

public ScrollBar(GlContext ctx,
                 int orientation)
Creates a scroll bar with the default range, value and extent.


ScrollBar

public ScrollBar(GlContext ctx,
                 int orientation,
                 int min,
                 int value,
                 int extent,
                 int max)
Creates a scroll bar with the specified orientation, range, value and extent.


ScrollBar

public ScrollBar(GlContext ctx,
                 int orientation,
                 BoundedRangeModel model)
Creates a scroll bar with the specified orientation which will interact with the supplied model.

Method Detail

getModel

public BoundedRangeModel getModel()
Returns a reference to the scrollbar's range model.


wasAdded

public void wasAdded()
Description copied from class: Component
This method is called when we are added to a hierarchy that is connected to a top-level window (at which point we can rely on having a look and feel and can set ourselves up).

Overrides:
wasAdded in class Container

wasRemoved

public void wasRemoved()
Description copied from class: Component
This method is called when we are removed from a hierarchy that is connected to a top-level window. If we wish to clean up after things done in Component.wasAdded(), this is a fine place to do so.

Overrides:
wasRemoved in class Container

getHitComponent

public Component getHitComponent(int mx,
                                 int my)
Description copied from class: Component
Returns the component "hit" by the specified mouse coordinates which might be this component or any of its children. This method should return null if the supplied mouse coordinates are outside the bounds of this component.

Overrides:
getHitComponent in class Container

update

protected void update()
Recomputes and repositions the scroll bar thumb to reflect the current configuration of the model.


getDefaultStyleConfig

protected String getDefaultStyleConfig()
Description copied from class: Component
Returns the name of the default config to be used for all instances of this component. Derived classes will likely want to override this method and set up a default config for their type of component.

Overrides:
getDefaultStyleConfig in class Container

layout

protected void layout()
Description copied from class: Component
Instructs this component to lay itself out. This is called as a result of the component changing size.

Overrides:
layout in class Container