public class UISelect extends UIComponent<UISelect> implements java.lang.Iterable<UISelect.Option>, IClipable
| Modifier and Type | Class and Description |
|---|---|
static class |
UISelect.Option<T>
The Class Option.
|
static class |
UISelect.SelectEvent
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 boolean |
expanded
Whether this
UISelect is expanded. |
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 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 java.util.HashMap<java.lang.Integer,UISelect.Option> |
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 int |
selectedOption
Currently selected option index.
|
| Constructor and Description |
|---|
UISelect(MalisisGui gui,
int width)
Instantiates a new
UISelect. |
UISelect(MalisisGui gui,
int width,
java.util.HashMap<java.lang.Integer,UISelect.Option> options)
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. |
ClipArea |
getClipArea()
Gets
ClipArea to be used for glScissor |
protected UISelect.Option |
getHoveredOption(int mouseX,
int mouseY) |
UISelect.Option |
getOption(java.lang.Object obj)
Gets the
UISelect.Option corresponding to the object. |
UISelect.Option |
getSelectedOption()
Gets the currently selected
UISelect.Option. |
int |
getZIndex()
Gets the zIndex of this
UIComponent. |
boolean |
isInsideBounds(int x,
int y)
Checks if supplied coordinates are inside this
UIComponent bounds. |
boolean |
isOptionHovered(UISelect.Option option) |
java.util.Iterator<UISelect.Option> |
iterator() |
UISelect |
maxDisplayedOptions(int amount)
Sets the maximum number of options displayed when expanded.
|
void |
onClick(MouseEvent.Release event)
On click.
|
void |
onKeyTyped(KeyboardEvent event)
On key typed.
|
void |
onScrollWheel(MouseEvent.ScrollWheel event)
On scroll wheel.
|
UISelect.Option |
select(int index)
Select the
UISelect.Option using the index. |
UISelect.Option |
select(java.lang.Object obj)
Select the
UISelect.Option corresponding to the object. |
UISelect.Option |
select(UISelect.Option option) |
void |
setClipContent(boolean clip)
Sets whether this
IClipable should clip or not. |
void |
setFocused(boolean focused)
Sets the
focused state of this UIComponent. |
UISelect |
setLabelPattern(java.lang.String labelPattern)
Sets a pattern that will be used to format the option label.
|
UISelect |
setMaxExpandedWidth(int width)
Sets the max width of the option container.
|
UISelect |
setOptions(java.util.HashMap<java.lang.Integer,UISelect.Option> options)
|
void |
setSelectedOption(int index)
Sets the selected
UISelect.Option from its position in the list. |
void |
setSelectedOption(java.lang.Object obj)
Sets the selected
UISelect.Option from its containing key. |
boolean |
shouldClipContent()
Checks whether this
IClipable should clip or not. |
addControlComponent, componentX, componentY, draw, fireEvent, fireKeyboardEvent, fireMouseEvent, getAlpha, getAnchor, getComponentAt, getGui, getHeight, getName, getParent, getPropertyString, getRawHeight, getRawWidth, getTooltip, getWidth, getX, getY, isDisabled, isFocused, isHovered, isRelativeHeight, isRelativeWidth, isVisible, onAddedToScreen, parentX, parentY, register, relativeX, relativeY, removeAllControlComponents, removeControlComponent, screenX, screenY, setAlpha, setAnchor, setDisabled, setHovered, setName, setParent, setPosition, setPosition, setSize, setTooltip, setTooltip, setVisible, setZIndex, toString, unregisterprotected java.util.HashMap<java.lang.Integer,UISelect.Option> options
protected int 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 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.util.HashMap<java.lang.Integer,UISelect.Option> options)
UISelectgui - the guiwidth - the widthoptions - the optionspublic UISelect(MalisisGui gui, int width)
UISelect.gui - the guiwidth - the widthpublic void setFocused(boolean focused)
UIComponentfocused state of this UIComponent.setFocused in class UIComponent<UISelect>focused - the statepublic UISelect setLabelPattern(java.lang.String labelPattern)
labelPattern - the label patternUISelectpublic UISelect setMaxExpandedWidth(int width)
width - the widthUISelectpublic UISelect maxDisplayedOptions(int amount)
amount - the amountUISelectpublic UISelect setOptions(java.util.HashMap<java.lang.Integer,UISelect.Option> options)
options - the optionsUISelectpublic void setSelectedOption(int index)
UISelect.Option from its position in the list.index - the new selected optionpublic void setSelectedOption(java.lang.Object obj)
UISelect.Option from its containing key.obj - the new selected optionpublic UISelect.Option getOption(java.lang.Object obj)
UISelect.Option corresponding to the object.obj - the key of the Optionpublic UISelect.Option getSelectedOption()
UISelect.Option.public UISelect.Option select(int index)
UISelect.Option using the index.index - the indexpublic UISelect.Option select(UISelect.Option option)
public UISelect.Option select(java.lang.Object obj)
UISelect.Option corresponding to the object.obj - the objprotected UISelect.Option getHoveredOption(int mouseX, int mouseY)
public boolean isInsideBounds(int x,
int y)
UIComponentUIComponent bounds.isInsideBounds in class UIComponent<UISelect>x - the xy - the ypublic int getZIndex()
UIComponentUIComponent.getZIndex in class UIComponent<UISelect>public boolean isOptionHovered(UISelect.Option option)
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>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>renderer - the renderermouseX - the mouse xmouseY - the mouse ypartialTick - the partial tickpublic void onClick(MouseEvent.Release event)
event - the eventpublic void onScrollWheel(MouseEvent.ScrollWheel event)
event - the eventpublic void onKeyTyped(KeyboardEvent event)
event - the eventpublic java.util.Iterator<UISelect.Option> iterator()
iterator in interface java.lang.Iterable<UISelect.Option>