|
Lines 242-247
Link Here
|
| 242 |
bounds.height + 1); |
242 |
bounds.height + 1); |
| 243 |
} |
243 |
} |
| 244 |
|
244 |
|
|
|
245 |
/* |
| 246 |
* Add INDENT pixels to the left as a margin. |
| 247 |
*/ |
| 245 |
int textIndent = INDENT; |
248 |
int textIndent = INDENT; |
| 246 |
FontMetrics fm = e.gc.getFontMetrics(); |
249 |
FontMetrics fm = e.gc.getFontMetrics(); |
| 247 |
int height = fm.getHeight(); |
250 |
int height = fm.getHeight(); |
|
Lines 256-262
Link Here
|
| 256 |
textIndent = textIndent - 3; |
259 |
textIndent = textIndent - 3; |
| 257 |
} |
260 |
} |
| 258 |
e.gc.drawImage(tab.getImage(), textIndent, textMiddle - 1); |
261 |
e.gc.drawImage(tab.getImage(), textIndent, textMiddle - 1); |
| 259 |
textIndent = textIndent + 16 + 5; |
262 |
textIndent = textIndent + 16 + 4; |
| 260 |
} else if (tab.isIndented()) { |
263 |
} else if (tab.isIndented()) { |
| 261 |
textIndent = textIndent + INDENT; |
264 |
textIndent = textIndent + INDENT; |
| 262 |
} |
265 |
} |
|
Lines 610-622
Link Here
|
| 610 |
elements[i].setLayoutData(null); |
613 |
elements[i].setLayoutData(null); |
| 611 |
|
614 |
|
| 612 |
if (i != widestLabelIndex) { |
615 |
if (i != widestLabelIndex) { |
| 613 |
String label = ((ITabItem) children[i]).getText(); |
616 |
int width = getTabWidth((ITabItem) children[i]); |
| 614 |
int width = getTextDimension(label).x; |
617 |
if (width > getTabWidth((ITabItem) children[widestLabelIndex])) { |
| 615 |
if (((ITabItem) children[i]).isIndented()) { |
|
|
| 616 |
width = width + INDENT; |
| 617 |
} |
| 618 |
if (width > getTextDimension(((ITabItem) children[widestLabelIndex]) |
| 619 |
.getText()).x) { |
| 620 |
widestLabelIndex = i; |
618 |
widestLabelIndex = i; |
| 621 |
} |
619 |
} |
| 622 |
} |
620 |
} |
|
Lines 624-629
Link Here
|
| 624 |
} |
622 |
} |
| 625 |
|
623 |
|
| 626 |
computeTopAndBottomTab(); |
624 |
computeTopAndBottomTab(); |
|
|
625 |
} |
| 626 |
|
| 627 |
private int getTabWidth(ITabItem tabItem) { |
| 628 |
int width = getTextDimension(tabItem.getText()).x; |
| 629 |
/* |
| 630 |
* To anticipate for the icon placement we should always keep the |
| 631 |
* space available after the label. So when the active tab includes |
| 632 |
* an icon the width of the tab doesn't change. |
| 633 |
*/ |
| 634 |
if (tabItem.getImage() != null) { |
| 635 |
width = width + 16 + 4; |
| 636 |
} |
| 637 |
if (tabItem.isIndented()) { |
| 638 |
width = width + INDENT; |
| 639 |
} |
| 640 |
return width; |
| 627 |
} |
641 |
} |
| 628 |
|
642 |
|
| 629 |
/** |
643 |
/** |
|
Lines 684-704
Link Here
|
| 684 |
String properties_not_available = TabbedPropertyMessages.TabbedPropertyList_properties_not_available; |
698 |
String properties_not_available = TabbedPropertyMessages.TabbedPropertyList_properties_not_available; |
| 685 |
result.x = getTextDimension(properties_not_available).x + INDENT; |
699 |
result.x = getTextDimension(properties_not_available).x + INDENT; |
| 686 |
} else { |
700 |
} else { |
| 687 |
ITabItem widestTab = elements[widestLabelIndex].getTabItem(); |
|
|
| 688 |
int width = getTextDimension(widestTab.getText()).x + INDENT; |
| 689 |
/* |
701 |
/* |
| 690 |
* To anticipate for the icon placement we should always keep the |
702 |
* Add INDENT pixels to the left of the longest tab as a margin. |
| 691 |
* space available after the label. So when the active tab includes |
|
|
| 692 |
* an icon the width of the tab doesn't change. |
| 693 |
*/ |
703 |
*/ |
| 694 |
if (widestTab.getImage() != null) { |
704 |
int width = getTabWidth(elements[widestLabelIndex].getTabItem()) + INDENT; |
| 695 |
width = width + 16 + 4; |
|
|
| 696 |
} |
| 697 |
if (widestTab.isIndented()) { |
| 698 |
width = width + 10; |
| 699 |
} |
| 700 |
/* |
705 |
/* |
| 701 |
* Add 10 pixels to the right of the longest string as a margin. |
706 |
* Add 10 pixels to the right of the longest tab as a margin. |
| 702 |
*/ |
707 |
*/ |
| 703 |
result.x = width + 10; |
708 |
result.x = width + 10; |
| 704 |
} |
709 |
} |