@Override
Rectangle getBounds(int part, Rectangle bounds) {
if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) {
int hTheme = OS.OpenThemeData(0, getClassId());
if ((style & SWT.VERTICAL) != 0) {
int width = OS.GetThemeSysSize(hTheme, OS.SM_CXVSCROLL);
int totalWidth = bounds.height - 2 * width;
int thumbWidth = Math.max(width / 2, (totalWidth * thumb) / Math.max(1, (maximum - minimum)));
int thumbPos = bounds.y + width + Math.max(0, (totalWidth * selection) / Math.max(1, (maximum - minimum)));
switch (part) {
case DrawData.SCROLLBAR_DOWN_ARROW:
return new Rectangle(bounds.x, bounds.y + bounds.height - width, bounds.width, width);
case DrawData.SCROLLBAR_UP_ARROW:
return new Rectangle(bounds.x, bounds.y, bounds.width, width);
case DrawData.SCROLLBAR_UP_TRACK:
return new Rectangle(bounds.x, bounds.y + width, bounds.width, thumbPos - bounds.y - width);
case DrawData.SCROLLBAR_THUMB:
return new Rectangle(bounds.x, thumbPos, bounds.width, thumbWidth);
case DrawData.SCROLLBAR_DOWN_TRACK:
return new Rectangle(bounds.x, thumbPos + thumbWidth, bounds.width, bounds.y + bounds.height - width - thumbPos - thumbWidth);
}
} else {
}
OS.CloseThemeData (hTheme);
}
return super.getBounds(part, bounds);
}