Skip to content

Commit a4fef30

Browse files
vogellaclaude
andcommitted
Remove curved tab support from CTabFolder and CTabFolderRenderer
Curved tabs are no longer supported. This change simplifies the rendering logic by enforcing square corners and removing all curve-related calculations and legacy highlight gradients. CTabFolder: * Deprecate getSimple() and setSimple(boolean); make setSimple() a no-op. * Remove setSelectionHighlightGradientColor and all usages. * Remove layout adjustments based on curve dimensions (curveIndent). CTabFolderRenderer: * Remove curve-related fields (curve, curveWidth, curveIndent, etc.). * Remove selection highlight caching and associated gradient methods. * Delete obsolete no-op methods: updateCurves(), drawHighlight(), disposeSelectionHighlightGradientColors(). * Simplify rendering: replace all corner constants with EMPTY_CORNER, enforce square corners regardless of the simple flag. Examples/tests: * Remove simpleTabButton from CTabFolderTab control example. * Remove setSimple() call from Bug221962 test snippet. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 9ce273f commit a4fef30

File tree

4 files changed

+38
-392
lines changed

4 files changed

+38
-392
lines changed

bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.java

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,6 @@ Rectangle[] computeControlBounds (Point size, boolean[][] position) {
688688
if (lastIndex != -1) {
689689
CTabItem lastItem = items[lastIndex];
690690
int w = lastItem.x + lastItem.width + SPACING;
691-
if (!simple && lastIndex == selectedIndex) w -= (renderer.curveIndent - 7);
692691
rects[controls.length - 1].x = w;
693692
}
694693
}
@@ -1250,7 +1249,9 @@ public int getSelectionIndex() {
12501249
* @return <code>true</code> if the CTabFolder is rendered with a simple shape
12511250
*
12521251
* @since 3.0
1252+
* @deprecated Curved tabs are no longer supported.
12531253
*/
1254+
@Deprecated(forRemoval = true, since = "2026-04")
12541255
public boolean getSimple() {
12551256
checkWidget();
12561257
return simple;
@@ -2832,7 +2833,6 @@ boolean setItemLocation(GC gc) {
28322833
item.closeRect.x = item.x + item.width - (edgeTrim.width + edgeTrim.x) - closeButtonSize.x;
28332834
item.closeRect.y = onBottom ? size.y - borderBottom - tabHeight + (tabHeight - closeButtonSize.y)/2: borderTop + (tabHeight - closeButtonSize.y)/2;
28342835
x = x + item.width;
2835-
if (!simple && i == selectedIndex) x -= renderer.curveIndent; //TODO: fix next item position
28362836
}
28372837
}
28382838
}
@@ -3285,7 +3285,6 @@ void setSelection(int index, boolean notify) {
32853285
public void setSelectionBackground (Color color) {
32863286
if (inDispose) return;
32873287
checkWidget();
3288-
setSelectionHighlightGradientColor(null);
32893288
if (selectionBackground == color) return;
32903289
if (color == null) color = getDisplay().getSystemColor(SELECTION_BACKGROUND);
32913290
selectionBackground = color;
@@ -3352,7 +3351,6 @@ public void setSelectionBackground(Color[] colors, int[] percents) {
33523351
public void setSelectionBackground(Color[] colors, int[] percents, boolean vertical) {
33533352
checkWidget();
33543353
int colorsLength;
3355-
Color highlightBeginColor = null; //null == no highlight
33563354

33573355
if (colors != null) {
33583356
//The colors array can optionally have an extra entry which describes the highlight top color
@@ -3369,10 +3367,8 @@ public void setSelectionBackground(Color[] colors, int[] percents, boolean verti
33693367
SWT.error(SWT.ERROR_INVALID_ARGUMENT);
33703368
}
33713369
}
3372-
//If the colors is exactly two more than percents then last is highlight
3373-
//Keep track of *real* colorsLength (minus the highlight)
3370+
//If the colors is exactly two more than percents then last was highlight color (now ignored)
33743371
if(percents.length == colors.length - 2) {
3375-
highlightBeginColor = colors[colors.length - 1];
33763372
colorsLength = colors.length - 1;
33773373
} else {
33783374
colorsLength = colors.length;
@@ -3417,7 +3413,6 @@ public void setSelectionBackground(Color[] colors, int[] percents, boolean verti
34173413
selectionGradientPercents = null;
34183414
selectionGradientVertical = false;
34193415
setSelectionBackground((Color)null);
3420-
setSelectionHighlightGradientColor(null);
34213416
} else {
34223417
selectionGradientColors = new Color[colorsLength];
34233418
for (int i = 0; i < colorsLength; ++i) {
@@ -3429,22 +3424,12 @@ public void setSelectionBackground(Color[] colors, int[] percents, boolean verti
34293424
}
34303425
selectionGradientVertical = vertical;
34313426
setSelectionBackground(selectionGradientColors[selectionGradientColors.length-1]);
3432-
setSelectionHighlightGradientColor(highlightBeginColor);
34333427
}
34343428

34353429
// Refresh with the new settings
34363430
if (selectedIndex > -1) redraw();
34373431
}
34383432

3439-
/*
3440-
* Set the color for the highlight start for selected tabs.
3441-
* Update the cache of highlight gradient colors if required.
3442-
*/
3443-
void setSelectionHighlightGradientColor(Color start) {
3444-
if (inDispose) return;
3445-
renderer.setSelectionHighlightGradientColor(start); //TODO: need better caching strategy
3446-
}
3447-
34483433
/**
34493434
* Set the image to be drawn in the background of the selected tab. Image
34503435
* is stretched or compressed to cover entire selection tab area.
@@ -3458,12 +3443,10 @@ void setSelectionHighlightGradientColor(Color start) {
34583443
*/
34593444
public void setSelectionBackground(Image image) {
34603445
checkWidget();
3461-
setSelectionHighlightGradientColor(null);
34623446
if (image == selectionBgImage) return;
34633447
if (image != null) {
34643448
selectionGradientColors = null;
34653449
selectionGradientPercents = null;
3466-
renderer.disposeSelectionHighlightGradientColors(); //TODO: need better caching strategy
34673450
}
34683451
selectionBgImage = image;
34693452
renderer.createAntialiasColors(); //TODO: need better caching strategy
@@ -3519,13 +3502,11 @@ public void setSelectionBarThickness(int thickness) {
35193502
* </ul>
35203503
*
35213504
* @since 3.0
3505+
* @deprecated Curved tabs are no longer supported.
35223506
*/
3507+
@Deprecated(forRemoval = true, since = "2026-04")
35233508
public void setSimple(boolean simple) {
35243509
checkWidget();
3525-
if (this.simple != simple) {
3526-
this.simple = simple;
3527-
updateFolder(UPDATE_TAB_HEIGHT | REDRAW);
3528-
}
35293510
}
35303511
/**
35313512
* Sets the number of tabs that the CTabFolder should display

0 commit comments

Comments
 (0)