Add status indicators
Allow removal of elements from gui containers
This commit is contained in:
@@ -40,6 +40,13 @@ public class GuiReplayOverlay extends AbstractGuiOverlay<GuiReplayOverlay> {
|
|||||||
}
|
}
|
||||||
}.setSize(Integer.MAX_VALUE, 20);
|
}.setSize(Integer.MAX_VALUE, 20);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is not used by the replay module itself but may be used by other modules/extras to show
|
||||||
|
* when they're active.
|
||||||
|
*/
|
||||||
|
public final GuiPanel statusIndicatorPanel = new GuiPanel(this).setSize(100, 20)
|
||||||
|
.setLayout(new HorizontalLayout(HorizontalLayout.Alignment.RIGHT).setSpacing(5));
|
||||||
|
|
||||||
public GuiReplayOverlay(final ReplayHandler replayHandler) {
|
public GuiReplayOverlay(final ReplayHandler replayHandler) {
|
||||||
this.replayHandler = replayHandler;
|
this.replayHandler = replayHandler;
|
||||||
|
|
||||||
@@ -49,6 +56,9 @@ public class GuiReplayOverlay extends AbstractGuiOverlay<GuiReplayOverlay> {
|
|||||||
protected void layout(GuiReplayOverlay container, int width, int height) {
|
protected void layout(GuiReplayOverlay container, int width, int height) {
|
||||||
pos(topPanel, 10, 10);
|
pos(topPanel, 10, 10);
|
||||||
size(topPanel, width - 20, 20);
|
size(topPanel, width - 20, 20);
|
||||||
|
|
||||||
|
pos(statusIndicatorPanel, width / 2, height - 25);
|
||||||
|
width(statusIndicatorPanel, width / 2 - 5);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -107,6 +107,14 @@ public abstract class AbstractGuiContainer<T extends AbstractGuiContainer<T>>
|
|||||||
return getThis();
|
return getThis();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public T removeElement(GuiElement element) {
|
||||||
|
if (elements.remove(element) != null) {
|
||||||
|
layedOutElements.remove(element);
|
||||||
|
}
|
||||||
|
return getThis();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(GuiRenderer renderer, ReadableDimension size, RenderInfo renderInfo) {
|
public void draw(GuiRenderer renderer, ReadableDimension size, RenderInfo renderInfo) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -39,5 +39,6 @@ public interface GuiContainer<T extends GuiContainer<T>> extends ComposedGuiElem
|
|||||||
|
|
||||||
Map<GuiElement, LayoutData> getElements();
|
Map<GuiElement, LayoutData> getElements();
|
||||||
T addElements(LayoutData layoutData, GuiElement...elements);
|
T addElements(LayoutData layoutData, GuiElement...elements);
|
||||||
|
T removeElement(GuiElement element);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user