diff options
author | Veronika Irvine <veronika> | 2004-01-23 20:17:53 +0000 |
---|---|---|
committer | Veronika Irvine <veronika> | 2004-01-23 20:17:53 +0000 |
commit | 51bc60710247764b31d3543822de271b4d4c5890 (patch) | |
tree | d52ab6489771fe95662aa233861177415b10aa00 /bundles | |
parent | f4b24ed8afb282f7031daa35f99df80c4954629f (diff) | |
download | eclipse.platform.swt-51bc60710247764b31d3543822de271b4d4c5890.tar.gz eclipse.platform.swt-51bc60710247764b31d3543822de271b4d4c5890.tar.xz eclipse.platform.swt-51bc60710247764b31d3543822de271b4d4c5890.zip |
*** empty log message ***
Diffstat (limited to 'bundles')
2 files changed, 46 insertions, 5 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CLabel.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CLabel.java index 6a71a78045..ac95e8e725 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CLabel.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CLabel.java @@ -125,6 +125,7 @@ public CLabel(Composite parent, int style) { * Check the style bits to ensure that no invalid styles are applied. */ private static int checkStyle (int style) { + if ((style & SWT.BORDER) != 0) style |= SWT.SHADOW_IN; int mask = SWT.SHADOW_IN | SWT.SHADOW_OUT | SWT.SHADOW_NONE | SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT; style = style & mask; style |= SWT.NO_FOCUS; @@ -357,8 +358,18 @@ private void onPaint(PaintEvent event) { if (backgroundImage != null) { // draw a background image behind the text Rectangle imageRect = backgroundImage.getBounds(); - gc.drawImage(backgroundImage, 0, 0, imageRect.width, imageRect.height, - 0, 0, rect.width, rect.height); + // tile image to fill space + gc.setBackground(getBackground()); + gc.fillRectangle(rect); + int xPos = 0; + while (xPos < rect.width) { + int yPos = 0; + while (yPos < rect.height) { + gc.drawImage(backgroundImage, xPos, yPos); + yPos += imageRect.height; + } + xPos += imageRect.width; + } } else if (gradientColors != null) { // draw a gradient behind the text final Color oldBackground = gc.getBackground(); @@ -369,7 +380,8 @@ private void onPaint(PaintEvent event) { final Color oldForeground = gc.getForeground(); Color lastColor = gradientColors[0]; if (lastColor == null) lastColor = oldBackground; - for (int i = 0, pos = 0; i < gradientPercents.length; ++i) { + int pos = 0; + for (int i = 0; i < gradientPercents.length; ++i) { gc.setForeground(lastColor); lastColor = gradientColors[i + 1]; if (lastColor == null) lastColor = oldBackground; @@ -384,6 +396,14 @@ private void onPaint(PaintEvent event) { pos += gradientWidth; } } + if (gradientVertical && pos < rect.height) { + gc.setBackground(getBackground()); + gc.fillRectangle(0, pos, rect.width, rect.height - pos); + } + if (!gradientVertical && pos < rect.width) { + gc.setBackground(getBackground()); + gc.fillRectangle(pos, 0, rect.width - pos, rect.height); + } gc.setForeground(oldForeground); } gc.setBackground(oldBackground); diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder2.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder2.java index 35a3f653b0..45649a728f 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder2.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder2.java @@ -1157,6 +1157,7 @@ void drawExpand(GC gc) { } void drawSelectionBackground(GC gc, int[] shape) { if (backgroundImage != null) { + Point size = getSize(); // draw the background image in shape Region clipping = new Region(); gc.getClipping(clipping); @@ -1164,7 +1165,18 @@ void drawSelectionBackground(GC gc, int[] shape) { region.add(shape); gc.setClipping(region); gc.setBackground(selectionBackground); - gc.drawImage(backgroundImage, 0, 0); + gc.fillRectangle(0, 0, size.x, size.y); + // tile image to fill space + Rectangle imageRect = backgroundImage.getBounds(); + int xPos = 0; + while (xPos < size.x) { + int yPos = 0; + while (yPos < size.y) { + gc.drawImage(backgroundImage, xPos, yPos); + yPos += imageRect.height; + } + xPos += imageRect.width; + } gc.setClipping(clipping); clipping.dispose(); region.dispose(); @@ -1185,7 +1197,8 @@ void drawSelectionBackground(GC gc, int[] shape) { Color background = selectionBackground; Color lastColor = gradientColors[0]; if (lastColor == null) lastColor = background; - for (int i = 0, pos = 0; i < gradientPercents.length; ++i) { + int pos = 0; + for (int i = 0; i < gradientPercents.length; ++i) { gc.setForeground(lastColor); lastColor = gradientColors[i + 1]; if (lastColor == null) lastColor = background; @@ -1200,6 +1213,14 @@ void drawSelectionBackground(GC gc, int[] shape) { pos += gradientWidth; } } + if (gradientVertical && pos < size.y) { + gc.setBackground(getBackground()); + gc.fillRectangle(0, pos, size.x, size.y - pos); + } + if (!gradientVertical && pos < size.x) { + gc.setBackground(getBackground()); + gc.fillRectangle(pos, 0, size.x - pos, size.y); + } } gc.setClipping(clipping); clipping.dispose(); |