public class UISelect<T> extends UIComponent<UISelect<T>> implements java.lang.Iterable<UISelect.Option<T>>, IClipable, IGuiText<UISelect<T>>
| Modifier and Type | Class and Description |
|---|---|
static class |
UISelect.Option<T>
The Class Option.
|
static class |
UISelect.SelectEvent<T>
Event fired when a
UISelect changes its selected UISelect.Option. |
ITransformable.Alpha, ITransformable.Brightness, ITransformable.Color, ITransformable.Position<T>, ITransformable.Rotate, ITransformable.Scale, ITransformable.Size<T>, ITransformable.Translate| Modifier and Type | Field and Description |
|---|---|
protected GuiIcon |
arrowIcon
Icon used to draw the arrow.
|
protected GuiShape |
arrowShape
Shape used to draw the arrow.
|
protected int |
bgColor
Background color
|
protected FontRenderOptions |
disabledFro
The
FontRenderOptions to use for this UISelect when option is disabled. |
protected com.google.common.base.Predicate<T> |
disablePredicate
Predicate for option disability
|
protected boolean |
expanded
Whether this
UISelect is expanded. |
protected MalisisFont |
font
The
MalisisFont to use for this UISelect. |
protected FontRenderOptions |
fro
The
FontRenderOptions to use for this UISelect. |
protected int |
hoverBgColor
Hovered background color
|
protected FontRenderOptions |
hoveredFro
The
FontRenderOptions to use for this UISelect when option is hovered. |
protected GuiIcon |
iconsExpanded
Icon used to draw the option container.
|
protected GuiIcon |
iconsSelect
Icon used to draw this
UISelect. |
protected GuiIcon |
iconsSelectDisabled
Icon used to draw this
UISelect when disabled. |
protected com.google.common.base.Function<T,java.lang.String> |
labelFunction
Function for options label
|
protected java.lang.String |
labelPattern
Pattern to use for options labels.
|
protected int |
maxDisplayedOptions
Max number displayed options.
|
protected int |
maxExpandedWidth
Max width of the option container.
|
protected GuiShape |
optionBackground
Shape used to draw the hovered
UISelect.Option background |
protected com.google.common.base.Function<T,? extends UISelect.Option<T>> |
optionFunction
Function for option creation
|
protected com.google.common.collect.FluentIterable<UISelect.Option<T>> |
options
|
protected int |
optionsHeight
Height of displayed
UISelect.Option box |
protected GuiShape |
optionsShape
Shape used to draw the
options box |
protected int |
optionsWidth
Width of displayed
UISelect.Option box |
protected FontRenderOptions |
selectedFro
The
FontRenderOptions to use for this UISelect when option is selected. |
protected UISelect.Option<T> |
selectedOption
Currently selected option index.
|
| Constructor and Description |
|---|
UISelect(MalisisGui gui,
int width)
Instantiates a new
UISelect. |
UISelect(MalisisGui gui,
int width,
java.lang.Iterable<T> values)
Instantiates a new
UISelect. |
| Modifier and Type | Method and Description |
|---|---|
void |
drawBackground(GuiRenderer renderer,
int mouseX,
int mouseY,
float partialTick)
Called first when drawing this
UIComponent. |
void |
drawForeground(GuiRenderer renderer,
int mouseX,
int mouseY,
float partialTick)
Called last when drawing this
UIComponent. |
int |
getBgColor() |
ClipArea |
getClipArea()
Gets
ClipArea to be used for glScissor |
FontRenderOptions |
getDisabledFontRendererOptions()
Gets the disabled
FontRenderOptions. |
MalisisFont |
getFont()
Gets the
MalisisFont used for this UILabel. |
FontRenderOptions |
getFontRendererOptions()
Gets the
FontRenderOptions used for this UILabel. |
int |
getHoverBgColor() |
FontRenderOptions |
getHoveredFontRendererOptions()
Gets the hovered
FontRenderOptions. |
UISelect.Option<T> |
getOption(T obj)
Gets the
UISelect.Option corresponding to the object. |
protected UISelect.Option<T> |
getOptionAt(int mouseX,
int mouseY)
Gets the
UISelect.Option at the speicfied coordinates. |
FontRenderOptions |
getSelectedFontRendererOptions()
Gets the selected
FontRenderOptions. |
UISelect.Option<T> |
getSelectedOption()
Gets the currently selected
UISelect.Option. |
T |
getSelectedValue()
Gets the value of the
selectedOption. |
int |
getZIndex()
Gets the zIndex of this
UIComponent. |
boolean |
isInsideBounds(int x,
int y)
Checks if supplied coordinates are inside this
UIComponent bounds. |
java.util.Iterator<UISelect.Option<T>> |
iterator() |
UISelect<T> |
maxDisplayedOptions(int amount)
Sets the maximum number of options displayed when expanded.
|
boolean |
onClick(int x,
int y)
On click.
|
boolean |
onKeyTyped(char keyChar,
int keyCode)
Called when a key is typed inside
MalisisGui. |
boolean |
onScrollWheel(int x,
int y,
int delta)
On scroll wheel.
|
T |
select(T obj)
Selects the
UISelect.Option for the specified value. |
T |
select(UISelect.Option<T> option)
Selects the
UISelect.Option. |
T |
selectFirst()
Selects the first
UISelect.Option of this UISelect. |
T |
selectLast()
Selects the last
UISelect.Option of this UISelect. |
T |
selectNext()
Select the
UISelect.Option after the currently selected one. |
T |
selectPrevious()
Selects the
UISelect.Option before the currently selected one. |
UISelect<T> |
setBgColor(int bgColor) |
void |
setClipContent(boolean clip)
Sets whether this
IClipable should clip or not. |
UISelect<T> |
setColors(int bgColor,
int hoverBgColor) |
UISelect<T> |
setDisabledFontRendererOptions(FontRenderOptions fro)
Sets the disabled
FontRenderOptions. |
UISelect<T> |
setDisablePredicate(com.google.common.base.Predicate<T> predicate) |
void |
setFocused(boolean focused)
Sets the
focused state of this UIComponent. |
UISelect<T> |
setFont(MalisisFont font,
FontRenderOptions fro)
|
UISelect<T> |
setHoverBgColor(int hoverBgColor) |
UISelect<T> |
setHoveredFontRendererOptions(FontRenderOptions fro)
Sets the hovered
FontRenderOptions. |
UISelect<T> |
setLabelFunction(com.google.common.base.Function<T,java.lang.String> func) |
UISelect<T> |
setLabelPattern(java.lang.String labelPattern)
Sets a pattern that will be used to format the option label.
|
UISelect<T> |
setMaxExpandedWidth(int width)
Sets the max width of the option container.
|
UISelect<T> |
setOptionFunction(com.google.common.base.Function<T,? extends UISelect.Option<T>> func) |
UISelect<T> |
setOptions(java.lang.Iterable<T> values)
|
UISelect<T> |
setSelectedFontRendererOptions(FontRenderOptions fro)
Sets the selected
FontRenderOptions. |
void |
setSelectedOption(T obj)
Sets the selected
UISelect.Option from its containing key. |
void |
setSelectedOption(UISelect.Option<T> option)
Sets the selected
UISelect.Option. |
boolean |
shouldClipContent()
Checks whether this
IClipable should clip or not. |
addControlComponent, componentX, componentY, draw, fireEvent, getAlpha, getAnchor, getComponentAt, getGui, getHeight, getName, getParent, getPropertyString, getRawHeight, getRawWidth, getRenderer, getTooltip, getWidth, getX, getY, isDisabled, isFocused, isHovered, isRelativeHeight, isRelativeWidth, isVisible, onAddedToScreen, onButtonPress, onButtonRelease, onDoubleClick, onDrag, onMouseMove, onRightClick, parentX, parentY, register, relativeX, relativeY, removeAllControlComponents, removeControlComponent, screenX, screenY, setAlpha, setAnchor, setDisabled, setHovered, setName, setParent, setPosition, setPosition, setSize, setTooltip, setTooltip, setVisible, setZIndex, toString, unregisterprotected MalisisFont font
protected FontRenderOptions fro
FontRenderOptions to use for this UISelect. If null, uses GuiRenderer.getDefaultFontRendererOptions().protected FontRenderOptions hoveredFro
FontRenderOptions to use for this UISelect when option is hovered.protected FontRenderOptions selectedFro
FontRenderOptions to use for this UISelect when option is selected.protected FontRenderOptions disabledFro
FontRenderOptions to use for this UISelect when option is disabled.protected com.google.common.collect.FluentIterable<UISelect.Option<T>> options
protected UISelect.Option<T> selectedOption
protected int maxExpandedWidth
protected int maxDisplayedOptions
protected boolean expanded
UISelect is expanded.protected int optionsWidth
UISelect.Option boxprotected int optionsHeight
UISelect.Option boxprotected java.lang.String labelPattern
protected com.google.common.base.Function<T,? extends UISelect.Option<T>> optionFunction
protected com.google.common.base.Function<T,java.lang.String> labelFunction
protected com.google.common.base.Predicate<T> disablePredicate
protected int bgColor
protected int hoverBgColor
protected GuiShape arrowShape
protected GuiShape optionBackground
UISelect.Option backgroundprotected GuiIcon iconsSelectDisabled
UISelect when disabled.protected GuiIcon iconsExpanded
protected GuiIcon arrowIcon
public UISelect(MalisisGui gui, int width, java.lang.Iterable<T> values)
UISelect.gui - the guiwidth - the widthvalues - the valuespublic UISelect(MalisisGui gui, int width)
UISelect.gui - the guiwidth - the widthpublic MalisisFont getFont()
MalisisFont used for this UILabel.public FontRenderOptions getFontRendererOptions()
FontRenderOptions used for this UILabel.getFontRendererOptions in interface IGuiText<UISelect<T>>public UISelect<T> setFont(MalisisFont font, FontRenderOptions fro)
public FontRenderOptions getHoveredFontRendererOptions()
FontRenderOptions.public UISelect<T> setSelectedFontRendererOptions(FontRenderOptions fro)
FontRenderOptions.fro - the froUISelectpublic FontRenderOptions getSelectedFontRendererOptions()
FontRenderOptions.public UISelect<T> setDisabledFontRendererOptions(FontRenderOptions fro)
FontRenderOptions.fro - the froUISelectpublic FontRenderOptions getDisabledFontRendererOptions()
FontRenderOptions.public UISelect<T> setHoveredFontRendererOptions(FontRenderOptions fro)
FontRenderOptions.fro - the froUISelectpublic int getBgColor()
public int getHoverBgColor()
public UISelect<T> setOptionFunction(com.google.common.base.Function<T,? extends UISelect.Option<T>> func)
public UISelect<T> setLabelFunction(com.google.common.base.Function<T,java.lang.String> func)
public UISelect<T> setDisablePredicate(com.google.common.base.Predicate<T> predicate)
public void setFocused(boolean focused)
UIComponentfocused state of this UIComponent.setFocused in class UIComponent<UISelect<T>>focused - the statepublic UISelect<T> setLabelPattern(java.lang.String labelPattern)
labelPattern - the label patternUISelectpublic UISelect<T> setMaxExpandedWidth(int width)
width - the widthUISelectpublic UISelect<T> maxDisplayedOptions(int amount)
amount - the amountUISelectpublic UISelect<T> setOptions(java.lang.Iterable<T> values)
values - the valuesUISelectpublic UISelect.Option<T> getOption(T obj)
UISelect.Option corresponding to the object.obj - the key of the Optionpublic void setSelectedOption(T obj)
UISelect.Option from its containing key.obj - the new selected optionpublic void setSelectedOption(UISelect.Option<T> option)
UISelect.Option.option - the new selected optionpublic UISelect.Option<T> getSelectedOption()
UISelect.Option.public T getSelectedValue()
selectedOption.public T select(UISelect.Option<T> option)
UISelect.Option.option - the optionpublic T select(T obj)
UISelect.Option for the specified value.obj - the objpublic T selectFirst()
UISelect.Option of this UISelect.public T selectLast()
UISelect.Option of this UISelect.public T selectPrevious()
UISelect.Option before the currently selected one.public T selectNext()
UISelect.Option after the currently selected one.protected UISelect.Option<T> getOptionAt(int mouseX, int mouseY)
UISelect.Option at the speicfied coordinates.mouseX - the mouse xmouseY - the mouse ypublic boolean isInsideBounds(int x,
int y)
UIComponentUIComponent bounds.isInsideBounds in class UIComponent<UISelect<T>>x - the xy - the ypublic int getZIndex()
UIComponentUIComponent.getZIndex in class UIComponent<UISelect<T>>public ClipArea getClipArea()
IClipableClipArea to be used for glScissorgetClipArea in interface IClipablepublic void setClipContent(boolean clip)
IClipableIClipable should clip or not.setClipContent in interface IClipableclip - the new clip contentpublic boolean shouldClipContent()
IClipableIClipable should clip or not.shouldClipContent in interface IClipablepublic void drawBackground(GuiRenderer renderer, int mouseX, int mouseY, float partialTick)
UIComponentUIComponent.drawBackground in class UIComponent<UISelect<T>>renderer - the renderermouseX - the mouse xmouseY - the mouse ypartialTick - the partial tickpublic void drawForeground(GuiRenderer renderer, int mouseX, int mouseY, float partialTick)
UIComponentUIComponent.drawForeground in class UIComponent<UISelect<T>>renderer - the renderermouseX - the mouse xmouseY - the mouse ypartialTick - the partial tickpublic boolean onClick(int x,
int y)
UIComponentonClick in class UIComponent<UISelect<T>>x - the xy - the ypublic boolean onScrollWheel(int x,
int y,
int delta)
UIComponentonScrollWheel in class UIComponent<UISelect<T>>x - the xy - the ydelta - the deltapublic boolean onKeyTyped(char keyChar,
int keyCode)
IKeyListenerMalisisGui.onKeyTyped in interface IKeyListeneronKeyTyped in class UIComponent<UISelect<T>>keyChar - the key charkeyCode - the key codepublic java.util.Iterator<UISelect.Option<T>> iterator()
iterator in interface java.lang.Iterable<UISelect.Option<T>>