if (event.getBounds().intersects(item.getBounds())) {
Rectangle rect = item.getBounds(); if (event.getBounds().intersects(rect.x, rect.y, rect.width + CURVE_WIDTH, rect.height)) {
void onPaint(Event event) {	Font font = getFont();	if (oldFont == null || !oldFont.equals(font)) {		// handle case where  default font changes		oldFont = font;		if (!updateTabHeight(tabHeight)) {			updateItems();			redrawTabArea();		}	}		GC gc = event.gc;	Point size = getSize();	Color parentBackground = getParent().getBackground();	Color background = getBackground();		if (items.length == 0) {		gc.setBackground(parentBackground);		gc.fillRectangle(0, 0, size.x, size.y);		return;	}		if (single) {		// Fill in the empty spaces to the right and left of the tab		// with the background color		if (selectedIndex != -1) {			CTabItem2 item = items[selectedIndex];			int x = border;			int y = onBottom ? size.y-border-tabHeight+SELECTION_BORDER: border;			int width = item.x - x;			int height = tabHeight-SELECTION_BORDER;			gc.setBackground(background);			gc.fillRectangle(x, y, width, height);			x = item.x + item.width;			width = size.x - border - x;			gc.fillRectangle(x, y, width, height);		}	} else {		// Fill in the empty space to the right of the last tab		// with the parent background color		CTabItem2 lastItem = items[items.length -1];		int edge = lastItem.x+lastItem.width;		if (edge < size.x) {			int x = edge;			int y = onBottom ? size.y-border-tabHeight+SELECTION_BORDER-1 : border;			int width = size.x-edge-border+1;			int height = tabHeight-SELECTION_BORDER+1;			gc.setBackground(parentBackground);			gc.fillRectangle(x, y, width, height);		}		// Draw the unselected tabs first.		for (int i=0; i < items.length; i++) {			if (i != selectedIndex && event.getBounds().intersects(items[i].getBounds())) {				items[i].onPaint(gc, false);			}		}	}		// Draw selected tab	if (selectedIndex != -1) {		CTabItem2 item = items[selectedIndex];		if (event.getBounds().intersects(item.getBounds())) {			item.onPaint(gc, true);		}	}		drawClose(gc);	drawChevron(gc);	drawExpand(gc);	drawBorder(gc);			// draw insertion mark//	if (insertionIndex > -2) {//		gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION));//		if (insertionIndex == -1) {//			Rectangle bounds = items[0].getBounds();//			gc.drawLine(bounds.x, bounds.y, bounds.x, bounds.y + bounds.height - 1);//			gc.drawLine(bounds.x - 2, bounds.y, bounds.x + 2, bounds.y);//			gc.drawLine(bounds.x - 1, bounds.y + 1, bounds.x + 1, bounds.y + 1);//			gc.drawLine(bounds.x - 1, bounds.y + bounds.height - 2, bounds.x + 1, bounds.y + bounds.height - 2);//			gc.drawLine(bounds.x - 2, bounds.y + bounds.height - 1, bounds.x + 2, bounds.y + bounds.height - 1);////		} else {//			Rectangle bounds = items[insertionIndex].getBounds();//			gc.drawLine(bounds.x + bounds.width, bounds.y, bounds.x + bounds.width, bounds.y + bounds.height - 1);//			gc.drawLine(bounds.x + bounds.width - 2, bounds.y, bounds.x + bounds.width + 2, bounds.y);//			gc.drawLine(bounds.x + bounds.width - 1, bounds.y + 1, bounds.x + bounds.width + 1, bounds.y + 1);//			gc.drawLine(bounds.x + bounds.width - 1, bounds.y + bounds.height - 2, bounds.x + bounds.width + 1, bounds.y + bounds.height - 2);//			gc.drawLine(bounds.x + bounds.width - 2, bounds.y + bounds.height - 1, bounds.x + bounds.width + 2, bounds.y + bounds.height - 1);//		}//	}		Rectangle rect = getClientArea();	gc.setBackground(getBackground());	gc.fillRectangle(rect);		gc.setForeground(getForeground());	gc.setBackground(getBackground());	}