comparison dwt/widgets/Label.d @ 212:ab60f3309436

reverted the char[] to String and use the an alias.
author Frank Benoit <benoit@tionex.de>
date Mon, 05 May 2008 00:12:38 +0200
parents bcdc37794717
children 36f5cb12e1a2
comparison
equal deleted inserted replaced
211:ff59aeb96cac 212:ab60f3309436
54 public class Label : Control { 54 public class Label : Control {
55 55
56 alias Control.computeSize computeSize; 56 alias Control.computeSize computeSize;
57 alias Control.windowProc windowProc; 57 alias Control.windowProc windowProc;
58 58
59 char[] text = ""; 59 String text = "";
60 Image image; 60 Image image;
61 static const int MARGIN = 4; 61 static const int MARGIN = 4;
62 static const bool IMAGE_AND_TEXT = false; 62 static const bool IMAGE_AND_TEXT = false;
63 private static /+const+/ WNDPROC LabelProc; 63 private static /+const+/ WNDPROC LabelProc;
64 static const TCHAR[] LabelClass = "STATIC\0"; 64 static const TCHAR[] LabelClass = "STATIC\0";
247 public Image getImage () { 247 public Image getImage () {
248 checkWidget (); 248 checkWidget ();
249 return image; 249 return image;
250 } 250 }
251 251
252 override char[] getNameText () { 252 override String getNameText () {
253 return getText (); 253 return getText ();
254 } 254 }
255 255
256 /** 256 /**
257 * Returns the receiver's text, which will be an empty 257 * Returns the receiver's text, which will be an empty
263 * @exception DWTException <ul> 263 * @exception DWTException <ul>
264 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> 264 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
265 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> 265 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
266 * </ul> 266 * </ul>
267 */ 267 */
268 public char[] getText () { 268 public String getText () {
269 checkWidget (); 269 checkWidget ();
270 if ((style & DWT.SEPARATOR) !is 0) return ""; 270 if ((style & DWT.SEPARATOR) !is 0) return "";
271 return text; 271 return text;
272 } 272 }
273 273
390 * @exception DWTException <ul> 390 * @exception DWTException <ul>
391 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> 391 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
392 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> 392 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
393 * </ul> 393 * </ul>
394 */ 394 */
395 public void setText (char[] string) { 395 public void setText (String string) {
396 checkWidget (); 396 checkWidget ();
397 if (string is null) error (DWT.ERROR_NULL_ARGUMENT); 397 if (string is null) error (DWT.ERROR_NULL_ARGUMENT);
398 // DWT extensions allow null argument 398 // DWT extensions allow null argument
399 //if ((style & DWT.SEPARATOR) !is 0) return; 399 //if ((style & DWT.SEPARATOR) !is 0) return;
400 /* 400 /*
451 if ((style & DWT.RIGHT) !is 0) return bits | OS.SS_RIGHT; 451 if ((style & DWT.RIGHT) !is 0) return bits | OS.SS_RIGHT;
452 if ((style & DWT.WRAP) !is 0) return bits | OS.SS_LEFT; 452 if ((style & DWT.WRAP) !is 0) return bits | OS.SS_LEFT;
453 return bits | OS.SS_LEFTNOWORDWRAP; 453 return bits | OS.SS_LEFTNOWORDWRAP;
454 } 454 }
455 455
456 override char[] windowClass () { 456 override String windowClass () {
457 return TCHARsToStr( LabelClass ); 457 return TCHARsToStr( LabelClass );
458 } 458 }
459 459
460 override int windowProc () { 460 override int windowProc () {
461 return cast(int) LabelProc; 461 return cast(int) LabelProc;