diff dwt/graphics/TextStyle.d @ 45:d8635bb48c7c

Merge with SWT 3.5
author Jacob Carlborg <doob@me.com>
date Mon, 01 Dec 2008 17:07:00 +0100
parents 642f460a0908
children 535243e6d16a
line wrap: on
line diff
--- a/dwt/graphics/TextStyle.d	Tue Oct 21 15:20:04 2008 +0200
+++ b/dwt/graphics/TextStyle.d	Mon Dec 01 17:07:00 2008 +0100
@@ -1,5 +1,5 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+/*******************************************************************************
+ * Copyright (c) 2000, 2008 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -9,7 +9,7 @@
  *     IBM Corporation - initial API and implementation
  *     
  * Port to the D programming language:
- *     Jacob Carlborg <jacob.carlborg@gmail.com>
+ *     Jacob Carlborg <doob@me.com>
  *******************************************************************************/
 module dwt.graphics.TextStyle;
 
@@ -38,6 +38,8 @@
  * @see TextLayout
  * @see Font
  * @see Color
+ * @see <a href="http://www.eclipse.org/swt/snippets/#textlayout">TextLayout, TextStyle snippets</a>
+ * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
  *  
  * @since 3.0
  */
@@ -163,7 +165,7 @@
 public this (Font font, Color foreground, Color background) {
     if (font !is null && font.isDisposed()) DWT.error (DWT.ERROR_INVALID_ARGUMENT);
     if (foreground !is null && foreground.isDisposed()) DWT.error (DWT.ERROR_INVALID_ARGUMENT);
-    if (background !is null && background.isDisposed()) DWT.error (DWT.ERROR_INVALID_ARGUMENT);  
+    if (background !is null && background.isDisposed()) DWT.error (DWT.ERROR_INVALID_ARGUMENT); 
     this.font = font;
     this.foreground = foreground;
     this.background = background;
@@ -173,7 +175,7 @@
 /** 
  * Create a new text style from an existing text style.
  * 
- *@param style the style to copy 
+ * @param style the style to copy 
  *
  * @since 3.4
  */
@@ -251,7 +253,7 @@
 public hash_t toHash() {
     hash_t hash = 0;
     if (foreground !is null) hash ^= foreground.hashCode();
-    if (background !is null) hash ^= background.hashCode();  
+    if (background !is null) hash ^= background.hashCode(); 
     if (font !is null) hash ^= font.hashCode();
     if (metrics !is null) hash ^= metrics.hashCode();
     if (underline) hash ^= hash;
@@ -272,7 +274,12 @@
     if (borderStyle !is style.borderStyle) return false;
     if (borderColor !is null) {
         if (!borderColor.equals(style.borderColor)) return false;
-    } else if (style.borderColor !is null) return false;
+    } else {
+        if (style.borderColor !is null) return false;
+        if (foreground !is null) {
+            if (!foreground.equals(style.foreground)) return false;
+        } else if (style.foreground !is null) return false;
+    }
     return true;
 }
 
@@ -283,7 +290,12 @@
     if (underlineStyle !is style.underlineStyle) return false;
     if (underlineColor !is null) {
         if (!underlineColor.equals(style.underlineColor)) return false;
-    } else if (style.underlineColor !is null) return false;
+    } else {
+        if (style.underlineColor !is null) return false;
+        if (foreground !is null) {
+            if (!foreground.equals(style.foreground)) return false;
+        } else if (style.foreground !is null) return false;
+    }
     return true;
 }
 
@@ -293,7 +305,12 @@
     if (strikeout !is style.strikeout) return false;
     if (strikeoutColor !is null) {
         if (!strikeoutColor.equals(style.strikeoutColor)) return false;
-    } else if (style.strikeoutColor !is null) return false;
+    } else {
+        if (style.strikeoutColor !is null) return false;
+        if (foreground !is null) {
+            if (!foreground.equals(style.foreground)) return false;
+        } else if (style.foreground !is null) return false;
+    }
     return true;
 }