private static int calcMaxTextWidth(ToolbarComboWidget c, Rectangle paintRect) {
    int left = calcIconsWidth(c.getLeftIcons(), c.getLeftIconsGap());
    if (left > 0) left += getGapAfterLeftIcons();

    int right = calcIconsWidth(c.getRightIcons(), c.getRightIconsGap());
    if (right > 0) right += getGapBeforeRightIcons();

    int separator = isSeparatorShown(c) ? 2 * getSeparatorGap() + SEPARATOR_WIDTH : 0;
    int expandButton = c.isExpandable() ? getGapBeforeExpandIcon() + EXPAND_ICON.getIconWidth() : 0;

    int otherElementsWidth = left + right + separator + expandButton;
    return paintRect.width - otherElementsWidth;
  }
private static int calcMaxTextWidth(ToolbarComboWidget c, Rectangle paintRect)