public LENGTH minheight = 0;
public LENGTH maxwidth = MAX_LENGTH;
public LENGTH maxheight = MAX_LENGTH;
- private LENGTH hpad = 0;
- private LENGTH vpad = 0;
private String text = null;
private Res font = null;
private int fontsize = 10;
public LENGTH height = 0;
private int row = 0; // FEATURE use a short
private int col = 0; // FEATURE use a short
- private LENGTH contentwidth = 0; // == max(minwidth, textwidth+pad, sum(child.contentwidth) + pad)
+ private LENGTH contentwidth = 0; // == max(minwidth, textwidth, sum(child.contentwidth))
private LENGTH contentheight = 0;
private LENGTH offset_x = 0;
private LENGTH offset_y = 0;
if (isinside && cursor != null) getRoot().cursor = cursor;
// if the mouse has moved into our padding region, it is considered 'outside' all our children
- if (!(mousex >= hpad && mousey >= vpad && mousex < width - hpad && mousey < height + vpad)) forceleave = true;
+ if (!(mousex >= 0 && mousey >= 0 && mousex < width && mousey < height)) forceleave = true;
for(Box b = getChild(numChildren() - 1); b != null; b = b.prevSibling()) {
b.Move(oldmousex - b.x, oldmousey - b.y, mousex - b.x, mousey - b.y, forceleave);
// --- Phase 2 ----------------------------------------------------------------------
// compute the min/max sizes of the columns and rows and set our contentwidth
if (numChildren() != 0) {
- //#repeat x/y y/x width/height col/row cols/rows colspan/rowspan colWidth/rowHeight maxwidth/maxheight minwidth/minheight contentwidth/contentheight colMaxWidth/rowMaxHeight numCols/numRows hpad/vpad
- contentwidth = 2 * hpad;
+ //#repeat x/y y/x width/height col/row cols/rows colspan/rowspan colWidth/rowHeight maxwidth/maxheight minwidth/minheight contentwidth/contentheight colMaxWidth/rowMaxHeight numCols/numRows
int numCols = cols;
if (numCols == 0)
for(Box child = getChild(0); child != null; child = child.nextSibling())
if (!(((child.flags & NOTPACKED_FLAG) != 0) || ((child.flags & INVISIBLE_FLAG) != 0)))
colWidth[child.col] = max(colWidth[child.col], child.contentwidth / child.colspan);
for(int col=0; col<numCols; col++) contentwidth += colWidth[col];
- contentwidth = max(textwidth + 2 * hpad, contentwidth);
+ contentwidth = max(textwidth, contentwidth);
contentwidth = bound(minwidth, contentwidth, maxwidth);
//#end
}
// --- Phase 3 ----------------------------------------------------------------------
// hand out the slack
int slack;
- //#repeat x/y y/x width/height col/row cols/rows colspan/rowspan colWidth/rowHeight maxwidth/maxheight minwidth/minheight contentwidth/contentheight colMaxWidth/rowMaxHeight numCols/numRows hpad/vpad
- slack = width - 2 * hpad;
+ //#repeat x/y y/x width/height col/row cols/rows colspan/rowspan colWidth/rowHeight maxwidth/maxheight minwidth/minheight contentwidth/contentheight colMaxWidth/rowMaxHeight numCols/numRows
+ slack = width;
for(int i=0; i<numCols; i++) slack -= colWidth[i];
if (numChildren() > 0)
while(slack > 0) {
if ((child.flags & NOTPACKED_FLAG) != 0) {
child_x = child.x;
child_y = child.y;
- child_width = ((child.flags & HSHRINK_FLAG) != 0) ? child.contentwidth : min(child.maxwidth, width - child.x - hpad);
- child_height = ((child.flags & VSHRINK_FLAG) != 0) ? child.contentheight : min(child.maxheight, height - child.y - vpad);
+ child_width = ((child.flags & HSHRINK_FLAG) != 0) ? child.contentwidth : min(child.maxwidth, width - child.x);
+ child_height = ((child.flags & VSHRINK_FLAG) != 0) ? child.contentheight : min(child.maxheight, height - child.y);
} else {
int diff;
- //#repeat x/y y/x width/height col/row cols/rows colspan/rowspan colWidth/rowHeight maxwidth/maxheight minwidth/minheight contentwidth/contentheight colMaxWidth/rowMaxHeight HSHRINK_FLAG/VSHRINK_FLAG marginWidth/marginHeight hpad/vpad child_x/child_y child_width/child_height
+ //#repeat x/y y/x width/height col/row cols/rows colspan/rowspan colWidth/rowHeight maxwidth/maxheight minwidth/minheight contentwidth/contentheight colMaxWidth/rowMaxHeight HSHRINK_FLAG/VSHRINK_FLAG marginWidth/marginHeight child_x/child_y child_width/child_height
child_width = 0; for(int i=child.col; i<child.col+child.colspan && i<colWidth.length; i++) child_width += colWidth[i];
diff = bound(child.contentwidth, child_width, ((child.flags & HSHRINK_FLAG) != 0) ? child.contentwidth : child.maxwidth) - child_width;
- if (transform == null) child_x = max(hpad, marginWidth / 2);
+ if (transform == null) child_x = marginWidth / 2;
for(int i=0; i<child.col; i++) child_x += colWidth[i];
if (diff < 0) child_x += -1 * (diff / 2);
child_width += diff;
if ((fillcolor & 0xff000000) != 0) rpath.fill(buf, new VectorGraphics.SingleColorPaint(fillcolor));
}
- // now subtract the pad region from the clip region before proceeding
- if ((flags & NOCLIP_FLAG) == 0) {
- clipw = min(max(clipx, globalx + hpad) + clipw, globalx + width - hpad) - clipx;
- cliph = min(max(clipy, globaly + vpad) + cliph, globaly + height - vpad) - clipy;
- clipx = max(clipx, globalx + hpad);
- clipy = max(clipy, globaly + vpad);
- }
-
for(Box b = getChild(0); b != null; b = b.nextSibling()) {
VectorGraphics.Affine a2 = VectorGraphics.Affine.translate(b.x, b.y);
if (transform != null) a2.multiply(transform);
char c = text.charAt(i);
Glyph g = Glyph.getGlyph(font, fontsize, c);
buf.drawPictureAlphaOnly(g.p,
- x + hpad,
- y + vpad + g.max_ascent - g.baseline,
- x + hpad + g.p.getWidth(),
- y + vpad + g.max_ascent - g.baseline + g.p.getHeight(),
+ x,
+ y + g.max_ascent - g.baseline,
+ x + g.p.getWidth(),
+ y + g.max_ascent - g.baseline + g.p.getHeight(),
0, 0,
g.p.getWidth(), g.p.getHeight(),
textcolor);
specialBoxProperties.put("PosChange", new SpecialBoxProperty());
specialBoxProperties.put("SizeChange", new SpecialBoxProperty());
- //#repeat hpad/vpad
- specialBoxProperties.put("hpad", new SpecialBoxProperty() {
- public Object get(Box b) {
- if (b.redirect == null) return new Integer(0);
- if (b.redirect != b) return get(b.redirect);
- return new Integer(b.hpad);
- }
- public void put(Box b, Object value) {
- if (b.redirect == null) return;
- if (b.redirect != b) { put(b.redirect, value); return; }
- int newval = stoi(value);
- if (newval == b.hpad) return;
- b.hpad = newval;
- MARK_FOR_REFLOW_b;
- }
- });
- //#end
-
//#repeat minwidth/minheight maxwidth/maxheight
specialBoxProperties.put("minwidth", new SpecialBoxProperty() {
public Object get(Box b) { return new Integer(b.minwidth); }