int computeHeight (Control control, FormData data, boolean flushCache) { FormAttachment top = data.getTopAttachment (control, spacing, flushCache); FormAttachment bottom = data.getBottomAttachment (control, spacing, flushCache); FormAttachment height = bottom.minus (top); if (height.numerator == 0) { if (bottom.numerator == 0) return bottom.offset; if (bottom.numerator == bottom.denominator) return -top.offset; if (bottom.offset <= 0) { return -top.offset * top.denominator / bottom.numerator; } int divider = bottom.denominator - bottom.numerator; return bottom.denominator * bottom.offset / divider; } return height.solveY (data.getHeight (control, flushCache)); }
int computeWidth (Control control, FormData data, boolean flushCache) { FormAttachment left = data.getLeftAttachment (control, spacing, flushCache); FormAttachment right = data.getRightAttachment (control, spacing, flushCache); FormAttachment width = right.minus (left); if (width.numerator == 0) { if (right.numerator == 0) return right.offset; if (right.numerator == right.denominator) return -left.offset; if (right.offset <= 0) { return -left.offset * left.denominator / left.numerator; } int divider = right.denominator - right.numerator; return right.denominator * right.offset / divider; } return width.solveY (data.getWidth (control, flushCache)); }
int computeHeight (Control control, FormData data, boolean flushCache) { FormAttachment top = data.getTopAttachment (control, spacing, flushCache); FormAttachment bottom = data.getBottomAttachment (control, spacing, flushCache); FormAttachment height = bottom.minus (top); if (height.numerator == 0) { if (bottom.numerator == 0) return bottom.offset; if (bottom.numerator == bottom.denominator) return -top.offset; if (bottom.offset <= 0) { return -top.offset * top.denominator / bottom.numerator; } int divider = bottom.denominator - bottom.numerator; return bottom.denominator * bottom.offset / divider; } return height.solveY (data.getHeight (control, flushCache)); }
int computeHeight (Control control, FormData data, boolean flushCache) { FormAttachment top = data.getTopAttachment (control, spacing, flushCache); FormAttachment bottom = data.getBottomAttachment (control, spacing, flushCache); FormAttachment height = bottom.minus (top); if (height.numerator == 0) { if (bottom.numerator == 0) return bottom.offset; if (bottom.numerator == bottom.denominator) return -top.offset; if (bottom.offset <= 0) { return -top.offset * top.denominator / bottom.numerator; } int divider = bottom.denominator - bottom.numerator; return bottom.denominator * bottom.offset / divider; } return height.solveY (data.getHeight (control, flushCache)); }
int computeHeight (Control control, FormData data, boolean flushCache) { FormAttachment top = data.getTopAttachment (control, spacing, flushCache); FormAttachment bottom = data.getBottomAttachment (control, spacing, flushCache); FormAttachment height = bottom.minus (top); if (height.numerator == 0) { if (bottom.numerator == 0) return bottom.offset; if (bottom.numerator == bottom.denominator) return -top.offset; if (bottom.offset <= 0) { return -top.offset * top.denominator / bottom.numerator; } int divider = bottom.denominator - bottom.numerator; return bottom.denominator * bottom.offset / divider; } return height.solveY (data.getHeight (control, flushCache)); }
int computeWidth (Control control, FormData data, boolean flushCache) { FormAttachment left = data.getLeftAttachment (control, spacing, flushCache); FormAttachment right = data.getRightAttachment (control, spacing, flushCache); FormAttachment width = right.minus (left); if (width.numerator == 0) { if (right.numerator == 0) return right.offset; if (right.numerator == right.denominator) return -left.offset; if (right.offset <= 0) { return -left.offset * left.denominator / left.numerator; } int divider = right.denominator - right.numerator; return right.denominator * right.offset / divider; } return width.solveY (data.getWidth (control, flushCache)); }
int computeWidth (Control control, FormData data, boolean flushCache) { FormAttachment left = data.getLeftAttachment (control, spacing, flushCache); FormAttachment right = data.getRightAttachment (control, spacing, flushCache); FormAttachment width = right.minus (left); if (width.numerator == 0) { if (right.numerator == 0) return right.offset; if (right.numerator == right.denominator) return -left.offset; if (right.offset <= 0) { return -left.offset * left.denominator / left.numerator; } int divider = right.denominator - right.numerator; return right.denominator * right.offset / divider; } return width.solveY (data.getWidth (control, flushCache)); }
int computeHeight (Control control, FormData data, boolean flushCache) { FormAttachment top = data.getTopAttachment (control, spacing, flushCache); FormAttachment bottom = data.getBottomAttachment (control, spacing, flushCache); FormAttachment height = bottom.minus (top); if (height.numerator == 0) { if (bottom.numerator == 0) return bottom.offset; if (bottom.numerator == bottom.denominator) return -top.offset; if (bottom.offset <= 0) { return -top.offset * top.denominator / bottom.numerator; } int divider = bottom.denominator - bottom.numerator; return bottom.denominator * bottom.offset / divider; } return height.solveY (data.getHeight (control, flushCache)); }
int computeWidth (Control control, FormData data, boolean flushCache) { FormAttachment left = data.getLeftAttachment (control, spacing, flushCache); FormAttachment right = data.getRightAttachment (control, spacing, flushCache); FormAttachment width = right.minus (left); if (width.numerator == 0) { if (right.numerator == 0) return right.offset; if (right.numerator == right.denominator) return -left.offset; if (right.offset <= 0) { return -left.offset * left.denominator / left.numerator; } int divider = right.denominator - right.numerator; return right.denominator * right.offset / divider; } return width.solveY (data.getWidth (control, flushCache)); }
int computeHeight (Control control, FormData data, boolean flushCache) { FormAttachment top = data.getTopAttachment (control, spacing, flushCache); FormAttachment bottom = data.getBottomAttachment (control, spacing, flushCache); FormAttachment height = bottom.minus (top); if (height.numerator == 0) { if (bottom.numerator == 0) return bottom.offset; if (bottom.numerator == bottom.denominator) return -top.offset; if (bottom.offset <= 0) { return -top.offset * top.denominator / bottom.numerator; } int divider = bottom.denominator - bottom.numerator; return bottom.denominator * bottom.offset / divider; } return height.solveY (data.getHeight (control, flushCache)); }
int computeWidth (Control control, FormData data, boolean flushCache) { FormAttachment left = data.getLeftAttachment (control, spacing, flushCache); FormAttachment right = data.getRightAttachment (control, spacing, flushCache); FormAttachment width = right.minus (left); if (width.numerator == 0) { if (right.numerator == 0) return right.offset; if (right.numerator == right.denominator) return -left.offset; if (right.offset <= 0) { return -left.offset * left.denominator / left.numerator; } int divider = right.denominator - right.numerator; return right.denominator * right.offset / divider; } return width.solveY (data.getWidth (control, flushCache)); }
int computeWidth (Control control, FormData data, boolean flushCache) { FormAttachment left = data.getLeftAttachment (control, spacing, flushCache); FormAttachment right = data.getRightAttachment (control, spacing, flushCache); FormAttachment width = right.minus (left); if (width.numerator == 0) { if (right.numerator == 0) return right.offset; if (right.numerator == right.denominator) return -left.offset; if (right.offset <= 0) { return -left.offset * left.denominator / left.numerator; } int divider = right.denominator - right.numerator; return right.denominator * right.offset / divider; } return width.solveY (data.getWidth (control, flushCache)); }
if (left == null) { if (right == null) return cacheLeft = new FormAttachment (0, 0); return cacheLeft = getRightAttachment (control, spacing, flushCache).minus (getWidth (control, flushCache)); case SWT.CENTER: { FormAttachment rightAttachment = leftData.getRightAttachment (leftControl, spacing, flushCache); FormAttachment leftWidth = rightAttachment.minus (leftAttachment); cacheLeft = leftAttachment.plus (leftWidth.minus (getWidth (control, flushCache)).divide (2)); break;
if (top == null) { if (bottom == null) return cacheTop = new FormAttachment (0, 0); return cacheTop = getBottomAttachment (control, spacing, flushCache).minus (getHeight (control, flushCache)); case SWT.CENTER: { FormAttachment bottomAttachment = topData.getBottomAttachment (topControl, spacing, flushCache); FormAttachment topHeight = bottomAttachment.minus (topAttachment); cacheTop = topAttachment.plus (topHeight.minus (getHeight (control, flushCache)).divide (2)); break;
if (top == null) { if (bottom == null) return cacheTop = new FormAttachment (0, 0); return cacheTop = getBottomAttachment (control, spacing, flushCache).minus (getHeight (control, flushCache)); case SWT.CENTER: { FormAttachment bottomAttachment = topData.getBottomAttachment (topControl, spacing, flushCache); FormAttachment topHeight = bottomAttachment.minus (topAttachment); cacheTop = topAttachment.plus (topHeight.minus (getHeight (control, flushCache)).divide (2)); break;
if (top == null) { if (bottom == null) return cacheTop = new FormAttachment (0, 0); return cacheTop = getBottomAttachment (control, spacing, flushCache).minus (getHeight (control, flushCache)); case SWT.CENTER: { FormAttachment bottomAttachment = topData.getBottomAttachment (topControl, spacing, flushCache); FormAttachment topHeight = bottomAttachment.minus (topAttachment); cacheTop = topAttachment.plus (topHeight.minus (getHeight (control, flushCache)).divide (2)); break;
if (left == null) { if (right == null) return cacheLeft = new FormAttachment (0, 0); return cacheLeft = getRightAttachment (control, spacing, flushCache).minus (getWidth (control, flushCache)); case SWT.CENTER: { FormAttachment rightAttachment = leftData.getRightAttachment (leftControl, spacing, flushCache); FormAttachment leftWidth = rightAttachment.minus (leftAttachment); cacheLeft = leftAttachment.plus (leftWidth.minus (getWidth (control, flushCache)).divide (2)); break;
if (left == null) { if (right == null) return cacheLeft = new FormAttachment (0, 0); return cacheLeft = getRightAttachment (control, spacing, flushCache).minus (getWidth (control, flushCache)); case SWT.CENTER: { FormAttachment rightAttachment = leftData.getRightAttachment (leftControl, spacing, flushCache); FormAttachment leftWidth = rightAttachment.minus (leftAttachment); cacheLeft = leftAttachment.plus (leftWidth.minus (getWidth (control, flushCache)).divide (2)); break;