-
Notifications
You must be signed in to change notification settings - Fork 187
Adjust selection filling the curve for CTabFolder #2753
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,6 +14,8 @@ | |
| *******************************************************************************/ | ||
| package org.eclipse.swt.custom; | ||
|
|
||
| import java.util.*; | ||
|
|
||
| import org.eclipse.swt.*; | ||
| import org.eclipse.swt.graphics.*; | ||
| import org.eclipse.swt.widgets.*; | ||
|
|
@@ -93,8 +95,8 @@ public class CTabFolderRenderer { | |
| static final int BUTTON_FILL = SWT.COLOR_LIST_BACKGROUND; | ||
| static final int BORDER1_COLOR = SWT.COLOR_WIDGET_NORMAL_SHADOW; | ||
|
|
||
| static final int ITEM_TOP_MARGIN = 2; | ||
| static final int ITEM_BOTTOM_MARGIN = 2; | ||
| static final int ITEM_TOP_MARGIN = 3; | ||
| static final int ITEM_BOTTOM_MARGIN = 3; | ||
| static final int ITEM_LEFT_MARGIN = 4; | ||
| static final int ITEM_RIGHT_MARGIN = 4; | ||
| static final int INTERNAL_SPACING = 4; | ||
|
|
@@ -1380,10 +1382,23 @@ void drawSelected(int itemIndex, GC gc, Rectangle bounds, int state ) { | |
|
|
||
| // draw highlight marker of selected tab | ||
| if (parent.selectionHighlightBarThickness > 0 && parent.simple) { | ||
ShahzaibIbrahim marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| Color previousColor = gc.getBackground(); | ||
| gc.setBackground(item.getDisplay().getSystemColor(parent.shouldHighlight() ? SWT.COLOR_LIST_SELECTION : SWT.COLOR_WIDGET_DISABLED_FOREGROUND)); | ||
| gc.fillRectangle(x + 1 /* outline */, parent.onBottom ? y + height - 1 - parent.selectionHighlightBarThickness : y + 1, width - 2 /*outline*/, parent.selectionHighlightBarThickness); | ||
| gc.setBackground(previousColor); | ||
| int thickness = parent.selectionHighlightBarThickness; | ||
| boolean onBottom = parent.onBottom; | ||
|
Comment on lines
+1385
to
+1386
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be easier to read if the variables are corehently defines where they are used. Currently, you define some variable for the layout here in the beginning, then some coloring stuff is done, then again some layouting variables are calculated. |
||
| boolean highlight = parent.shouldHighlight(); | ||
|
|
||
| Color oldBackground = gc.getBackground(); | ||
| Color highlightColor = item.getDisplay().getSystemColor( | ||
| highlight ? SWT.COLOR_LIST_SELECTION : SWT.COLOR_WIDGET_DISABLED_FOREGROUND); | ||
| gc.setBackground(highlightColor); | ||
|
Comment on lines
+1387
to
+1392
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: couldn't we just keep this part of the code as is? |
||
|
|
||
| int bottomY = y + height - 1; | ||
| int highlightY = onBottom ? bottomY - thickness : thickness + 1; | ||
|
|
||
| int[] shape2 = Arrays.copyOf(shape, shape.length); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please us more self-explaining names such as |
||
| // Update Y coordinates in shape to apply highlight thickness | ||
| shape2[1] = shape2[3] = shape2[shape2.length - 1] = shape2[shape2.length - 3] = highlightY; | ||
| gc.fillPolygon(shape2); | ||
| gc.setBackground(oldBackground); | ||
| } | ||
|
|
||
| // draw outline | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be sufficient to only have a higher top margin but keep the bottom one as is? Or do we want to increase the padding consistently or even also have issues there?