Package pythagoras.f

Examples of pythagoras.f.Dimension


        }

        @Override public Dimension computeSize (float hintX, float hintY) {
            // hint the delegate with our preferred width or height or both,
            // then swap in our preferred function on that (min, max, or subclass)
            return adjustSize(sizeDelegate == null ? new Dimension(prefWidth, prefHeight) :
                sizeDelegate.computeSize(resolveHintX(hintX), resolveHintY(hintY)));
        }
View Full Code Here


    /** A vertical axis layout. */
    public static class Vertical extends AxisLayout {
        @Override public Dimension computeSize (Container<?> elems, float hintX, float hintY) {
            Metrics m = computeMetrics(elems, hintX, hintY, true);
            return new Dimension(m.maxWidth, m.prefHeight + m.gaps(_gap));
        }
View Full Code Here

        Insets current = Insets.ZERO;
        for (int ii = 0, ll = _constituents.length; ii < ll; ii++) {
            Background bg = _constituents[ii];

            // create and save off the instance so we can destroy it later
            instances[ii] = instantiate(bg, current.subtractFrom(new Dimension(size)));

            // add to our composite layer and translate the layers added
            instances[ii].addTo(layer, current.left(), current.top(), 0);

            // adjust the bounds
View Full Code Here

    /** A horizontal axis layout. */
    public static class Horizontal extends AxisLayout {
        @Override public Dimension computeSize (Container<?> elems, float hintX, float hintY) {
            Metrics m = computeMetrics(elems, hintX, hintY, false);
            return new Dimension(m.prefWidth + m.gaps(_gap), m.maxHeight);
        }
View Full Code Here

        public TextLayoutData (float hintX, float hintY) {
            String curtext = text();
            boolean haveText = (curtext != null && curtext.length() > 0);

            // start with hints minus background insets
            Dimension hints = bg.insets.subtractFrom(new Dimension(hintX, hintY));

            // apply effects to the icon, if we have one
            Icon icon = icon();
            this.icon = icon == null ? null : iconEffect.apply(icon);
View Full Code Here

                        twidth = FloatMath.ceil(textWidth());
                    }
                }
            }

            Dimension size = new Dimension();
            addTextSize(size);
            if (icon != null) {
                if (iconPos.horizontal()) {
                    size.width += icon.width();
                    if (text != null) size.width += iconGap;
View Full Code Here

        }

        // this is broken out so that subclasses can extend this action
        protected void addTextSize (Dimension size) {
            if (_constraint instanceof Constraints.TextConstraint) {
                Dimension tsize = (text == null) ? null : new Dimension(textWidth(), textHeight());
                ((Constraints.TextConstraint)_constraint).addTextSize(size, tsize);
            } else if (text != null) {
                size.width += textWidth();
                size.height += textHeight();
            }
View Full Code Here

    /**
     * Constrains {@code elem} to the specified position and size.
     */
    public static <T extends Element<?>> T at (T elem, float x, float y, float width, float height) {
        return at(elem, new Point(x, y), new Dimension(width, height));
    }
View Full Code Here

     * Constrains {@code elem} to the specified size and aligns it relative to the given position
     * using the given alignments.
     */
    public static <T extends Element<?>> T at (T elem, float x, float y, float width, float height,
                                               HAlign halign, VAlign valign) {
        return at(elem, new Point(x, y), new Dimension(width, height), halign, valign);
    }
View Full Code Here

            if (!elem.isVisible()) continue;
            Constraint c = constraint(elem);
            IDimension psize = c.psize(this, elem);
            bounds.add(new Rectangle(c.pos(0, 0, psize), psize));
        }
        return new Dimension(bounds.width, bounds.height);
    }
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.