protected void layout(Composite composite, boolean flushCache) {
		Rectangle rect = composite.getClientArea();
		Control[] children = composite.getChildren();
		int count = children.length;
		if (count == 0)
			return;
		int width = rect.width - marginWidth * 2;
		int height = rect.height - marginHeight * 2;
		if (type == SWT.HORIZONTAL) {
			width -= (count - 1) * spacing;
			int x = rect.x + marginWidth, extra = width % count;
			int y = rect.y + marginHeight, cellWidth = width / count;
			for (int i = 0; i < count; i++) {
				Control child = children[i];
				int childWidth = cellWidth;
				if (i == 0) {
					childWidth += extra / 2;
				} else {
					if (i == count - 1)
						childWidth += (extra + 1) / 2;
				}
				child.setBounds(x, y, childWidth, height);
				x += childWidth + spacing;
			}
		} else {
			height -= (count - 1) * spacing;
			int x = rect.x + marginWidth, cellHeight = height / count;
			int y = rect.y + marginHeight, extra = height % count;
			for (int i = 0; i < count; i++) {
				Control child = children[i];
				int childHeight = cellHeight;
				if (i == 0) {
					childHeight += extra / 2;
				} else {
					if (i == count - 1)
						childHeight += (extra + 1) / 2;
				}
				child.setBounds(x, y, width, childHeight);
				y += childHeight + spacing;
			}
		}
	}