public class UISelect<T> extends UIComponent<UISelect<T>> implements java.lang.Iterable<UISelect.Option<T>>, IClipable, IGuiText<UISelect<T>>, IScrollable
| 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 GuiIconProvider |
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 GuiIconProvider |
iconsExpanded
Icon used to draw the option container.
|
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 int |
optionOffset |
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 UISlimScrollbar |
scrollbar |
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 |
int |
getContentHeight()
Gets the height of the scrollable content.
|
int |
getContentWidth()
Gets the width of the scrollable content.
|
FontRenderOptions |
getDisabledFontRendererOptions()
Gets the disabled
FontRenderOptions. |
MalisisFont |
getFont()
Gets the
MalisisFont. |
FontRenderOptions |
getFontRenderOptions()
Gets the
FontRenderOptions. |
int |
getHeight()
Gets the height of this
UIComponent. |
int |
getHorizontalPadding()
Gets the horizontal padding.
|
int |
getHoverBgColor() |
FontRenderOptions |
getHoveredFontRendererOptions()
Gets the hovered
FontRenderOptions. |
float |
getOffsetX()
Gets the offset from 0 to 1 of the scrollable content.
|
float |
getOffsetY()
Gets the offset from 0 to 1 of the scrollable content.
|
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. |
float |
getScrollStep()
Gets the amount of scrolling from 0 to 1, done by one step of the scroll wheel.
|
FontRenderOptions |
getSelectedFontRendererOptions()
Gets the selected
FontRenderOptions. |
protected int |
getSelectedIndex() |
UISelect.Option<T> |
getSelectedOption()
Gets the currently selected
UISelect.Option. |
T |
getSelectedValue()
Gets the value of the
selectedOption. |
int |
getVerticalPadding()
Gets the vertical padding.
|
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)
Sets the
MalisisFont. |
UISelect<T> |
setFontRenderOptions(FontRenderOptions fro)
Sets the
FontRenderOptions. |
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.
|
void |
setOffsetX(float offsetX,
int delta)
Sets the offset from 0 to 1 of the scrollable content.
|
void |
setOffsetY(float offsetY,
int delta)
Sets the offset from 0 to 1 of the scrollable content.
|
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, attachData, componentX, componentY, draw, fireEvent, getAlpha, getAnchor, getComponentAt, getData, getGui, getIconProvider, 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, self, setAlpha, setAnchor, setDisabled, setHovered, setName, setParent, setPosition, setPosition, setSize, setTooltip, setTooltip, setVisible, setZIndex, toString, unregisterprotected MalisisFont font
MalisisFont to use for this UISelect.protected FontRenderOptions fro
FontRenderOptions to use for this UISelect.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 UISlimScrollbar scrollbar
protected int optionOffset
protected int bgColor
protected int hoverBgColor
protected GuiShape arrowShape
protected GuiShape optionBackground
UISelect.Option backgroundprotected GuiIconProvider iconsExpanded
protected GuiIconProvider 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 int getHeight()
UIComponentUIComponent.public MalisisFont getFont()
IGuiTextMalisisFont.public UISelect<T> setFont(MalisisFont font)
IGuiTextMalisisFont.public FontRenderOptions getFontRenderOptions()
IGuiTextFontRenderOptions.getFontRenderOptions in interface IGuiText<UISelect<T>>public UISelect<T> setFontRenderOptions(FontRenderOptions fro)
IGuiTextFontRenderOptions.setFontRenderOptions in interface IGuiText<UISelect<T>>fro - the fropublic 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 yprotected int getSelectedIndex()
public 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 int getContentHeight()
IScrollablegetContentHeight in interface IScrollablepublic int getContentWidth()
IScrollablegetContentWidth in interface IScrollablepublic float getOffsetX()
IScrollableUIScrollBar.Type.HORIZONTAL scrollbars.getOffsetX in interface IScrollablepublic void setOffsetX(float offsetX,
int delta)
IScrollableUIScrollBar.Type.HORIZONTAL scrollbars.UIScrollBar.Type.VERTICAL scrollbar if available.setOffsetX in interface IScrollableoffsetX - the offset xdelta - the deltapublic float getOffsetY()
IScrollableUIScrollBar.Type.VERTICAL scrollbars.getOffsetY in interface IScrollablepublic void setOffsetY(float offsetY,
int delta)
IScrollableUIScrollBar.Type.VERTICAL scrollbars.UIScrollBar.Type.HORIZONTAL scrollbar if available.setOffsetY in interface IScrollableoffsetY - the offset ydelta - the deltapublic float getScrollStep()
IScrollablegetScrollStep in interface IScrollablepublic int getVerticalPadding()
IScrollablegetVerticalPadding in interface IScrollablepublic int getHorizontalPadding()
IScrollablegetHorizontalPadding in interface IScrollablepublic 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>>