comparison dwtx/jface/text/TextAttribute.d @ 162:1a5b8f8129df

...
author Frank Benoit <benoit@tionex.de>
date Mon, 08 Sep 2008 00:51:37 +0200
parents 3678e4f1a766
children
comparison
equal deleted inserted replaced
161:f8d52b926852 162:1a5b8f8129df
191 /** Background color */ 191 /** Background color */
192 private Color background; 192 private Color background;
193 193
194 /** The text style */ 194 /** The text style */
195 private int style; 195 private int style;
196 196
197 /** 197 /**
198 * The text font. 198 * The text font.
199 * @since 3.3 199 * @since 3.3
200 */ 200 */
201 private Font font; 201 private Font font;
216 public this(Color foreground, Color background, int style) { 216 public this(Color foreground, Color background, int style) {
217 this.foreground= foreground; 217 this.foreground= foreground;
218 this.background= background; 218 this.background= background;
219 this.style= style; 219 this.style= style;
220 } 220 }
221 221
222 /** 222 /**
223 * Creates a text attribute with the given colors and style. 223 * Creates a text attribute with the given colors and style.
224 * 224 *
225 * @param foreground the foreground color, <code>null</code> if none 225 * @param foreground the foreground color, <code>null</code> if none
226 * @param background the background color, <code>null</code> if none 226 * @param background the background color, <code>null</code> if none
254 return true; 254 return true;
255 255
256 if (!( cast(TextAttribute)object )) 256 if (!( cast(TextAttribute)object ))
257 return false; 257 return false;
258 TextAttribute a= cast(TextAttribute)object; 258 TextAttribute a= cast(TextAttribute)object;
259 259
260 return (a.style is style && equals(a.foreground, foreground) && equals(a.background, background) && equals(a.font, font)); 260 return (a.style is style && equals(a.foreground, foreground) && equals(a.background, background) && equals(a.font, font));
261 } 261 }
262 262
263 /** 263 /**
264 * Returns whether the two given objects are equal. 264 * Returns whether the two given objects are equal.
268 * @return <code>true</code> if the given objects are equals 268 * @return <code>true</code> if the given objects are equals
269 * @since 2.0 269 * @since 2.0
270 */ 270 */
271 private bool equals(Object o1, Object o2) { 271 private bool equals(Object o1, Object o2) {
272 if (o1 !is null) 272 if (o1 !is null)
273 return o1.equals(o2); 273 return cast(bool) o1.opEquals(o2);
274 return (o2 is null); 274 return (o2 is null);
275 } 275 }
276 276
277 /* 277 /*
278 * @see Object#hashCode() 278 * @see Object#hashCode()
313 * @return the attribute's style 313 * @return the attribute's style
314 */ 314 */
315 public int getStyle() { 315 public int getStyle() {
316 return style; 316 return style;
317 } 317 }
318 318
319 /** 319 /**
320 * Returns the attribute's font. 320 * Returns the attribute's font.
321 * 321 *
322 * @return the attribute's font or <code>null</code> if not set 322 * @return the attribute's font or <code>null</code> if not set
323 * @since 3.3 323 * @since 3.3