com.threerings.opengl.gui
Class ScrollPane.Viewport

java.lang.Object
  extended by com.threerings.opengl.gui.Component
      extended by com.threerings.opengl.gui.Container
          extended by com.threerings.opengl.gui.ScrollPane.Viewport
All Implemented Interfaces:
ConfigUpdateListener<ManagedConfig>
Enclosing class:
ScrollPane

protected static class ScrollPane.Viewport
extends Container

Does all the heavy lifting for the ScrollPane.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.threerings.opengl.gui.Container
Container.ChildOp
 
Field Summary
protected  BoundedRangeModel _hmodel
           
protected  int _oldH
           
protected  int _oldV
           
protected  Rectangle _srect
           
protected  Component _target
           
protected  BoundedRangeModel _vmodel
           
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
 
Constructor Summary
ScrollPane.Viewport(GlContext ctx, Component target, boolean vert, boolean horiz, int snap)
           
 
Method Summary
protected  Dimension computePreferredSize(int whint, int hhint)
          Computes and returns a preferred size for this component.
 int getAbsoluteX()
          Returns the x position of this component in absolute screen coordinates.
 int getAbsoluteY()
          Returns the y position of this component in absolute screen coordinates.
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 getHModel()
          Returns the range model defined by this viewport's size and the preferred size of its target component.
 Component getTarget()
          Returns a reference to the target of this viewport.
 BoundedRangeModel getVModel()
          Returns the range model defined by this viewport's size and the preferred size of its target component.
protected  int getXOffset()
           
protected  int getYOffset()
           
 void layout()
          Instructs this component to lay itself out.
protected  int positionAdjustment(int parentExtent, int childExtent, int childPos)
          Helper for scrollRectToVisible, pretty much copied from JViewport.java.
protected  void renderComponent(Renderer renderer)
          Renders any custom bits for this component.
 void scrollRectToVisible(int x, int y, int w, int h)
          Request to have the specified rectangle, in this component's coordinate space, scrolled into view.
 void storeOldH()
          Stores our current horizontal bound value.
 void storeOldV()
          Stores our current vertical bound value.
protected  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).
protected  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, getComponent, getComponentCount, getComponentIndex, getFirstDescendantFocus, getLastDescendantFocus, getLayoutManager, getNextFocus, getPreviousFocus, remove, remove, removeAll, 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, 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, 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

_vmodel

protected BoundedRangeModel _vmodel

_hmodel

protected BoundedRangeModel _hmodel

_target

protected Component _target

_wheelListener

protected MouseWheelListener _wheelListener

_srect

protected Rectangle _srect

_oldV

protected int _oldV

_oldH

protected int _oldH
Constructor Detail

ScrollPane.Viewport

public ScrollPane.Viewport(GlContext ctx,
                           Component target,
                           boolean vert,
                           boolean horiz,
                           int snap)
Method Detail

getTarget

public Component getTarget()
Returns a reference to the target of this viewport.


getVModel

public BoundedRangeModel getVModel()
Returns the range model defined by this viewport's size and the preferred size of its target component.


getHModel

public BoundedRangeModel getHModel()
Returns the range model defined by this viewport's size and the preferred size of its target component.


storeOldV

public void storeOldV()
Stores our current vertical bound value.


storeOldH

public void storeOldH()
Stores our current horizontal bound value.


layout

public 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

getAbsoluteX

public int getAbsoluteX()
Description copied from class: Component
Returns the x position of this component in absolute screen coordinates.

Overrides:
getAbsoluteX in class Component

getAbsoluteY

public int getAbsoluteY()
Description copied from class: Component
Returns the y position of this component in absolute screen coordinates.

Overrides:
getAbsoluteY in class Component

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

scrollRectToVisible

public void scrollRectToVisible(int x,
                                int y,
                                int w,
                                int h)
Description copied from class: Component
Request to have the specified rectangle, in this component's coordinate space, scrolled into view. This request will be repeatedly forwarded to parent containers until one can handle the request. If no ScrollPane's viewport contains this component then this request is unlikely to do anything.

Overrides:
scrollRectToVisible in class Component

positionAdjustment

protected int positionAdjustment(int parentExtent,
                                 int childExtent,
                                 int childPos)
Helper for scrollRectToVisible, pretty much copied from JViewport.java.


wasAdded

protected 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

protected 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

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

computePreferredSize

protected Dimension computePreferredSize(int whint,
                                         int hhint)
Description copied from class: Component
Computes and returns a preferred size for this component. This method is called if no overriding preferred size has been supplied.

Overrides:
computePreferredSize in class Container
Returns:
the computed preferred size of this component in a newly created Dimension instance which will be adopted (and modified) by the caller.

renderComponent

protected void renderComponent(Renderer renderer)
Description copied from class: Component
Renders any custom bits for this component. This is called with the graphics context translated to (0, 0) relative to this component.

Overrides:
renderComponent in class Container

getYOffset

protected final int getYOffset()

getXOffset

protected final int getXOffset()