comparison dwt/widgets/Label.d @ 207:12feeed18183

Allow Label.setText with null argument.
author Frank Benoit <benoit@tionex.de>
date Sun, 09 Mar 2008 10:58:49 +0100
parents 17f8449522fd
children 380bad9f6852
comparison
equal deleted inserted replaced
206:3cb84407dc3e 207:12feeed18183
19 import dwt.graphics.Image; 19 import dwt.graphics.Image;
20 import dwt.widgets.Control; 20 import dwt.widgets.Control;
21 import dwt.widgets.Composite; 21 import dwt.widgets.Composite;
22 import dwt.widgets.ImageList; 22 import dwt.widgets.ImageList;
23 23
24 import tango.stdc.stringz; 24 import dwt.dwthelper.utils;
25 25
26 /** 26 /**
27 * Instances of this class represent a non-selectable 27 * Instances of this class represent a non-selectable
28 * user interface object that displays a string or image. 28 * user interface object that displays a string or image.
29 * When SEPARATOR is specified, displays a single 29 * When SEPARATOR is specified, displays a single
565 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> 565 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
566 * </ul> 566 * </ul>
567 */ 567 */
568 public void setText (char[] string) { 568 public void setText (char[] string) {
569 checkWidget (); 569 checkWidget ();
570 if (string is null) error (DWT.ERROR_NULL_ARGUMENT); 570 // DWT extension: allow null for zero length string
571 //if (string is null) error (DWT.ERROR_NULL_ARGUMENT);
571 if ((style & DWT.SEPARATOR) !is 0) return; 572 if ((style & DWT.SEPARATOR) !is 0) return;
572 text = string; 573 text = string;
573 char [] chars = fixMnemonic (string); 574 char [] chars = fixMnemonic (string);
574 OS.gtk_label_set_text_with_mnemonic (cast(GtkLabel*)labelHandle, toStringz(chars)); 575 OS.gtk_label_set_text_with_mnemonic (cast(GtkLabel*)labelHandle, chars.toStringzValidPtr());
575 OS.gtk_widget_hide (imageHandle); 576 OS.gtk_widget_hide (imageHandle);
576 OS.gtk_widget_show (labelHandle); 577 OS.gtk_widget_show (labelHandle);
577 } 578 }
578 579
579 override void showWidget () { 580 override void showWidget () {