Search in sources :

Example 1 with Fragment

use of me.ichun.mods.ichunutil.client.gui.bns.window.Fragment in project iChunUtil by iChun.

the class ElementFertile method getMinWidth.

@Override
public int getMinWidth() {
    int min = 0;
    for (IGuiEventListener child : getEventListeners()) {
        if (child instanceof Fragment<?>) {
            Fragment<?> fragment = (Fragment<?>) child;
            int fragWidth = getConstraintSensitiveMinWidth(fragment);
            if (fragWidth > min) {
                min = fragWidth;
            }
        }
    }
    return min > 0 ? min + (getBorderSize() * 2) : 4;
}
Also used : IGuiEventListener(net.minecraft.client.gui.IGuiEventListener) Fragment(me.ichun.mods.ichunutil.client.gui.bns.window.Fragment) Constraint(me.ichun.mods.ichunutil.client.gui.bns.window.constraint.Constraint)

Example 2 with Fragment

use of me.ichun.mods.ichunutil.client.gui.bns.window.Fragment in project iChunUtil by iChun.

the class ElementFertile method getMinHeight.

@Override
public int getMinHeight() {
    int min = 0;
    for (IGuiEventListener child : getEventListeners()) {
        if (child instanceof Fragment<?>) {
            Fragment<?> fragment = (Fragment<?>) child;
            int fragHeight = getConstraintSensitiveMinHeight(fragment);
            if (fragHeight > min) {
                min = fragHeight;
            }
        }
    }
    return min > 0 ? min + (getBorderSize() * 2) : 4;
}
Also used : IGuiEventListener(net.minecraft.client.gui.IGuiEventListener) Fragment(me.ichun.mods.ichunutil.client.gui.bns.window.Fragment) Constraint(me.ichun.mods.ichunutil.client.gui.bns.window.constraint.Constraint)

Example 3 with Fragment

use of me.ichun.mods.ichunutil.client.gui.bns.window.Fragment in project iChunUtil by iChun.

the class ElementFertile method getConstraintSensitiveMinWidth.

public int getConstraintSensitiveMinWidth(Fragment<?> child) {
    int ourWidth = child.getMinWidth();
    ourWidth += child.constraint.get(Constraint.Property.Type.LEFT).getDist();
    ourWidth += child.constraint.get(Constraint.Property.Type.RIGHT).getDist();
    Constraint.Property left = child.constraint.get(Constraint.Property.Type.LEFT);
    if (// we gotta end somewhere
    left != Constraint.Property.NONE && left.getReference() != this && left.getReference() instanceof Fragment) {
        ourWidth += getConstraintSensitiveMinWidth((Fragment<?>) left.getReference());
    }
    Constraint.Property right = child.constraint.get(Constraint.Property.Type.RIGHT);
    if (// we gotta end somewhere
    right != Constraint.Property.NONE && right.getReference() != this && right.getReference() instanceof Fragment) {
        ourWidth += getConstraintSensitiveMinWidth((Fragment<?>) right.getReference());
    }
    return ourWidth;
}
Also used : Constraint(me.ichun.mods.ichunutil.client.gui.bns.window.constraint.Constraint) Fragment(me.ichun.mods.ichunutil.client.gui.bns.window.Fragment) Constraint(me.ichun.mods.ichunutil.client.gui.bns.window.constraint.Constraint)

Example 4 with Fragment

use of me.ichun.mods.ichunutil.client.gui.bns.window.Fragment in project iChunUtil by iChun.

the class ElementFertile method getConstraintSensitiveMinHeight.

public int getConstraintSensitiveMinHeight(Fragment<?> child) {
    int ourHeight = child.getMinHeight();
    ourHeight += child.constraint.get(Constraint.Property.Type.TOP).getDist();
    ourHeight += child.constraint.get(Constraint.Property.Type.BOTTOM).getDist();
    Constraint.Property top = child.constraint.get(Constraint.Property.Type.TOP);
    if (// we gotta end somewhere
    top != Constraint.Property.NONE && top.getReference() != this && top.getReference() instanceof Fragment) {
        ourHeight += getConstraintSensitiveMinHeight((Fragment<?>) top.getReference());
    }
    Constraint.Property bottom = child.constraint.get(Constraint.Property.Type.BOTTOM);
    if (// we gotta end somewhere
    bottom != Constraint.Property.NONE && bottom.getReference() != this && bottom.getReference() instanceof Fragment) {
        ourHeight += getConstraintSensitiveMinHeight((Fragment<?>) bottom.getReference());
    }
    return ourHeight;
}
Also used : Constraint(me.ichun.mods.ichunutil.client.gui.bns.window.constraint.Constraint) Fragment(me.ichun.mods.ichunutil.client.gui.bns.window.Fragment) Constraint(me.ichun.mods.ichunutil.client.gui.bns.window.constraint.Constraint)

Aggregations

Fragment (me.ichun.mods.ichunutil.client.gui.bns.window.Fragment)4 Constraint (me.ichun.mods.ichunutil.client.gui.bns.window.constraint.Constraint)4 IGuiEventListener (net.minecraft.client.gui.IGuiEventListener)2