public class ClickGUI extends java.lang.Object implements PanelManager
Modifier and Type | Class and Description |
---|---|
protected static interface |
ClickGUI.LoopFunction
Interface used by
doComponentLoop(LoopFunction) . |
Modifier and Type | Field and Description |
---|---|
protected java.util.List<FixedComponent> |
components
List of direct child components (i.e. panels).
|
protected DescriptionRenderer |
descriptionRenderer
The
DescriptionRenderer to be used by the GUI. |
protected Interface |
inter
The
Interface to be used by the GUI. |
protected java.util.List<FixedComponent> |
permanentComponents
List of permanent components.
|
Constructor and Description |
---|
ClickGUI(Interface inter,
DescriptionRenderer descriptionRenderer)
Constructor for the GUI.
|
Modifier and Type | Method and Description |
---|---|
void |
addComponent(FixedComponent component)
Add a component to the GUI.
|
protected void |
doComponentLoop(ClickGUI.LoopFunction function)
Loop through all components in reverse order and check for focus requests.
|
void |
enter()
Handle the GUI being opened.
|
void |
exit()
Handle the GUI being closed.
|
java.util.List<FixedComponent> |
getComponents()
Get a list of panels in the GUI.
|
Toggleable |
getComponentToggleable(FixedComponent component)
Get toggleable indicating whether a component is shown or not.
|
protected Context |
getContext(FixedComponent component,
boolean highest)
Create a context for a component.
|
void |
handleButton(int button)
Handle a mouse button state change.
|
void |
handleKey(int scancode)
Handle a key being typed.
|
void |
handleScroll(int diff)
Handle the mouse wheel being scrolled
|
void |
hideComponent(FixedComponent component)
Hide a component.
|
void |
loadConfig(ConfigList config)
Load the GUI state.
|
void |
render()
Render the GUI (lowest component first, highest component last).
|
void |
saveConfig(ConfigList config)
Store the GUI state.
|
void |
showComponent(FixedComponent component)
Add a component to be visible.
|
protected java.util.List<FixedComponent> components
FixedComponent
.protected java.util.List<FixedComponent> permanentComponents
protected DescriptionRenderer descriptionRenderer
DescriptionRenderer
to be used by the GUI.public ClickGUI(Interface inter, DescriptionRenderer descriptionRenderer)
inter
- the Interface
to be used by the GUIdescriptionRenderer
- the DescriptionRenderer
used by the GUIpublic java.util.List<FixedComponent> getComponents()
public void addComponent(FixedComponent component)
component
- component to be addedpublic void showComponent(FixedComponent component)
PanelManager
showComponent
in interface PanelManager
component
- the component to be added.public void hideComponent(FixedComponent component)
PanelManager
hideComponent
in interface PanelManager
component
- the component to be removed.public void render()
public void handleButton(int button)
button
- the button that changed its stateInterface.LBUTTON
,
Interface.RBUTTON
public void handleKey(int scancode)
scancode
- the scancode of the key being typedpublic void handleScroll(int diff)
diff
- the amount by which the wheel was movedpublic void enter()
public void exit()
public void saveConfig(ConfigList config)
config
- the configuration list to be usedpublic void loadConfig(ConfigList config)
config
- the configuration list to be usedprotected Context getContext(FixedComponent component, boolean highest)
component
- the componenthighest
- whether this component is on toppublic Toggleable getComponentToggleable(FixedComponent component)
PanelManager
getComponentToggleable
in interface PanelManager
component
- the component in questionprotected void doComponentLoop(ClickGUI.LoopFunction function)
function
- the function to execute in the loop