if (!simple && lastIndex == selectedIndex) w -= curveIndent;
if (!simple && lastIndex == selectedIndex) w += curveWidth - 2*curveIndent;
void setButtonBounds() {	Point size = getSize();	int oldX, oldY, oldWidth, oldHeight;	// max button	oldX = maxRect.x;	oldY = maxRect.y;	oldWidth = maxRect.width;	oldHeight = maxRect.height;	maxRect.x = maxRect.y = maxRect.width = maxRect.height = 0;	if (showMax) {		maxRect.x = size.x - borderRight - BUTTON_SIZE - 3;		if (borderRight > 0) maxRect.x += 1;		maxRect.y = onBottom ? size.y - borderBottom - tabHeight + (tabHeight - BUTTON_SIZE)/2: borderTop + (tabHeight - BUTTON_SIZE)/2;		maxRect.width = BUTTON_SIZE;		maxRect.height = BUTTON_SIZE;	}	if (oldX != maxRect.x || oldWidth != maxRect.width ||	    oldY != maxRect.y || oldHeight != maxRect.height) {		int left = Math.min(oldX, maxRect.x), top = Math.min(oldY, maxRect.y);		int right = Math.max(oldX + oldWidth, maxRect.x + maxRect.width), bottom = Math.max(oldY + oldHeight, maxRect.y + maxRect.height);		redraw(left, top, right - left, bottom - top, false); 	}		// min button	oldX = minRect.x;	oldY = minRect.y;	oldWidth = minRect.width;	oldHeight = minRect.height;	minRect.x = minRect.y = minRect.width = minRect.height = 0;	if (showMin) {		minRect.x = size.x - borderRight - maxRect.width - BUTTON_SIZE - 3;		if (borderRight > 0) minRect.x += 1;		minRect.y = onBottom ? size.y - borderBottom - tabHeight + (tabHeight - BUTTON_SIZE)/2: borderTop + (tabHeight - BUTTON_SIZE)/2;		minRect.width = BUTTON_SIZE;		minRect.height = BUTTON_SIZE;	}	if (oldX != minRect.x || oldWidth != minRect.width ||	    oldY != minRect.y || oldHeight != minRect.height) {		int left = Math.min(oldX, minRect.x), top = Math.min(oldY, minRect.y);		int right = Math.max(oldX + oldWidth, minRect.x + minRect.width), bottom = Math.max(oldY + oldHeight, minRect.y + minRect.height);		redraw(left, top, right - left, bottom - top, false);	}		// top right control	oldX = topRightRect.x;	oldY = topRightRect.y;	oldWidth = topRightRect.width;	oldHeight = topRightRect.height;	topRightRect.x = topRightRect.y = topRightRect.width = topRightRect.height = 0;	if (topRight != null) {		switch (topRightAlignment) {			case SWT.FILL: {				int rightEdge = size.x - borderRight - 3 - maxRect.width - minRect.width;				if (single) {					if (items.length == 0 || selectedIndex == -1) {						topRightRect.x = borderLeft + 3;						topRightRect.width = rightEdge - topRightRect.x;					} else {						// fill size is 0 if item compressed						CTabItem item = items[selectedIndex];						if (item.x + item.width + 7 + 3*BUTTON_SIZE/2 >= rightEdge) break;						topRightRect.x = item.x + item.width + 7 + 3*BUTTON_SIZE/2;						topRightRect.width = rightEdge - topRightRect.x;					}				} else {					// fill size is 0 if chevron showing					if (showChevron) break;					if (items.length == 0) {						topRightRect.x = borderLeft + 3;					} else {						CTabItem item = items[items.length - 1];						topRightRect.x = item.x + item.width;					}					topRightRect.width = rightEdge - topRightRect.x;				}				topRightRect.y = onBottom ? size.y - borderBottom - tabHeight: borderTop + 1;				topRightRect.height = tabHeight - 1;				break;			}			case SWT.RIGHT: {				Point topRightSize = topRight.computeSize(SWT.DEFAULT, tabHeight);				int rightEdge = size.x - borderRight - 3 - maxRect.width - minRect.width;				topRightRect.x = rightEdge - topRightSize.x;				topRightRect.width = topRightSize.x;				topRightRect.y = onBottom ? size.y - borderBottom - tabHeight: borderTop + 1;				topRightRect.height = tabHeight - 1;			}		}		topRight.setBounds(topRightRect);	}	if (oldX != topRightRect.x || oldWidth != topRightRect.width ||		oldY != topRightRect.y || oldHeight != topRightRect.height) {		}		// chevron button	oldX = chevronRect.x;	oldY = chevronRect.y;	oldWidth = chevronRect.width;	oldHeight = chevronRect.height;	chevronRect.x = chevronRect.y = chevronRect.height = chevronRect.width = 0;	if (single) {		if (selectedIndex == -1 || items.length > 1) {			chevronRect.width = 3*BUTTON_SIZE/2;			chevronRect.height = BUTTON_SIZE + 2;			chevronRect.y = onBottom ? size.y - borderBottom - tabHeight + (tabHeight - chevronRect.height)/2 : borderTop + (tabHeight - chevronRect.height)/2;			if (selectedIndex == -1) {				chevronRect.x = size.x - borderRight - 3 - minRect.width - maxRect.width - topRightRect.width - chevronRect.width;			} else {				CTabItem item = items[selectedIndex];				int w = size.x - borderRight - 3 - minRect.width - maxRect.width - chevronRect.width;				if (topRightRect.width > 0) w -= topRightRect.width + 3;				chevronRect.x = Math.min(item.x + item.width + 3, w);			}			if (borderRight > 0) chevronRect.x += 1;		}	} else {		if (showChevron) {			chevronRect.width = 3*BUTTON_SIZE/2;			chevronRect.height = BUTTON_SIZE + 2;			int lastIndex = getLastIndex();			CTabItem lastItem = items[lastIndex];			int w = lastItem.x + lastItem.width + 3;			if (!simple && lastIndex == selectedIndex) w -= curveIndent;			chevronRect.x = Math.min(w, getRightItemEdge());			chevronRect.y = onBottom ? size.y - borderBottom - tabHeight + (tabHeight - chevronRect.height)/2 : borderTop + (tabHeight - chevronRect.height)/2;		}	}	if (oldX != chevronRect.x || oldWidth != chevronRect.width ||	    oldY != chevronRect.y || oldHeight != chevronRect.height) {		int left = Math.min(oldX, chevronRect.x), top = Math.min(oldY, chevronRect.y);		int right = Math.max(oldX + oldWidth, chevronRect.x + chevronRect.width), bottom = Math.max(oldY + oldHeight, chevronRect.y + chevronRect.height);		redraw(left, top, right - left, bottom - top, false);	}}