int lastIndex = getLastIndex(); count = items.length - (lastIndex - firstIndex + 1);
int showCount = 0; while (showCount < priority.length && items[priority[showCount]].showing) { showCount++; } count = items.length - showCount;
void drawChevron(GC gc) {	if (chevronRect.width == 0 || chevronRect.height == 0) return;	// draw chevron (10x7)	Display display = getDisplay();	Point dpi = display.getDPI();	int fontHeight = 72 * 10 / dpi.y;	FontData fd = getFont().getFontData()[0];	fd.setHeight(fontHeight);	Font f = new Font(display, fd);	int fHeight = f.getFontData()[0].getHeight() * display.getDPI().y / 72;	int indent = Math.max(2, (chevronRect.height - fHeight - 4) /2);	int x = chevronRect.x + 2;	int y = chevronRect.y + indent;	int count;	if (single) {		count = selectedIndex == -1 ? items.length : items.length - 1;	} else {		int lastIndex = getLastIndex();		count = items.length - (lastIndex - firstIndex + 1);	}	String chevronString = count > 99 ? "99+" : String.valueOf(count);	switch (chevronImageState) {		case NORMAL: {			Color chevronBorder = single ? getSelectionForeground() : getForeground();			gc.setForeground(chevronBorder);			gc.setFont(f);			gc.drawLine(x,y,     x+2,y+2);			gc.drawLine(x+2,y+2, x,y+4);			gc.drawLine(x+1,y,   x+3,y+2);			gc.drawLine(x+3,y+2, x+1,y+4);			gc.drawLine(x+4,y,   x+6,y+2);			gc.drawLine(x+6,y+2, x+5,y+4);			gc.drawLine(x+5,y,   x+7,y+2);			gc.drawLine(x+7,y+2, x+4,y+4);			gc.drawString(chevronString, x+7, y+3, true);			break;		}		case HOT: {			gc.setForeground(display.getSystemColor(BUTTON_BORDER));			gc.setBackground(display.getSystemColor(BUTTON_FILL));			gc.setFont(f);			gc.fillRoundRectangle(chevronRect.x, chevronRect.y, chevronRect.width, chevronRect.height, 6, 6);			gc.drawRoundRectangle(chevronRect.x, chevronRect.y, chevronRect.width - 1, chevronRect.height - 1, 6, 6);			gc.drawLine(x,y,     x+2,y+2);			gc.drawLine(x+2,y+2, x,y+4);			gc.drawLine(x+1,y,   x+3,y+2);			gc.drawLine(x+3,y+2, x+1,y+4);			gc.drawLine(x+4,y,   x+6,y+2);			gc.drawLine(x+6,y+2, x+5,y+4);			gc.drawLine(x+5,y,   x+7,y+2);			gc.drawLine(x+7,y+2, x+4,y+4);			gc.drawString(chevronString, x+7, y+3, true);			break;		}		case SELECTED: {			gc.setForeground(display.getSystemColor(BUTTON_BORDER));			gc.setBackground(display.getSystemColor(BUTTON_FILL));			gc.setFont(f);			gc.fillRoundRectangle(chevronRect.x, chevronRect.y, chevronRect.width, chevronRect.height, 6, 6);			gc.drawRoundRectangle(chevronRect.x, chevronRect.y, chevronRect.width - 1, chevronRect.height - 1, 6, 6);			gc.drawLine(x+1,y+1, x+3,y+3);			gc.drawLine(x+3,y+3, x+1,y+5);			gc.drawLine(x+2,y+1, x+4,y+3);			gc.drawLine(x+4,y+3, x+2,y+5);			gc.drawLine(x+5,y+1, x+7,y+3);			gc.drawLine(x+7,y+3, x+6,y+5);			gc.drawLine(x+6,y+1, x+8,y+3);			gc.drawLine(x+8,y+3, x+5,y+5);			gc.drawString(chevronString, x+8, y+4, true);			break;		}	}	f.dispose();}