Package pythagoras.f

Examples of pythagoras.f.IDimension.width()


        float x = hrange._cpos, y = vrange._cpos, wid = hrange._size, hei = vrange._size;
        float bx = _elementBuffer.width(), by = _elementBuffer.height();
        for (Element<?> child : (Container<?>)content) {
            IDimension size = child.size();
            if (child.isVisible()) child.layer.setVisible(
                child.x() - bx < x + wid && child.x() + size.width() + bx > x &&
                child.y() - by < y + hei && child.y() + size.height() + by > y);
        }
    }

    /** Dispatches a {@link Listener#viewChanged()} to listeners. */
 
View Full Code Here


            // only compute the preferred size for the fixed elements in this pass
            Constraint c = constraint(elem);
            if (!c.stretch) {
                IDimension psize = preferredSize(elem, hintX, hintY);
                float pwidth = psize.width(), pheight = psize.height();
                m.prefWidth += pwidth;
                m.prefHeight += pheight;
                m.maxWidth = Math.max(m.maxWidth, pwidth);
                m.maxHeight = Math.max(m.maxHeight, pheight);
                m.fixWidth += pwidth;
View Full Code Here

            // the first argument to computeSize is not used for stretched elements
            float availX = hintX - m.gaps(_gap), availY = hintY - m.gaps(_gap);
            float ehintX = vert ? availX : c.computeSize(0, m.totalWeight, availX - m.fixWidth);
            float ehintY = vert ? c.computeSize(0, m.totalWeight, availY - m.fixHeight) : availY;
            IDimension psize = preferredSize(elem, ehintX, ehintY);
            float pwidth = psize.width(), pheight = psize.height();
            m.unitWidth = Math.max(m.unitWidth, pwidth / c.weight);
            m.unitHeight = Math.max(m.unitHeight, pheight / c.weight);
            m.maxWidth = Math.max(m.maxWidth, pwidth);
            m.maxHeight = Math.max(m.maxHeight, pheight);
        }
View Full Code Here

                             valign.offset(m.fixHeight + m.gaps(_gap), height));
            for (Element<?> elem : elems) {
                if (!elem.isVisible()) continue;
                IDimension psize = preferredSize(elem, width, height); // will be cached
                Constraint c = constraint(elem);
                float ewidth = _offPolicy.computeSize(psize.width(), m.maxWidth, width);
                float eheight = c.computeSize(psize.height(), m.totalWeight, stretchHeight);
                setBounds(elem, left + halign.offset(ewidth, width), y, ewidth, eheight);
                y += (eheight + _gap);
            }
        }
View Full Code Here

                              halign.offset(m.fixWidth + m.gaps(_gap), width));
            for (Element<?> elem : elems) {
                if (!elem.isVisible()) continue;
                IDimension psize = preferredSize(elem, width, height); // will be cached
                Constraint c = constraint(elem);
                float ewidth = c.computeSize(psize.width(), m.totalWeight, stretchWidth);
                float eheight = _offPolicy.computeSize(psize.height(), m.maxHeight, height);
                setBounds(elem, x, top + valign.offset(eheight, height), ewidth, eheight);
                x += (ewidth + _gap);
            }
        }
View Full Code Here

        for (Element<?> elem : elems) {
            if (!elem.isVisible()) continue;
            Constraint c = constraint(elem);
            IDimension psize = c.psize(this, elem); // this should return a cached size
            IPoint pos = c.pos(width, height, psize);
            setBounds(elem, left + pos.x(), top + pos.y(), psize.width(), psize.height());
        }
    }

    protected static Constraint constraint (Element<?> elem) {
        assert elem.constraint() != null : "Elements in AbsoluteLayout must have a constraint.";
View Full Code Here

            float fwidth = size.width(), fheight = size.height();
            if (fwidth > 0 && fheight > 0) return size;
            // if either forced width or height is zero, use preferred size in that dimension
            IDimension psize = layout.preferredSize(elem, fwidth, fheight);
            if (fwidth > 0) return new Dimension(fwidth, psize.height());
            else if (fheight > 0) return new Dimension(psize.width(), fheight);
            else return psize;
        }

        public IPoint pos (float width, float height, IDimension prefSize) {
            Point position = this.position.resolve(0, 0, width, height, new Point());
View Full Code Here

        }

        Constraint c = slots.constraint(p);
        dim = c.adjust(dim, bounds);
        slots.setBounds(p,
            c.align(bounds.x, halign.offset(dim.width(), bounds.width)),
            c.align(bounds.y, valign.offset(dim.height(), bounds.height)), dim);
    }

    protected class Slots
    {
View Full Code Here

                IDimension dim = size(pos, hintX, 0);
                if (dim == null) {
                    continue;
                }
                nsSize.height += dim.height();
                nsSize.width = Math.max(nsSize.width, dim.width());
                if (wce > 0) {
                    nsSize.height += vgap;
                }
            }
View Full Code Here

            for (Position pos : WE) {
                IDimension dim = size(pos, 0, ehintY);
                if (dim == null) {
                    continue;
                }
                weSize.width += dim.width();
                weSize.height = Math.max(weSize.height, dim.height());
            }

            weSize.width += Math.max(wce - 1, 0) * hgap;
            float ehintX = Math.max(0, hintX - weSize.width);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.