@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); }
@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(); } }
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(); } } }
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); } }
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); } }
@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(); } }
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); } }
@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(); } }
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(); }
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(); }
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(); }
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(); }
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(); } } }
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; } }
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; } }
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); } } }
@Override public void reset() { parentSize = ((Layout) mockUpEntity.getParent()).getPrefWidth(); size = mockUpEntity.getWidth(); x.setCurrentValue(getX() * (parentSize - size)); y.setCurrentValue(getY() * (parentSize - size)); act(0f); }
@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(); } }
@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(); } }
@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; } }
@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; } }
@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; }
@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; }
@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(); } }
@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; }
@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; }
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; }
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; }
@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."); } }
@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)); }
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); } }
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(); } }
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; }
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; }
@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; }
@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; }
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); } }
@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(); } }
@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; }
@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; }