|
|||||||||
| 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.TextComponent
com.threerings.opengl.gui.Label
com.threerings.opengl.gui.Button
com.threerings.opengl.gui.ToggleButton
public class ToggleButton
Like a Button except that it toggles between two states
(selected and normal) when clicked.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class com.threerings.opengl.gui.Label |
|---|
Label.Fit |
| Field Summary | |
|---|---|
protected boolean |
_selected
Used to track whether we are selected or not. |
static int |
DISSELECTED
Indicates that this button is in the selected state and is disabled. |
static int |
HOVER_SELECTED
Indicates that this button is in the selected state and hovered. |
static int |
SELECTED
Indicates that this button is in the selected state. |
protected static int |
STATE_COUNT
|
protected static String[] |
STATE_PCLASSES
|
| Fields inherited from class com.threerings.opengl.gui.Button |
|---|
_action, _argument, _feedbackSounds, _pressed, _releasedWhen, DOWN |
| Fields inherited from class com.threerings.opengl.gui.Label |
|---|
_label |
| Fields inherited from class com.threerings.opengl.gui.TextComponent |
|---|
_effcols, _effsizes, _haligns, _lineSpacings, _teffects, _textfacts, _valigns |
| 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 |
| 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 | |
|---|---|
ToggleButton(GlContext ctx,
Icon icon,
String action)
Creates a button with the specified icon and action. |
|
ToggleButton(GlContext ctx,
String text)
Creates a button with the specified textual label. |
|
ToggleButton(GlContext ctx,
String text,
String action)
Creates a button with the specified label and action. |
|
| Method Summary | |
|---|---|
protected void |
fireAction(long when,
int modifiers)
Called when the button is "clicked" which may due to the mouse being pressed and released while over the button or due to keyboard manipulation while the button has focus. |
protected int |
getFallbackState(int state)
Returns the fallback to use for the specified state if no explicit style was given. |
int |
getState()
Returns the state of this component, either Component.DEFAULT or Component.DISABLED. |
protected int |
getStateCount()
Returns the number of different states that this component can take. |
protected String |
getStatePseudoClass(int state)
Returns the pseudoclass identifier for the specified component state. |
boolean |
isSelected()
Returns whether or not this button is in the selected state. |
void |
setSelected(boolean selected)
Configures the selected state of this button. |
| Methods inherited from class com.threerings.opengl.gui.Button |
|---|
dispatchEvent, doClick, getAction, getArgument, getDefaultStyleConfig, getFeedbackSound, playFeedbackSound, setAction, setArgument, updateFromStyleConfig |
| Methods inherited from class com.threerings.opengl.gui.Label |
|---|
computePreferredSize, getFit, getIcon, getIconTextGap, getLabelRenderer, getText, layout, renderComponent, setFit, setIcon, setIconTextGap, setOrientation, setPreferredWidth, setText, setTextRotation |
| Methods inherited from class com.threerings.opengl.gui.TextComponent |
|---|
getEffectColor, getEffectSize, getHorizontalAlignment, getLabelRendererConfig, getLineSpacing, getTextEffect, getTextFactory, getTextFactory, getVerticalAlignment |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int SELECTED
public static final int HOVER_SELECTED
public static final int DISSELECTED
protected boolean _selected
protected static final int STATE_COUNT
protected static final String[] STATE_PCLASSES
| Constructor Detail |
|---|
public ToggleButton(GlContext ctx,
String text)
public ToggleButton(GlContext ctx,
String text,
String action)
ActionEvent when the button
changes state.
public ToggleButton(GlContext ctx,
Icon icon,
String action)
ActionEvent when the button
changes state.
| Method Detail |
|---|
public boolean isSelected()
public void setSelected(boolean selected)
public int getState()
ComponentComponent.DEFAULT or Component.DISABLED.
getState in class Buttonprotected int getStateCount()
Component
getStateCount in class Buttonprotected String getStatePseudoClass(int state)
ComponentComponent.DISABLED state maps to disabled and is configured like so:
component:disabled {
color: #CCCCCC; // etc.
}
getStatePseudoClass in class Buttonprotected int getFallbackState(int state)
Component
getFallbackState in class Component
protected void fireAction(long when,
int modifiers)
Button
fireAction in class Button
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||