/** * Creates a new value with a new dimension of the given width and height. */ public DimensionValue (float width, float height) { super(new Dimension(width, height)); }
/** * Creates a dimension with the specified width and height. */ public Dimension (float width, float height) { setSize(width, height); }
@Override public Dimension computeSize (Container<?> elems, float hintX, float hintY) { // the content is always the 1st child, get the preferred size with extended hints assert elems.childCount() == 1 && elems.childAt(0) == content; _contentSize.setSize(preferredSize(elems.childAt(0), hrange.extendHint(hintX), vrange.extendHint(hintY))); return new Dimension(_contentSize); }
/** * Configures the size of this widget. */ protected T setSize (float width, float height) { boolean changed = _size.width != width || _size.height != height; _size.setSize(width, height); // if we have a cached preferred size and this size differs from it, we need to clear our // layout data as it may contain computations specific to our preferred size if (_preferredSize != null && !_size.equals(_preferredSize)) clearLayoutData(); if (changed) invalidate(); return asT(); }
@Override public void layout (Container<?> elems, float left, float top, float width, float height) { Style.HAlign halign = resolveStyle(elems, Style.HALIGN); Metrics m = computeMetrics(elems, width, height); float y = top + resolveStyle(elems, Style.VALIGN).offset(m.size.height, height); for (int elemIdx = 0, row = 0, size = m.rowBreaks.size(); row < size; ++row) { Dimension rowSize = m.rows.get(row); float x = left + halign.offset(rowSize.width, width); for (; elemIdx < m.rowBreaks.get(row).intValue(); ++elemIdx) { Element<?> elem = elems.childAt(elemIdx); if (!elem.isVisible()) continue; IDimension esize = preferredSize(elem, width, height); if (_valign == null) { setBounds(elem, x, y, esize.width(), rowSize.height()); } else { setBounds(elem, x, y + _valign.offset(esize.height(), rowSize.height()), esize.width(), esize.height()); } x += esize.width() + _hgap; } y += _vgap + rowSize.height; } }
for (; top >= 0; top--) { Entry e = _entries.get(top); if (e.ypos + e.size.height() < _scroller.ypos()) { break;
@Override // from interface IDimension public Dimension clone () { return new Dimension(this); }
/** * Creates a dimension with the specified width and height. */ public Dimension (float width, float height) { setSize(width, height); }
@Override public IDimension screenSize () { return new Dimension(config.width, config.height); } @Override void setTitle (String title) {} // noop!
/** Sets the size of this root element. */ @Override public Root setSize (float width, float height) { _size.setSize(width, height); invalidate(); return this; }
@Override // from interface IDimension public Dimension clone () { return new Dimension(this); }
/** * Sets the preferred size of the menu item. */ public MenuItem setPreferredSize (float wid, float hei) { _preferredSize.setSize(wid, hei); invalidate(); return this; }
@Override public IDimension screenSize () { return new Dimension(config.width, config.height); } @Override void setTitle (String title) {} // noop!
/** * Sets the magnitudes of this dimension to be equal to the supplied dimension. */ public void setSize (IDimension d) { setSize(d.width(), d.height()); }
protected Instance (IDimension size) { this.size = new Dimension(size); } }
/** * Sets the magnitudes of this dimension to be equal to the supplied dimension. */ public void setSize (IDimension d) { setSize(d.width(), d.height()); }
public ModalShadow (float width, float height) { this(new Dimension(width, height)); }
@Override // from interface IRectangle public Dimension size (Dimension target) { target.setSize(width(), height()); return target; }
public Shim (float width, float height) { this(new Dimension(width, height)); }
@Override // from interface IRectangle public Dimension size (Dimension target) { target.setSize(width(), height()); return target; }