|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.threerings.opengl.gui.Component
com.threerings.opengl.gui.Container
public class Container
A user interface element that is meant to contain other interface elements.
| Nested Class Summary | |
|---|---|
protected static interface |
Container.ChildOp
Used in wasAdded() and wasRemoved(). |
| Field Summary | |
|---|---|
protected ArrayList<Component> |
_children
|
protected LayoutManager |
_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 | |
|---|---|
Container(GlContext ctx)
Creates a container with no layout manager. |
|
Container(GlContext ctx,
LayoutManager layout)
Creates a container with the supplied layout manager. |
|
| Method Summary | |
|---|---|
void |
add(Component child)
Adds a child to this container. |
void |
add(Component child,
Object constraints)
Adds a child to this container with the specified layout constraints. |
void |
add(int index,
Component child)
Adds a child to this container at the specified position. |
void |
add(int index,
Component child,
Object constraints)
Adds a child to this container at the specified position, with the specified layout constraints. |
protected void |
applyOperation(Container.ChildOp op)
Applies an operation to all of our children. |
protected Dimension |
computePreferredSize(int whint,
int hhint)
Computes and returns a preferred size for this component. |
Component |
getComponent(int index)
Returns the indexth component from this container. |
int |
getComponentCount()
Returns the number of components contained in this container. |
int |
getComponentIndex(Component component)
Returns the index of the specified component in this container or -1 if the component count not be found. |
protected String |
getDefaultStyleConfig()
Returns the name of the default config to be used for all instances of this component. |
protected Component |
getFirstDescendantFocus()
Returns the first descendant of this component that accepts the keyboard focus (including the component itself), or null if no descendants accept it. |
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. |
protected Component |
getLastDescendantFocus()
Returns the last descendant of this component that accepts the keyboard focus (including the component itself), or null if no descendants accept it. |
LayoutManager |
getLayoutManager()
Returns the layout manager configured for this container. |
protected Component |
getNextFocus(Component current)
Returns the next component that should receive focus in this container given the current focus owner. |
protected Component |
getPreviousFocus(Component current)
Returns the previous component that should receive focus in this container given the current focus owner. |
protected void |
layout()
Instructs this component to lay itself out. |
void |
remove(Component child)
Removes the specified child from this container. |
void |
remove(int index)
Removes the child at a specific position from this container. |
void |
removeAll()
Removes all children of this container. |
protected void |
renderComponent(Renderer renderer)
Renders any custom bits for this component. |
boolean |
replace(Component oldc,
Component newc)
Replaces a given old component with a new component (if the old component exits). |
void |
setAlpha(float alpha)
Sets the alpha level for this component. |
void |
setEnabled(boolean enabled)
Sets this components enabled state. |
void |
setHoverable(boolean hoverable)
Sets this component's hoverability state. |
void |
setLayoutManager(LayoutManager layout)
Configures this container with an entity that will set the size and position of its children. |
void |
validate()
Instructs this component to lay itself out and then mark itself as valid. |
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 java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected ArrayList<Component> _children
protected LayoutManager _layout
| Constructor Detail |
|---|
public Container(GlContext ctx)
setLayoutManager(com.threerings.opengl.gui.layout.LayoutManager).
public Container(GlContext ctx,
LayoutManager layout)
| Method Detail |
|---|
public void setLayoutManager(LayoutManager layout)
public LayoutManager getLayoutManager()
public void add(Component child)
public void add(int index,
Component child)
public void add(Component child,
Object constraints)
public void add(int index,
Component child,
Object constraints)
public void remove(int index)
public boolean replace(Component oldc,
Component newc)
public void remove(Component child)
public int getComponentCount()
public Component getComponent(int index)
indexth component from this container.
public int getComponentIndex(Component component)
public void removeAll()
public void setAlpha(float alpha)
Component
setAlpha in class Componentpublic void setEnabled(boolean enabled)
Component
setEnabled in class Componentpublic void setHoverable(boolean hoverable)
Component
setHoverable in class Component
public Component getHitComponent(int mx,
int my)
Component
getHitComponent in class Componentpublic void validate()
Component
validate in class Componentprotected String getDefaultStyleConfig()
Component
getDefaultStyleConfig in class Componentprotected void layout()
Component
layout in class Componentprotected void renderComponent(Renderer renderer)
Component
renderComponent in class Component
protected Dimension computePreferredSize(int whint,
int hhint)
Component
computePreferredSize in class Componentprotected void wasAdded()
Component
wasAdded in class Componentprotected void wasRemoved()
ComponentComponent.wasAdded(), this is a fine place
to do so.
wasRemoved in class Componentprotected Component getNextFocus(Component current)
Component.getNextFocus() to search further up the hierarchy.
protected Component getPreviousFocus(Component current)
Component.getPreviousFocus() to search further up the hierarchy.
protected Component getFirstDescendantFocus()
Componentnull if no descendants accept it.
getFirstDescendantFocus in class Componentprotected Component getLastDescendantFocus()
Componentnull if no descendants accept it.
getLastDescendantFocus in class Componentprotected void applyOperation(Container.ChildOp op)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||