comparison dwt/widgets/Button.d @ 255:5a30aa9820f3

removed tango.stdc.stringz imports and allow null for arrays and string arguments.
author Frank Benoit <benoit@tionex.de>
date Sun, 15 Jun 2008 22:32:20 +0200
parents 34409a2fc053
children c0d810de7093
comparison
equal deleted inserted replaced
254:8bca790583c3 255:5a30aa9820f3
24 import dwt.widgets.Composite; 24 import dwt.widgets.Composite;
25 import dwt.events.SelectionListener; 25 import dwt.events.SelectionListener;
26 import dwt.widgets.TypedListener; 26 import dwt.widgets.TypedListener;
27 import dwt.widgets.Decorations; 27 import dwt.widgets.Decorations;
28 28
29 import tango.stdc.stringz;
30 import tango.io.Stdout; 29 import tango.io.Stdout;
31 30
32 /** 31 /**
33 * Instances of this class represent a selectable user interface object that 32 * Instances of this class represent a selectable user interface object that
34 * issues notification when pressed and released. 33 * issues notification when pressed and released.
780 * a Button that has an image and text set into it will display the 779 * a Button that has an image and text set into it will display the
781 * image or text that was set most recently. 780 * image or text that was set most recently.
782 * </p> 781 * </p>
783 * @param string the new text 782 * @param string the new text
784 * 783 *
785 * @exception IllegalArgumentException <ul>
786 * <li>ERROR_NULL_ARGUMENT - if the text is null</li>
787 * </ul>
788 * @exception DWTException <ul> 784 * @exception DWTException <ul>
789 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> 785 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
790 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> 786 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
791 * </ul> 787 * </ul>
792 */ 788 */
793 public void setText (String string) { 789 public void setText (String string) {
794 checkWidget (); 790 checkWidget ();
795 if (string is null) error (DWT.ERROR_NULL_ARGUMENT); 791 // DWT extension: allow null for zero length string
792 //if (string is null) error (DWT.ERROR_NULL_ARGUMENT);
796 if ((style & DWT.ARROW) !is 0) return; 793 if ((style & DWT.ARROW) !is 0) return;
797 text = string; 794 text = string;
798 char [] chars = fixMnemonic (string); 795 char [] chars = fixMnemonic (string);
799 OS.gtk_label_set_text_with_mnemonic (cast(GtkLabel*)labelHandle, chars.toStringzValidPtr() ); 796 OS.gtk_label_set_text_with_mnemonic (cast(GtkLabel*)labelHandle, chars.toStringzValidPtr() );
800 if (image is null) OS.gtk_widget_hide (imageHandle); 797 if (image is null) OS.gtk_widget_hide (imageHandle);