Search in sources :

Example 11 with IWidget

use of binnie.core.api.gui.IWidget in project Binnie by ForestryMC.

the class TopLevelWidget method getQueuedWidgets.

private Collection<IWidget> getQueuedWidgets(final IWidget widget) {
    List<IWidget> widgets = new ArrayList<>();
    boolean addChildren = true;
    IArea croppedZone = widget.getCroppedZone();
    if (croppedZone != null) {
        addChildren = croppedZone.contains(widget.getCropWidget().getRelativeMousePosition());
    }
    if (addChildren) {
        ListIterator<IWidget> iterator = widget.getChildren().listIterator(widget.getChildren().size());
        while (iterator.hasPrevious()) {
            final IWidget child = iterator.previous();
            widgets.addAll(this.getQueuedWidgets(child));
        }
    }
    widgets.add(widget);
    return widgets;
}
Also used : IArea(binnie.core.api.gui.IArea) ArrayList(java.util.ArrayList) IWidget(binnie.core.api.gui.IWidget)

Example 12 with IWidget

use of binnie.core.api.gui.IWidget in project Binnie by ForestryMC.

the class ControlList method setOptions.

public void setOptions(final Collection<T> options) {
    this.deleteAllChildren();
    this.allOptions.clear();
    for (final T option : options) {
        final IWidget optionWidget = this.parent.createOption(option, 0);
        this.allOptions.put(option, optionWidget);
    }
    this.filterOptions();
}
Also used : IWidget(binnie.core.api.gui.IWidget)

Example 13 with IWidget

use of binnie.core.api.gui.IWidget in project Binnie by ForestryMC.

the class TextureRenderer method preRender.

public final void preRender(final IWidget widget, int guiWidth, int guiHeight) {
    GlStateManager.pushMatrix();
    GlStateManager.translate(widget.getPosition().xPos(), widget.getPosition().yPos(), 0.0f);
    RenderUtil.setColour(widget.getColor());
    if (widget.isCroppedWidet()) {
        final IWidget cropRelative = (widget.getCropWidget() != null) ? widget.getCropWidget() : widget;
        final IPoint pos = cropRelative.getAbsolutePosition();
        final IArea cropZone = widget.getCroppedZone();
        GL11.glEnable(GL11.GL_SCISSOR_TEST);
        this.limitArea(new Area(pos.add(cropZone.pos()), cropZone.size()), guiWidth, guiHeight);
    }
    GlStateManager.disableDepth();
}
Also used : Area(binnie.core.gui.geometry.Area) IArea(binnie.core.api.gui.IArea) IArea(binnie.core.api.gui.IArea) IPoint(binnie.core.api.gui.IPoint) IWidget(binnie.core.api.gui.IWidget)

Example 14 with IWidget

use of binnie.core.api.gui.IWidget in project Binnie by ForestryMC.

the class GuiCraftGUI method mouseClicked.

@Override
protected void mouseClicked(final int x, final int y, final int button) {
    IWidget origin = this.window;
    if (this.window.getMousedOverWidget() != null) {
        origin = this.window.getMousedOverWidget();
    }
    this.window.callEvent(new EventMouse.Down(origin, x, y, button));
}
Also used : EventMouse(binnie.core.gui.events.EventMouse) IWidget(binnie.core.api.gui.IWidget)

Aggregations

IWidget (binnie.core.api.gui.IWidget)14 IPoint (binnie.core.api.gui.IPoint)4 Point (binnie.core.gui.geometry.Point)3 IArea (binnie.core.api.gui.IArea)2 ArrayList (java.util.ArrayList)2 Map (java.util.Map)2 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)2 IBreedingSystem (binnie.core.api.genetics.IBreedingSystem)1 Alignment (binnie.core.api.gui.Alignment)1 EventHandlerOrigin (binnie.core.api.gui.events.EventHandlerOrigin)1 ControlTextCentered (binnie.core.gui.controls.ControlTextCentered)1 ControlTextEdit (binnie.core.gui.controls.ControlTextEdit)1 ControlListBox (binnie.core.gui.controls.listbox.ControlListBox)1 ControlTextOption (binnie.core.gui.controls.listbox.ControlTextOption)1 ControlPage (binnie.core.gui.controls.page.ControlPage)1 ControlPages (binnie.core.gui.controls.page.ControlPages)1 ControlTab (binnie.core.gui.controls.tab.ControlTab)1 ControlTabBar (binnie.core.gui.controls.tab.ControlTabBar)1 EventKey (binnie.core.gui.events.EventKey)1 EventMouse (binnie.core.gui.events.EventMouse)1