Package pythagoras.f

Examples of pythagoras.f.Dimension


        group.add(widget);
        UnitSlot updateConstraint = new UnitSlot() {
            @Override public void onEmit () {
                widget.setConstraint(new AbsoluteLayout.Constraint(
                    position.point.get(), origin.point.get(),
                    new Dimension(width.value.get(), height.value.get())));
            }
        };
        width.value.connect(updateConstraint);
        height.value.connect(updateConstraint);
        position.point.connect(updateConstraint);
View Full Code Here


        @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);
        }
View Full Code Here

    /**
     * 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));
    }
View Full Code Here

    /**
     * Updates the value to a new dimension of the given width and height.
     */
    public void update (float width, float height) {
        update(new Dimension(width, height));
    }
View Full Code Here

    /**
     * Updates the value to a new dimension with the current height and the given width.
     */
    public void updateWidth (float width) {
        update(new Dimension(width, get().height()));
    }
View Full Code Here

    /**
     * Updates the value to a new dimension with the current width and the given height.
     */
    public void updateHeight (float height) {
        update(new Dimension(get().width(), height));
    }
View Full Code Here

* An invisible widget that simply requests a fixed amount of space.
*/
public class Shim extends SizableWidget<Shim>
{
    public Shim (float width, float height) {
        this(new Dimension(width, height));
    }
View Full Code Here

        @Override protected LayoutData createLayoutData (float hintX, float hintY) {
            return new LayoutData() {
                @Override public Dimension computeSize (float hintX, float hintY) {
                    CanvasImage image = _image.get();
                    return image == null ? new Dimension(0, 0) :
                        new Dimension(image.width(), image.height());
                }
            };
        }
View Full Code Here

        if (_preferredSize == null) {
            if (_constraint != null) {
                hintX = _constraint.adjustHintX(hintX);
                hintY = _constraint.adjustHintY(hintY);
            }
            Dimension psize = computeSize(hintX, hintY);
            if (_constraint != null) _constraint.adjustPreferredSize(psize, hintX, hintY);
            // round our preferred size up to the nearest whole number; if we allow it to remain
            // fractional, we can run into annoying layout problems where floating point rounding
            // error causes a tiny fraction of a pixel to be shaved off of the preferred size of a
            // text widget, causing it to wrap its text differently and hosing the layout
View Full Code Here

     * direction to the specified height.
     */
    protected Dimension computeSize (float hintX, float hintY) {
        LayoutData ldata = _ldata = createLayoutData(hintX, hintY);
        Insets insets = ldata.bg.insets;
        Dimension size = ldata.computeSize(hintX - insets.width(), hintY - insets.height());
        return insets.addTo(size);
    }
View Full Code Here

TOP

Related Classes of pythagoras.f.Dimension

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.