comparison org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/custom/CLabel.d @ 36:d46287db17ed

rakefile reorg, swt win phobosification
author Frank Benoit <benoit@tionex.de>
date Tue, 24 Mar 2009 08:48:41 +0100
parents 950d84783eac
children 536e43f63c81
comparison
equal deleted inserted replaced
35:634e4380db78 36:d46287db17ed
434 } 434 }
435 xPos += imageRect.width; 435 xPos += imageRect.width;
436 } 436 }
437 } else if (gradientColors !is null) { 437 } else if (gradientColors !is null) {
438 // draw a gradient behind the text 438 // draw a gradient behind the text
439 final Color oldBackground = gc.getBackground(); 439 Color oldBackground = gc.getBackground();
440 if (gradientColors.length is 1) { 440 if (gradientColors.length is 1) {
441 if (gradientColors[0] !is null) gc.setBackground(gradientColors[0]); 441 if (gradientColors[0] !is null) gc.setBackground(gradientColors[0]);
442 gc.fillRectangle(0, 0, rect.width, rect.height); 442 gc.fillRectangle(0, 0, rect.width, rect.height);
443 } else { 443 } else {
444 final Color oldForeground = gc.getForeground(); 444 Color oldForeground = gc.getForeground();
445 Color lastColor = gradientColors[0]; 445 Color lastColor = gradientColors[0];
446 if (lastColor is null) lastColor = oldBackground; 446 if (lastColor is null) lastColor = oldBackground;
447 int pos = 0; 447 int pos = 0;
448 for (int i = 0; i < gradientPercents.length; ++i) { 448 for (int i = 0; i < gradientPercents.length; ++i) {
449 gc.setForeground(lastColor); 449 gc.setForeground(lastColor);
450 lastColor = gradientColors[i + 1]; 450 lastColor = gradientColors[i + 1];
451 if (lastColor is null) lastColor = oldBackground; 451 if (lastColor is null) lastColor = oldBackground;
452 gc.setBackground(lastColor); 452 gc.setBackground(lastColor);
453 if (gradientVertical) { 453 if (gradientVertical) {
454 final int gradientHeight = (gradientPercents[i] * rect.height / 100) - pos; 454 int gradientHeight = (gradientPercents[i] * rect.height / 100) - pos;
455 gc.fillGradientRectangle(0, pos, rect.width, gradientHeight, true); 455 gc.fillGradientRectangle(0, pos, rect.width, gradientHeight, true);
456 pos += gradientHeight; 456 pos += gradientHeight;
457 } else { 457 } else {
458 final int gradientWidth = (gradientPercents[i] * rect.width / 100) - pos; 458 int gradientWidth = (gradientPercents[i] * rect.width / 100) - pos;
459 gc.fillGradientRectangle(pos, 0, gradientWidth, rect.height, false); 459 gc.fillGradientRectangle(pos, 0, gradientWidth, rect.height, false);
460 pos += gradientWidth; 460 pos += gradientWidth;
461 } 461 }
462 } 462 }
463 if (gradientVertical && pos < rect.height) { 463 if (gradientVertical && pos < rect.height) {
665 } 665 }
666 } 666 }
667 } 667 }
668 668
669 // Are these settings the same as before? 669 // Are these settings the same as before?
670 final Color background = getBackground(); 670 Color background = getBackground();
671 if (backgroundImage is null) { 671 if (backgroundImage is null) {
672 if ((gradientColors !is null) && (colors !is null) && 672 if ((gradientColors !is null) && (colors !is null) &&
673 (gradientColors.length is colors.length)) { 673 (gradientColors.length is colors.length)) {
674 bool same = false; 674 bool same = false;
675 for (int i = 0; i < gradientColors.length; i++) { 675 for (int i = 0; i < gradientColors.length; i++) {