Java 类com.badlogic.gdx.scenes.scene2d.utils.Layout 实例源码

项目:dice-heroes    文件:TabPane.java   
@Override public float getPrefWidth() {
    if (selectedIndex == -1)
        return 0;
    validate();
    float headersWidth = 0;
    float maxWidth = 0f;
    for (Actor header : headers) {
        maxWidth = Math.max(header instanceof Layout ? ((Layout) header).getPrefWidth() : header.getWidth(), maxWidth);
    }
    headersWidth += maxWidth * headers.size;
    headersWidth += headersLeftOffset;
    headersWidth += headersRightOffset;
    headersWidth += headersBetweenOffset * (headers.size - 1);
    float contentsWidth = 0;
    for (Actor content : contents) {
        contentsWidth = Math.max(contentsWidth, content instanceof Layout ? ((Layout) content).getPrefWidth() : content.getWidth());
    }
    return Math.max(contentsWidth, headersWidth);
}
项目:Mundus    文件:MundusSplitPane.java   
@Override
public void layout() {
    if (!vertical)
        calculateHorizBoundsAndPositions();
    else
        calculateVertBoundsAndPositions();

    Actor firstWidget = this.firstWidget;
    if (firstWidget != null) {
        Rectangle firstWidgetBounds = this.firstWidgetBounds;
        firstWidget.setBounds(firstWidgetBounds.x, firstWidgetBounds.y, firstWidgetBounds.width,
                firstWidgetBounds.height);
        if (firstWidget instanceof Layout) ((Layout) firstWidget).validate();
    }
    Actor secondWidget = this.secondWidget;
    if (secondWidget != null) {
        Rectangle secondWidgetBounds = this.secondWidgetBounds;
        secondWidget.setBounds(secondWidgetBounds.x, secondWidgetBounds.y, secondWidgetBounds.width,
                secondWidgetBounds.height);
        if (secondWidget instanceof Layout) ((Layout) secondWidget).validate();
    }
}
项目:CodeBase    文件:LogList.java   
private void computeSize() {
    sizeInvalid = false;
    maxWidth = minWidth = prefWidth = getStage().getWidth() - 5;
    maxHeight = minHeight = prefHeight = 0;
    SnapshotArray<Actor> children = getChildren();
    for (int i = 0, n = children.size; i < n; i++) {
        Actor child = children.get(i);
        if (!child.isVisible()) {
            continue;
        }
        if (child instanceof Layout) {
            Layout layout = (Layout) child;
            prefHeight += layout.getPrefHeight();
            minHeight += layout.getMinHeight();
        } else {
            prefHeight += child.getHeight();
            minHeight += child.getHeight();
        }
    }
}
项目:libgdxcn    文件:VerticalGroup.java   
private void computeSize () {
    sizeInvalid = false;
    SnapshotArray<Actor> children = getChildren();
    int n = children.size;
    prefWidth = 0;
    prefHeight = padTop + padBottom + spacing * (n - 1);
    for (int i = 0; i < n; i++) {
        Actor child = children.get(i);
        if (child instanceof Layout) {
            Layout layout = (Layout)child;
            prefWidth = Math.max(prefWidth, layout.getPrefWidth());
            prefHeight += layout.getPrefHeight();
        } else {
            prefWidth = Math.max(prefWidth, child.getWidth());
            prefHeight += child.getHeight();
        }
    }
    prefWidth += padLeft + padRight;
    if (round) {
        prefWidth = Math.round(prefWidth);
        prefHeight = Math.round(prefHeight);
    }
}
项目:libgdxcn    文件:Tree.java   
private void computeSize (Array<Node> nodes, float indent) {
    float ySpacing = this.ySpacing;
    float spacing = iconSpacingLeft + iconSpacingRight;
    for (int i = 0, n = nodes.size; i < n; i++) {
        Node node = nodes.get(i);
        float rowWidth = indent + iconSpacingRight;
        Actor actor = node.actor;
        if (actor instanceof Layout) {
            Layout layout = (Layout)actor;
            rowWidth += layout.getPrefWidth();
            node.height = layout.getPrefHeight();
            layout.pack();
        } else {
            rowWidth += actor.getWidth();
            node.height = actor.getHeight();
        }
        if (node.icon != null) {
            rowWidth += spacing + node.icon.getMinWidth();
            node.height = Math.max(node.height, node.icon.getMinHeight());
        }
        prefWidth = Math.max(prefWidth, rowWidth);
        prefHeight -= node.height + ySpacing;
        if (node.expanded) computeSize(node.children, indent + indentSpacing);
    }
}
项目:libgdxcn    文件:SplitPane.java   
@Override
public void layout () {
    if (!vertical)
        calculateHorizBoundsAndPositions();
    else
        calculateVertBoundsAndPositions();

    Actor firstWidget = this.firstWidget;
    if (firstWidget != null) {
        Rectangle firstWidgetBounds = this.firstWidgetBounds;
        firstWidget.setBounds(firstWidgetBounds.x, firstWidgetBounds.y, firstWidgetBounds.width, firstWidgetBounds.height);
        if (firstWidget instanceof Layout) ((Layout)firstWidget).validate();
    }
    Actor secondWidget = this.secondWidget;
    if (secondWidget != null) {
        Rectangle secondWidgetBounds = this.secondWidgetBounds;
        secondWidget.setBounds(secondWidgetBounds.x, secondWidgetBounds.y, secondWidgetBounds.width, secondWidgetBounds.height);
        if (secondWidget instanceof Layout) ((Layout)secondWidget).validate();
    }
}
项目:libgdxcn    文件:HorizontalGroup.java   
private void computeSize () {
    sizeInvalid = false;
    SnapshotArray<Actor> children = getChildren();
    int n = children.size;
    prefWidth = padLeft + padRight + spacing * (n - 1);
    prefHeight = 0;
    for (int i = 0; i < n; i++) {
        Actor child = children.get(i);
        if (child instanceof Layout) {
            Layout layout = (Layout)child;
            prefWidth += layout.getPrefWidth();
            prefHeight = Math.max(prefHeight, layout.getPrefHeight());
        } else {
            prefWidth += child.getWidth();
            prefHeight = Math.max(prefHeight, child.getHeight());
        }
    }
    prefHeight += padTop + padBottom;
    if (round) {
        prefWidth = Math.round(prefWidth);
        prefHeight = Math.round(prefHeight);
    }
}
项目:vis-editor    文件:VisSplitPane.java   
@Override
public void layout () {
    if (!vertical)
        calculateHorizBoundsAndPositions();
    else
        calculateVertBoundsAndPositions();

    Actor firstWidget = this.firstWidget;
    if (firstWidget != null) {
        Rectangle firstWidgetBounds = this.firstWidgetBounds;
        firstWidget.setBounds(firstWidgetBounds.x, firstWidgetBounds.y, firstWidgetBounds.width, firstWidgetBounds.height);
        if (firstWidget instanceof Layout) ((Layout) firstWidget).validate();
    }
    Actor secondWidget = this.secondWidget;
    if (secondWidget != null) {
        Rectangle secondWidgetBounds = this.secondWidgetBounds;
        secondWidget.setBounds(secondWidgetBounds.x, secondWidgetBounds.y, secondWidgetBounds.width, secondWidgetBounds.height);
        if (secondWidget instanceof Layout) ((Layout) secondWidget).validate();
    }
}
项目:ingress-indonesia-dev    文件:Stack.java   
public float getMinHeight()
{
  SnapshotArray localSnapshotArray = getChildren();
  int i = localSnapshotArray.size;
  float f1 = 0.0F;
  int j = 0;
  if (j < i)
  {
    Actor localActor = (Actor)localSnapshotArray.get(j);
    if ((localActor instanceof Layout));
    for (float f2 = ((Layout)localActor).getMinHeight(); ; f2 = localActor.getHeight())
    {
      f1 = Math.max(f1, f2);
      j++;
      break;
    }
  }
  return f1 * getScaleY();
}
项目:ingress-indonesia-dev    文件:Stack.java   
public float getMinWidth()
{
  SnapshotArray localSnapshotArray = getChildren();
  int i = localSnapshotArray.size;
  float f1 = 0.0F;
  int j = 0;
  if (j < i)
  {
    Actor localActor = (Actor)localSnapshotArray.get(j);
    if ((localActor instanceof Layout));
    for (float f2 = ((Layout)localActor).getMinWidth(); ; f2 = localActor.getWidth())
    {
      f1 = Math.max(f1, f2);
      j++;
      break;
    }
  }
  return f1 * getScaleX();
}
项目:ingress-indonesia-dev    文件:Stack.java   
public float getPrefHeight()
{
  SnapshotArray localSnapshotArray = getChildren();
  int i = localSnapshotArray.size;
  float f1 = 0.0F;
  int j = 0;
  if (j < i)
  {
    Actor localActor = (Actor)localSnapshotArray.get(j);
    if ((localActor instanceof Layout));
    for (float f2 = ((Layout)localActor).getPrefHeight(); ; f2 = localActor.getHeight())
    {
      f1 = Math.max(f1, f2);
      j++;
      break;
    }
  }
  return f1 * getScaleY();
}
项目:ingress-indonesia-dev    文件:Stack.java   
public float getPrefWidth()
{
  SnapshotArray localSnapshotArray = getChildren();
  int i = localSnapshotArray.size;
  float f1 = 0.0F;
  int j = 0;
  if (j < i)
  {
    Actor localActor = (Actor)localSnapshotArray.get(j);
    if ((localActor instanceof Layout));
    for (float f2 = ((Layout)localActor).getPrefWidth(); ; f2 = localActor.getWidth())
    {
      f1 = Math.max(f1, f2);
      j++;
      break;
    }
  }
  return f1 * getScaleX();
}
项目:ingress-indonesia-dev    文件:Stack.java   
public void layout()
{
  SnapshotArray localSnapshotArray = getChildren();
  int i = localSnapshotArray.size;
  for (int j = 0; j < i; j++)
  {
    Actor localActor = (Actor)localSnapshotArray.get(j);
    localActor.setBounds(0.0F, 0.0F, getWidth(), getHeight());
    if ((localActor instanceof Layout))
    {
      Layout localLayout = (Layout)localActor;
      localLayout.invalidate();
      localLayout.validate();
    }
  }
}
项目:ingress-indonesia-dev    文件:SplitPane.java   
public float getPrefHeight()
{
  float f1;
  if ((this.firstWidget instanceof Layout))
  {
    f1 = ((Layout)this.firstWidget).getPrefHeight();
    if (!(this.secondWidget instanceof Layout))
      break label85;
  }
  label85: for (float f2 = ((Layout)this.secondWidget).getPrefHeight(); ; f2 = this.secondWidget.getHeight())
  {
    float f3 = f2 + f1;
    if (this.vertical)
      f3 += this.style.handle.getMinHeight();
    return f3;
    f1 = this.firstWidget.getHeight();
    break;
  }
}
项目:ingress-indonesia-dev    文件:SplitPane.java   
public float getPrefWidth()
{
  float f1;
  if ((this.firstWidget instanceof Layout))
  {
    f1 = ((Layout)this.firstWidget).getPrefWidth();
    if (!(this.secondWidget instanceof Layout))
      break label85;
  }
  label85: for (float f2 = ((Layout)this.secondWidget).getPrefWidth(); ; f2 = this.secondWidget.getWidth())
  {
    float f3 = f2 + f1;
    if (!this.vertical)
      f3 += this.style.handle.getMinWidth();
    return f3;
    f1 = this.firstWidget.getWidth();
    break;
  }
}
项目:ingress-indonesia-dev    文件:WidgetGroup.java   
private void setLayoutEnabled(Group paramGroup, boolean paramBoolean)
{
  SnapshotArray localSnapshotArray = getChildren();
  int i = localSnapshotArray.size;
  int j = 0;
  if (j < i)
  {
    Actor localActor = (Actor)localSnapshotArray.get(j);
    if ((localActor instanceof Layout))
      ((Layout)localActor).setLayoutEnabled(paramBoolean);
    while (true)
    {
      j++;
      break;
      if ((localActor instanceof Group))
        setLayoutEnabled((Group)localActor, paramBoolean);
    }
  }
}
项目:M-M    文件:ControlsEditController.java   
@Override
public void reset() {
    parentSize = ((Layout) mockUpEntity.getParent()).getPrefWidth();
    size = mockUpEntity.getWidth();
    x.setCurrentValue(getX() * (parentSize - size));
    y.setCurrentValue(getY() * (parentSize - size));
    act(0f);
}
项目:gdx-texture-packer-gui    文件:TransformScalableWrapper.java   
@Override
public float getPrefWidth() {
    if (actor == null) return 0f;

    if (actor instanceof Layout) {
        Layout layout = (Layout) actor;
        return layout.getPrefWidth() * getScaleX();
    } else {
        return origWidth * getScaleX();
    }
}
项目:gdx-texture-packer-gui    文件:TransformScalableWrapper.java   
@Override
public float getPrefHeight() {
    if (actor == null) return 0f;

    if (actor instanceof Layout) {
        Layout layout = (Layout) actor;
        return layout.getPrefHeight() * getScaleY();
    } else {
        return origHeight * getScaleY();
    }
}
项目:gdx-texture-packer-gui    文件:ScalarScalableWrapper.java   
@Override
public float getPrefWidth() {
    if (actor == null) return 0f;

    if (actor instanceof Layout) {
        Layout layout = (Layout) actor;
        return layout.getPrefWidth() * scaleX;
    } else {
        return origWidth * scaleX;
    }
}
项目:gdx-texture-packer-gui    文件:ScalarScalableWrapper.java   
@Override
public float getPrefHeight() {
    if (actor == null) return 0f;

    if (actor instanceof Layout) {
        Layout layout = (Layout) actor;
        return layout.getPrefHeight() * scaleY;
    } else {
        return origHeight * scaleY;
    }
}
项目:Mundus    文件:MundusSplitPane.java   
@Override
public float getPrefWidth() {
    float width = 0;
    if (firstWidget != null)
        width = firstWidget instanceof Layout ? ((Layout) firstWidget).getPrefWidth() : firstWidget.getWidth();
    if (secondWidget != null)
        width += secondWidget instanceof Layout ? ((Layout) secondWidget).getPrefWidth() : secondWidget.getWidth();
    if (!vertical) width += style.handle.getMinWidth();
    return width;
}
项目:Mundus    文件:MundusSplitPane.java   
@Override
public float getPrefHeight() {
    float height = 0;
    if (firstWidget != null)
        height = firstWidget instanceof Layout ? ((Layout) firstWidget).getPrefHeight() : firstWidget.getHeight();
    if (secondWidget != null) height += secondWidget instanceof Layout ? ((Layout) secondWidget).getPrefHeight()
            : secondWidget.getHeight();
    if (vertical) height += style.handle.getMinHeight();
    return height;
}
项目:Mundus    文件:MundusMultiSplitPane.java   
@Override
public void layout() {
    if (!vertical)
        calculateHorizBoundsAndPositions();
    else
        calculateVertBoundsAndPositions();

    SnapshotArray<Actor> actors = getChildren();
    for (int i = 0; i < actors.size; i++) {
        Actor actor = actors.get(i);
        Rectangle bounds = widgetBounds.get(i);
        actor.setBounds(bounds.x, bounds.y, bounds.width, bounds.height);
        if (actor instanceof Layout) ((Layout) actor).validate();
    }
}
项目:Mundus    文件:MundusMultiSplitPane.java   
@Override
public float getPrefWidth() {
    float width = 0;
    for (Actor actor : getChildren()) {
        width = actor instanceof Layout ? ((Layout) actor).getPrefWidth() : actor.getWidth();
    }
    if (!vertical) width += handleBounds.size * style.handle.getMinWidth();
    return width;
}
项目:Mundus    文件:MundusMultiSplitPane.java   
@Override
public float getPrefHeight() {
    float height = 0;
    for (Actor actor : getChildren()) {
        height = actor instanceof Layout ? ((Layout) actor).getPrefHeight() : actor.getHeight();

    }
    if (vertical) height += handleBounds.size * style.handle.getMinHeight();
    return height;
}
项目:Roguelike    文件:VerticalFlowGroup.java   
private void computeSize()
{
    prefWidth = 0;
    prefHeight = 0;
    sizeInvalid = false;
    SnapshotArray<Actor> children = getChildren();
    float groupHeight = getHeight();
    float y = 0;
    float maxWidth = 0;
    for (int i = 0, n = children.size; i < n; i++)
    {
        Actor child = children.get(i);
        float width = child.getWidth();
        float height = child.getHeight();
        if (child instanceof Layout)
        {
            Layout layout = (Layout) child;
            width = layout.getPrefWidth();
            height = layout.getPrefHeight();
        }
        if (y + height <= groupHeight)
        {
            prefHeight += height + spacing;
            y += height + spacing;
            maxWidth = Math.max(width, maxWidth);
        } else
        {
            prefWidth += maxWidth + spacing;
            maxWidth = width;
            y = height + spacing;
        }
    }
    prefWidth += maxWidth;
}
项目:Roguelike    文件:HorizontalFlowGroup.java   
private void computeSize()
{
    prefWidth = 0;
    prefHeight = 0;
    sizeInvalid = false;
    SnapshotArray<Actor> children = getChildren();
    float groupWidth = getWidth();
    float x = 0;
    float maxHeight = 0;
    for (int i = 0, n = children.size; i < n; i++)
    {
        Actor child = children.get(i);
        float width = child.getWidth();
        float height = child.getHeight();
        if (child instanceof Layout)
        {
            Layout layout = (Layout) child;
            width = layout.getPrefWidth();
            height = layout.getPrefHeight();
        }
        if (x + width <= groupWidth)
        {
            prefWidth += width + spacing;
            x += width + spacing;
            maxHeight = Math.max(height, maxHeight);
        } else
        {
            prefHeight += maxHeight + spacing;
            maxHeight = height;
            x = width + spacing;
        }
    }
    prefHeight += maxHeight;
}
项目:gdx-lml    文件:AbstractLayoutLmlAttribute.java   
@Override
public void process(final LmlParser parser, final LmlTag tag, final Actor actor, final String rawAttributeData) {
    if (actor instanceof Layout) {
        process(parser, tag, (Layout) actor, actor, rawAttributeData);
    } else {
        parser.throwErrorIfStrict(this.getClass().getSimpleName()
                + " can be added only to actors that implement Layout interface. Tag: " + tag.getTagName()
                + " with actor: " + actor + " cannot have this attribute.");
    }
}
项目:gdx-lml    文件:DefaultStageAttacher.java   
@Override
public void attachToStage(final Actor actor, final Stage stage) {
    if (actor instanceof Dialog) {
        ((Dialog) actor).show(stage);
    }
    if (actor instanceof Layout) {
        ((Layout) actor).pack();
    }
    actor.setPosition(xConverter.convertX(x, stage, actor), yConverter.convertY(y, stage, actor));
}
项目:libgdxcn    文件:Stack.java   
private void computeSize () {
    sizeInvalid = false;
    prefWidth = 0;
    prefHeight = 0;
    minWidth = 0;
    minHeight = 0;
    maxWidth = 0;
    maxHeight = 0;
    SnapshotArray<Actor> children = getChildren();
    for (int i = 0, n = children.size; i < n; i++) {
        Actor child = children.get(i);
        float childMaxWidth, childMaxHeight;
        if (child instanceof Layout) {
            Layout layout = (Layout)child;
            prefWidth = Math.max(prefWidth, layout.getPrefWidth());
            prefHeight = Math.max(prefHeight, layout.getPrefHeight());
            minWidth = Math.max(minWidth, layout.getMinWidth());
            minHeight = Math.max(minHeight, layout.getMinHeight());
            childMaxWidth = layout.getMaxWidth();
            childMaxHeight = layout.getMaxHeight();
        } else {
            prefWidth = Math.max(prefWidth, child.getWidth());
            prefHeight = Math.max(prefHeight, child.getHeight());
            minWidth = Math.max(minWidth, child.getWidth());
            minHeight = Math.max(minHeight, child.getHeight());
            childMaxWidth = 0;
            childMaxHeight = 0;
        }
        if (childMaxWidth > 0) maxWidth = maxWidth == 0 ? childMaxWidth : Math.min(maxWidth, childMaxWidth);
        if (childMaxHeight > 0) maxHeight = maxHeight == 0 ? childMaxHeight : Math.min(maxHeight, childMaxHeight);
    }
}
项目:libgdxcn    文件:Stack.java   
public void layout () {
    if (sizeInvalid) computeSize();
    float width = getWidth(), height = getHeight();
    Array<Actor> children = getChildren();
    for (int i = 0, n = children.size; i < n; i++) {
        Actor child = children.get(i);
        child.setBounds(0, 0, width, height);
        if (child instanceof Layout) ((Layout)child).validate();
    }
}
项目:libgdxcn    文件:ScrollPane.java   
public float getPrefWidth () {
    if (widget instanceof Layout) {
        float width = ((Layout)widget).getPrefWidth();
        if (style.background != null) width += style.background.getLeftWidth() + style.background.getRightWidth();
        if (forceScrollY) {
            float scrollbarWidth = 0;
            if (style.vScrollKnob != null) scrollbarWidth = style.vScrollKnob.getMinWidth();
            if (style.vScroll != null) scrollbarWidth = Math.max(scrollbarWidth, style.vScroll.getMinWidth());
            width += scrollbarWidth;
        }
        return width;
    }
    return 150;
}
项目:libgdxcn    文件:ScrollPane.java   
public float getPrefHeight () {
    if (widget instanceof Layout) {
        float height = ((Layout)widget).getPrefHeight();
        if (style.background != null) height += style.background.getTopHeight() + style.background.getBottomHeight();
        if (forceScrollX) {
            float scrollbarHeight = 0;
            if (style.hScrollKnob != null) scrollbarHeight = style.hScrollKnob.getMinHeight();
            if (style.hScroll != null) scrollbarHeight = Math.max(scrollbarHeight, style.hScroll.getMinHeight());
            height += scrollbarHeight;
        }
        return height;
    }
    return 150;
}
项目:libgdxcn    文件:SplitPane.java   
@Override
public float getPrefWidth () {
    float width = 0;
    if (firstWidget != null)
        width = firstWidget instanceof Layout ? ((Layout)firstWidget).getPrefWidth() : firstWidget.getWidth();
    if (secondWidget != null)
        width += secondWidget instanceof Layout ? ((Layout)secondWidget).getPrefWidth() : secondWidget.getWidth();
    if (!vertical) width += style.handle.getMinWidth();
    return width;
}
项目:libgdxcn    文件:SplitPane.java   
@Override
public float getPrefHeight () {
    float height = 0;
    if (firstWidget != null)
        height = firstWidget instanceof Layout ? ((Layout)firstWidget).getPrefHeight() : firstWidget.getHeight();
    if (secondWidget != null)
        height += secondWidget instanceof Layout ? ((Layout)secondWidget).getPrefHeight() : secondWidget.getHeight();
    if (vertical) height += style.handle.getMinHeight();
    return height;
}
项目:libgdxcn    文件:WidgetGroup.java   
private void setLayoutEnabled (Group parent, boolean enabled) {
    SnapshotArray<Actor> children = parent.getChildren();
    for (int i = 0, n = children.size; i < n; i++) {
        Actor actor = children.get(i);
        if (actor instanceof Layout)
            ((Layout)actor).setLayoutEnabled(enabled);
        else if (actor instanceof Group) //
            setLayoutEnabled((Group)actor, enabled);
    }
}
项目:vis-editor    文件:MultiSplitPane.java   
@Override
public void layout () {
    if (!vertical)
        calculateHorizBoundsAndPositions();
    else
        calculateVertBoundsAndPositions();

    SnapshotArray<Actor> actors = getChildren();
    for (int i = 0; i < actors.size; i++) {
        Actor actor = actors.get(i);
        Rectangle bounds = widgetBounds.get(i);
        actor.setBounds(bounds.x, bounds.y, bounds.width, bounds.height);
        if (actor instanceof Layout) ((Layout) actor).validate();
    }
}
项目:vis-editor    文件:MultiSplitPane.java   
@Override
public float getPrefWidth () {
    float width = 0;
    for (Actor actor : getChildren()) {
        width = actor instanceof Layout ? ((Layout) actor).getPrefWidth() : actor.getWidth();
    }
    if (!vertical) width += handleBounds.size * style.handle.getMinWidth();
    return width;
}
项目:vis-editor    文件:MultiSplitPane.java   
@Override
public float getPrefHeight () {
    float height = 0;
    for (Actor actor : getChildren()) {
        height = actor instanceof Layout ? ((Layout) actor).getPrefHeight() : actor.getHeight();

    }
    if (vertical) height += handleBounds.size * style.handle.getMinHeight();
    return height;
}