|
Lines 1-5
Link Here
|
| 1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
| 2 |
* Copyright (c) 2007 IBM Corporation and others. |
2 |
* Copyright (c) 2007, 2008 IBM Corporation and others. |
| 3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
| 5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
|
Lines 7-22
Link Here
|
| 7 |
* |
7 |
* |
| 8 |
* Contributors: |
8 |
* Contributors: |
| 9 |
* IBM Corporation - initial API and implementation |
9 |
* IBM Corporation - initial API and implementation |
|
|
10 |
* Wang Yizhuo (wangyizhuo@gmail.com) - patch (see Bugzilla #239178) |
| 10 |
*******************************************************************************/ |
11 |
*******************************************************************************/ |
| 11 |
package org.eclipse.ui.internal.forms.widgets; |
12 |
package org.eclipse.ui.internal.forms.widgets; |
| 12 |
|
13 |
|
| 13 |
//import java.util.Arrays; |
14 |
//import java.util.Arrays; |
| 14 |
import java.util.HashMap; |
15 |
import java.util.HashMap; |
| 15 |
|
16 |
|
|
|
17 |
import org.eclipse.jface.resource.ImageDescriptor; |
| 18 |
//import org.eclipse.jface.resource.JFaceResources; |
| 19 |
//import org.eclipse.jface.resource.LocalResourceManager; |
| 16 |
import org.eclipse.swt.graphics.Color; |
20 |
import org.eclipse.swt.graphics.Color; |
|
|
21 |
//import org.eclipse.swt.graphics.Device; |
| 17 |
//import org.eclipse.swt.graphics.GC; |
22 |
//import org.eclipse.swt.graphics.GC; |
| 18 |
import org.eclipse.swt.graphics.Image; |
23 |
import org.eclipse.swt.graphics.Image; |
| 19 |
import org.eclipse.swt.widgets.Display; |
24 |
//import org.eclipse.swt.graphics.ImageData; |
|
|
25 |
import org.eclipse.swt.graphics.RGB; |
| 20 |
|
26 |
|
| 21 |
public class FormImages { |
27 |
public class FormImages { |
| 22 |
private static FormImages instance; |
28 |
private static FormImages instance; |
|
Lines 27-56
Link Here
|
| 27 |
return instance; |
33 |
return instance; |
| 28 |
} |
34 |
} |
| 29 |
|
35 |
|
| 30 |
private HashMap images; |
36 |
// private LocalResourceManager resources; |
| 31 |
private HashMap ids; |
37 |
private HashMap descriptors; |
| 32 |
|
38 |
|
| 33 |
private FormImages() { |
39 |
private FormImages() { |
| 34 |
} |
40 |
} |
| 35 |
|
41 |
|
| 36 |
private abstract class ImageIdentifier { |
42 |
private abstract class AbstractImageDescriptor extends ImageDescriptor { |
| 37 |
Display fDisplay; |
43 |
RGB[] fRGBs; |
| 38 |
Color[] fColors; |
|
|
| 39 |
int fLength; |
44 |
int fLength; |
| 40 |
|
45 |
|
| 41 |
ImageIdentifier(Display display, Color[] colors, int length) { |
46 |
AbstractImageDescriptor(Color[] colors, int length) { |
| 42 |
fDisplay = display; |
47 |
fRGBs = new RGB[colors.length]; |
| 43 |
fColors = colors; |
48 |
for (int i = 0; i < colors.length; i++) { |
|
|
49 |
Color color = colors[i]; |
| 50 |
fRGBs[i] = color == null ? null : color.getRGB(); |
| 51 |
} |
| 44 |
fLength = length; |
52 |
fLength = length; |
| 45 |
} |
53 |
} |
| 46 |
|
54 |
|
| 47 |
public boolean equals(Object obj) { |
55 |
public boolean equals(Object obj) { |
| 48 |
if (obj instanceof ImageIdentifier) { |
56 |
if (obj instanceof AbstractImageDescriptor) { |
| 49 |
ImageIdentifier id = (ImageIdentifier)obj; |
57 |
AbstractImageDescriptor id = (AbstractImageDescriptor)obj; |
| 50 |
if (id.fColors.length == fColors.length) { |
58 |
if (id.fRGBs.length == fRGBs.length) { |
| 51 |
boolean result = id.fDisplay.equals(fDisplay) && id.fLength == fLength; |
59 |
boolean result = id.fLength == fLength; |
| 52 |
for (int i = 0; i < fColors.length && result; i++) { |
60 |
for (int i = 0; i < fRGBs.length && result; i++) { |
| 53 |
result = result && id.fColors[i].equals(fColors[i]); |
61 |
result = result && id.fRGBs[i].equals(fRGBs[i]); |
| 54 |
} |
62 |
} |
| 55 |
return result; |
63 |
return result; |
| 56 |
} |
64 |
} |
|
Lines 59-87
Link Here
|
| 59 |
} |
67 |
} |
| 60 |
|
68 |
|
| 61 |
public int hashCode() { |
69 |
public int hashCode() { |
| 62 |
int hash = fDisplay.hashCode(); |
70 |
int hash = 0; |
| 63 |
for (int i = 0; i < fColors.length; i++) |
71 |
for (int i = 0; i < fRGBs.length; i++) |
| 64 |
hash = hash * 7 + fColors[i].hashCode(); |
72 |
hash = hash * 7 + fRGBs[i].hashCode(); |
| 65 |
hash = hash * 7 + fLength; |
73 |
hash = hash * 7 + fLength; |
| 66 |
return hash; |
74 |
return hash; |
| 67 |
} |
75 |
} |
| 68 |
} |
76 |
} |
| 69 |
|
77 |
|
| 70 |
// RAP [rh] Unused code: was used by getGradient |
78 |
// RAP [if] Unused code: was used by getGradient |
| 71 |
// private class SimpleImageIdentifier extends ImageIdentifier{ |
79 |
// private class SimpleImageDescriptor extends AbstractImageDescriptor{ |
| 72 |
// private int fTheight; |
80 |
// private int fTheight; |
| 73 |
// private int fMarginHeight; |
81 |
// private int fMarginHeight; |
| 74 |
// |
82 |
// |
| 75 |
// SimpleImageIdentifier (Display display, Color color1, Color color2, |
83 |
// SimpleImageDescriptor (Color color1, Color color2, |
| 76 |
// int realtheight, int theight, int marginHeight) { |
84 |
// int realtheight, int theight, int marginHeight) { |
| 77 |
// super(display, new Color[] {color1, color2}, realtheight); |
85 |
// super(new Color[] {color1, color2}, realtheight); |
| 78 |
// fTheight = theight; |
86 |
// fTheight = theight; |
| 79 |
// fMarginHeight = marginHeight; |
87 |
// fMarginHeight = marginHeight; |
| 80 |
// } |
88 |
// } |
| 81 |
// |
89 |
// |
| 82 |
// public boolean equals(Object obj) { |
90 |
// public boolean equals(Object obj) { |
| 83 |
// if (obj instanceof SimpleImageIdentifier) { |
91 |
// if (obj instanceof SimpleImageDescriptor) { |
| 84 |
// SimpleImageIdentifier id = (SimpleImageIdentifier) obj; |
92 |
// SimpleImageDescriptor id = (SimpleImageDescriptor) obj; |
| 85 |
// if (super.equals(obj) && |
93 |
// if (super.equals(obj) && |
| 86 |
// id.fTheight == fTheight && id.fMarginHeight == fMarginHeight) |
94 |
// id.fTheight == fTheight && id.fMarginHeight == fMarginHeight) |
| 87 |
// return true; |
95 |
// return true; |
|
Lines 95-122
Link Here
|
| 95 |
// hash = hash * 7 + new Integer(fMarginHeight).hashCode(); |
103 |
// hash = hash * 7 + new Integer(fMarginHeight).hashCode(); |
| 96 |
// return hash; |
104 |
// return hash; |
| 97 |
// } |
105 |
// } |
|
|
106 |
// |
| 107 |
// public ImageData getImageData() { |
| 108 |
// return null; |
| 109 |
// } |
| 110 |
// |
| 111 |
// public Image createImage(boolean returnMissingImageOnError, Device device) { |
| 112 |
// Image image = new Image(device, 1, fLength); |
| 113 |
// Color color1 = new Color(device, fRGBs[0]); |
| 114 |
// Color color2 = new Color(device, fRGBs[1]); |
| 115 |
// image.setBackground(color1); |
| 116 |
// GC gc = new GC(image); |
| 117 |
// gc.setBackground(color1); |
| 118 |
// gc.fillRectangle(0, 0, 1, fLength); |
| 119 |
// gc.setForeground(color2); |
| 120 |
// gc.setBackground(color1); |
| 121 |
// gc.fillGradientRectangle(0, fMarginHeight + 2, 1, fTheight - 2, true); |
| 122 |
// gc.dispose(); |
| 123 |
// color1.dispose(); |
| 124 |
// color2.dispose(); |
| 125 |
// return image; |
| 126 |
// } |
| 98 |
// } |
127 |
// } |
| 99 |
// |
128 |
|
| 100 |
// private class ComplexImageIdentifier extends ImageIdentifier { |
129 |
// private class ComplexImageDescriptor extends AbstractImageDescriptor { |
| 101 |
// Color fBg; |
130 |
// RGB fBgRGB; |
| 102 |
// boolean fVertical; |
131 |
// boolean fVertical; |
| 103 |
// int[] fPercents; |
132 |
// int[] fPercents; |
| 104 |
// |
133 |
// |
| 105 |
// public ComplexImageIdentifier(Display display, Color[] colors, int length, |
134 |
// public ComplexImageDescriptor(Color[] colors, int length, |
| 106 |
// int[] percents, boolean vertical, Color bg) { |
135 |
// int[] percents, boolean vertical, Color bg) { |
| 107 |
// super(display, colors, length); |
136 |
// super(colors, length); |
| 108 |
// fBg = bg; |
137 |
// fBgRGB = bg == null ? null : bg.getRGB(); |
| 109 |
// fVertical = vertical; |
138 |
// fVertical = vertical; |
| 110 |
// fPercents = percents; |
139 |
// fPercents = percents; |
| 111 |
// } |
140 |
// } |
| 112 |
// |
141 |
// |
| 113 |
// public boolean equals(Object obj) { |
142 |
// public boolean equals(Object obj) { |
| 114 |
// if (obj instanceof ComplexImageIdentifier) { |
143 |
// if (obj instanceof ComplexImageDescriptor) { |
| 115 |
// ComplexImageIdentifier id = (ComplexImageIdentifier) obj; |
144 |
// ComplexImageDescriptor id = (ComplexImageDescriptor) obj; |
| 116 |
// if (super.equals(obj) && |
145 |
// if (super.equals(obj) && |
| 117 |
// id.fVertical == fVertical && Arrays.equals(id.fPercents, fPercents)) { |
146 |
// id.fVertical == fVertical && Arrays.equals(id.fPercents, fPercents)) { |
| 118 |
// if ((id.fBg == null && fBg == null) || |
147 |
// if ((id.fBgRGB == null && fBgRGB == null) || |
| 119 |
// (id.fBg != null && id.fBg.equals(fBg))) |
148 |
// (id.fBgRGB != null && id.fBgRGB.equals(fBgRGB))) |
| 120 |
// return true; |
149 |
// return true; |
| 121 |
// // if the only thing that isn't the same is the background color |
150 |
// // if the only thing that isn't the same is the background color |
| 122 |
// // still return true if it does not matter (percents add up to 100) |
151 |
// // still return true if it does not matter (percents add up to 100) |
|
Lines 137-304
Link Here
|
| 137 |
// hash = hash * 7 + new Integer(fPercents[i]).hashCode(); |
166 |
// hash = hash * 7 + new Integer(fPercents[i]).hashCode(); |
| 138 |
// return hash; |
167 |
// return hash; |
| 139 |
// } |
168 |
// } |
|
|
169 |
// |
| 170 |
// public ImageData getImageData() { |
| 171 |
// return null; |
| 172 |
// } |
| 173 |
// |
| 174 |
// public Image createImage(boolean returnMissingImageOnError, Device device) { |
| 175 |
// int width = fVertical ? 1 : fLength; |
| 176 |
// int height = fVertical ? fLength : 1; |
| 177 |
// Image gradient = new Image(device, Math.max(width, 1), Math |
| 178 |
// .max(height, 1)); |
| 179 |
// GC gc = new GC(gradient); |
| 180 |
// Color[] colors = new Color[fRGBs.length]; |
| 181 |
// for (int i = 0; i < colors.length; i++) |
| 182 |
// colors[i] = new Color(device, fRGBs[i]); |
| 183 |
// Color bg = fBgRGB == null ? null : new Color(device, fBgRGB); |
| 184 |
// drawTextGradient(gc, width, height, colors, fPercents, fVertical, bg); |
| 185 |
// gc.dispose(); |
| 186 |
// for (int i = 0; i < colors.length; i++) |
| 187 |
// colors[i].dispose(); |
| 188 |
// if (bg != null) |
| 189 |
// bg.dispose(); |
| 190 |
// return gradient; |
| 191 |
// } |
| 192 |
// |
| 193 |
// private void drawTextGradient(GC gc, int width, int height, Color[] colors, |
| 194 |
// int[] percents, boolean vertical, Color bg) { |
| 195 |
// final Color oldBackground = gc.getBackground(); |
| 196 |
// if (colors.length == 1) { |
| 197 |
// if (colors[0] != null) |
| 198 |
// gc.setBackground(colors[0]); |
| 199 |
// gc.fillRectangle(0, 0, width, height); |
| 200 |
// } else { |
| 201 |
// final Color oldForeground = gc.getForeground(); |
| 202 |
// Color lastColor = colors[0]; |
| 203 |
// if (lastColor == null) |
| 204 |
// lastColor = oldBackground; |
| 205 |
// int pos = 0; |
| 206 |
// for (int i = 0; i < percents.length; ++i) { |
| 207 |
// gc.setForeground(lastColor); |
| 208 |
// lastColor = colors[i + 1]; |
| 209 |
// if (lastColor == null) |
| 210 |
// lastColor = oldBackground; |
| 211 |
// gc.setBackground(lastColor); |
| 212 |
// if (vertical) { |
| 213 |
// int gradientHeight = percents[i] * height / 100; |
| 214 |
// |
| 215 |
// gc.fillGradientRectangle(0, pos, width, gradientHeight, |
| 216 |
// true); |
| 217 |
// pos += gradientHeight; |
| 218 |
// } else { |
| 219 |
// int gradientWidth = percents[i] * width / 100; |
| 220 |
// |
| 221 |
// gc.fillGradientRectangle(pos, 0, gradientWidth, height, |
| 222 |
// false); |
| 223 |
// pos += gradientWidth; |
| 224 |
// } |
| 225 |
// } |
| 226 |
// if (vertical && pos < height) { |
| 227 |
// if (bg != null) |
| 228 |
// gc.setBackground(bg); |
| 229 |
// gc.fillRectangle(0, pos, width, height - pos); |
| 230 |
// } |
| 231 |
// if (!vertical && pos < width) { |
| 232 |
// if (bg != null) |
| 233 |
// gc.setBackground(bg); |
| 234 |
// gc.fillRectangle(pos, 0, width - pos, height); |
| 235 |
// } |
| 236 |
// gc.setForeground(oldForeground); |
| 237 |
// } |
| 238 |
// } |
| 140 |
// } |
239 |
// } |
| 141 |
|
240 |
|
| 142 |
private class ImageReference { |
241 |
// public Image getGradient(Color color1, Color color2, |
| 143 |
private Image fImage; |
|
|
| 144 |
private int fCount; |
| 145 |
|
| 146 |
public ImageReference(Image image) { |
| 147 |
fImage = image; |
| 148 |
fCount = 1; |
| 149 |
} |
| 150 |
|
| 151 |
public Image getImage() { |
| 152 |
return fImage; |
| 153 |
} |
| 154 |
// returns a boolean indicating if all clients of this image are finished |
| 155 |
// a true result indicates the underlying image should be disposed |
| 156 |
public boolean decCount() { |
| 157 |
return --fCount == 0; |
| 158 |
} |
| 159 |
public void incCount() { |
| 160 |
fCount++; |
| 161 |
} |
| 162 |
} |
| 163 |
|
| 164 |
// RAP [rh] missing Image-GC |
| 165 |
// public Image getGradient(Display display, Color color1, Color color2, |
| 166 |
// int realtheight, int theight, int marginHeight) { |
242 |
// int realtheight, int theight, int marginHeight) { |
| 167 |
// checkHashMaps(); |
243 |
// if (color1 == null || color1.isDisposed() || color2 == null || color2.isDisposed()) |
| 168 |
// ImageIdentifier id = new SimpleImageIdentifier(display, color1, color2, realtheight, theight, marginHeight); |
244 |
// return null; |
| 169 |
// ImageReference result = (ImageReference) images.get(id); |
245 |
// AbstractImageDescriptor desc = new SimpleImageDescriptor(color1, color2, realtheight, theight, marginHeight); |
| 170 |
// if (result != null && !result.getImage().isDisposed()) { |
246 |
// return getGradient(desc); |
| 171 |
// result.incCount(); |
|
|
| 172 |
// return result.getImage(); |
| 173 |
// } |
| 174 |
// Image image = createGradient(display, color1, color2, realtheight, theight, marginHeight); |
| 175 |
// images.put(id, new ImageReference(image)); |
| 176 |
// ids.put(image, id); |
| 177 |
// return image; |
| 178 |
// } |
247 |
// } |
| 179 |
// |
248 |
|
| 180 |
// public Image getGradient(Display display, Color[] colors, int[] percents, |
249 |
// public Image getGradient(Color[] colors, int[] percents, |
| 181 |
// int length, boolean vertical, Color bg) { |
250 |
// int length, boolean vertical, Color bg) { |
|
|
251 |
// if (colors.length == 0) |
| 252 |
// return null; |
| 253 |
// for (int i = 0; i < colors.length; i++) |
| 254 |
// if (colors[i] == null || colors[i].isDisposed()) |
| 255 |
// return null; |
| 256 |
// if (bg != null && bg.isDisposed()) |
| 257 |
// return null; |
| 258 |
// AbstractImageDescriptor desc = new ComplexImageDescriptor(colors, length, percents, vertical, bg); |
| 259 |
// return getGradient(desc); |
| 260 |
// } |
| 261 |
|
| 262 |
// private synchronized Image getGradient(AbstractImageDescriptor desc) { |
| 182 |
// checkHashMaps(); |
263 |
// checkHashMaps(); |
| 183 |
// ImageIdentifier id = new ComplexImageIdentifier(display, colors, length, percents, vertical, bg); |
264 |
// Image result = getResourceManager().createImage(desc); |
| 184 |
// ImageReference result = (ImageReference) images.get(id); |
265 |
// descriptors.put(result, desc); |
| 185 |
// if (result != null && !result.getImage().isDisposed()) { |
266 |
// return result; |
| 186 |
// result.incCount(); |
|
|
| 187 |
// return result.getImage(); |
| 188 |
// } |
| 189 |
// Image image = createGradient(display, colors, percents, length, vertical, bg); |
| 190 |
// images.put(id, new ImageReference(image)); |
| 191 |
// ids.put(image, id); |
| 192 |
// return image; |
| 193 |
// } |
267 |
// } |
| 194 |
|
268 |
|
| 195 |
public boolean markFinished(Image image) { |
269 |
public synchronized boolean markFinished(Image image) { |
| 196 |
checkHashMaps(); |
270 |
checkHashMaps(); |
| 197 |
ImageIdentifier id = (ImageIdentifier)ids.get(image); |
271 |
AbstractImageDescriptor desc = (AbstractImageDescriptor)descriptors.get(image); |
| 198 |
if (id != null) { |
272 |
if (desc != null) { |
| 199 |
ImageReference ref = (ImageReference) images.get(id); |
273 |
// RAP [if] unnecessary to destroy image |
| 200 |
if (ref != null) { |
274 |
// getResourceManager().destroyImage(desc); |
| 201 |
if (ref.decCount()) { |
275 |
// if (getResourceManager().find(desc) == null) { |
| 202 |
images.remove(id); |
276 |
descriptors.remove(image); |
| 203 |
ids.remove(ref.getImage()); |
277 |
validateHashMaps(); |
| 204 |
// RAP [rh] no Image#dispose() API |
278 |
// } |
| 205 |
// ref.getImage().dispose(); |
279 |
return true; |
| 206 |
validateHashMaps(); |
|
|
| 207 |
} |
| 208 |
return true; |
| 209 |
} |
| 210 |
} |
280 |
} |
| 211 |
// if the image was not found, dispose of it for the caller |
281 |
// if the image was not found, dispose of it for the caller |
| 212 |
// RAP [rh] no Image#dispose() API |
282 |
// RAP [if] unnecessary |
| 213 |
// image.dispose(); |
283 |
// image.dispose(); |
| 214 |
return false; |
284 |
return false; |
| 215 |
} |
285 |
} |
| 216 |
|
286 |
|
|
|
287 |
// RAP [if] unused |
| 288 |
// private LocalResourceManager getResourceManager() { |
| 289 |
// if (resources == null) |
| 290 |
// resources = new LocalResourceManager(JFaceResources.getResources()); |
| 291 |
// return resources; |
| 292 |
// } |
| 293 |
|
| 217 |
private void checkHashMaps() { |
294 |
private void checkHashMaps() { |
| 218 |
if (images == null) |
295 |
if (descriptors == null) |
| 219 |
images = new HashMap(); |
296 |
descriptors = new HashMap(); |
| 220 |
if (ids == null) |
|
|
| 221 |
ids = new HashMap(); |
| 222 |
} |
297 |
} |
| 223 |
|
298 |
|
| 224 |
private void validateHashMaps() { |
299 |
private void validateHashMaps() { |
| 225 |
if (images.size() == 0) |
300 |
if (descriptors.size() == 0) |
| 226 |
images = null; |
301 |
descriptors = null; |
| 227 |
if (ids.size() == 0) |
|
|
| 228 |
ids = null; |
| 229 |
} |
302 |
} |
| 230 |
|
|
|
| 231 |
// RAP [rh] Disabled unused code, called by getGradient |
| 232 |
// private Image createGradient(Display display, Color color1, Color color2, |
| 233 |
// int realtheight, int theight, int marginHeight) { |
| 234 |
// Image image = new Image(display, 1, realtheight); |
| 235 |
// image.setBackground(color1); |
| 236 |
// GC gc = new GC(image); |
| 237 |
// gc.setBackground(color1); |
| 238 |
// gc.fillRectangle(0, 0, 1, realtheight); |
| 239 |
// gc.setForeground(color2); |
| 240 |
// gc.setBackground(color1); |
| 241 |
// gc.fillGradientRectangle(0, marginHeight + 2, 1, theight - 2, true); |
| 242 |
// gc.dispose(); |
| 243 |
// return image; |
| 244 |
// } |
| 245 |
// |
| 246 |
// private Image createGradient(Display display, Color[] colors, int[] percents, |
| 247 |
// int length, boolean vertical, Color bg) { |
| 248 |
// int width = vertical ? 1 : length; |
| 249 |
// int height = vertical ? length : 1; |
| 250 |
// Image gradient = new Image(display, Math.max(width, 1), Math |
| 251 |
// .max(height, 1)); |
| 252 |
// GC gc = new GC(gradient); |
| 253 |
// drawTextGradient(gc, width, height, colors, percents, vertical, bg); |
| 254 |
// gc.dispose(); |
| 255 |
// return gradient; |
| 256 |
// } |
| 257 |
// |
| 258 |
// private void drawTextGradient(GC gc, int width, int height, Color[] colors, |
| 259 |
// int[] percents, boolean vertical, Color bg) { |
| 260 |
// final Color oldBackground = gc.getBackground(); |
| 261 |
// if (colors.length == 1) { |
| 262 |
// if (colors[0] != null) |
| 263 |
// gc.setBackground(colors[0]); |
| 264 |
// gc.fillRectangle(0, 0, width, height); |
| 265 |
// } else { |
| 266 |
// final Color oldForeground = gc.getForeground(); |
| 267 |
// Color lastColor = colors[0]; |
| 268 |
// if (lastColor == null) |
| 269 |
// lastColor = oldBackground; |
| 270 |
// int pos = 0; |
| 271 |
// for (int i = 0; i < percents.length; ++i) { |
| 272 |
// gc.setForeground(lastColor); |
| 273 |
// lastColor = colors[i + 1]; |
| 274 |
// if (lastColor == null) |
| 275 |
// lastColor = oldBackground; |
| 276 |
// gc.setBackground(lastColor); |
| 277 |
// if (vertical) { |
| 278 |
// int gradientHeight = percents[i] * height / 100; |
| 279 |
// |
| 280 |
// gc.fillGradientRectangle(0, pos, width, gradientHeight, |
| 281 |
// true); |
| 282 |
// pos += gradientHeight; |
| 283 |
// } else { |
| 284 |
// int gradientWidth = percents[i] * height / 100; |
| 285 |
// |
| 286 |
// gc.fillGradientRectangle(pos, 0, gradientWidth, height, |
| 287 |
// false); |
| 288 |
// pos += gradientWidth; |
| 289 |
// } |
| 290 |
// } |
| 291 |
// if (vertical && pos < height) { |
| 292 |
// if (bg != null) |
| 293 |
// gc.setBackground(bg); |
| 294 |
// gc.fillRectangle(0, pos, width, height - pos); |
| 295 |
// } |
| 296 |
// if (!vertical && pos < width) { |
| 297 |
// if (bg != null) |
| 298 |
// gc.setBackground(bg); |
| 299 |
// gc.fillRectangle(pos, 0, width - pos, height); |
| 300 |
// } |
| 301 |
// gc.setForeground(oldForeground); |
| 302 |
// } |
| 303 |
// } |
| 304 |
} |
303 |
} |