Mercurial > projects > dwt-linux
comparison dwt/widgets/Button.d @ 248:34409a2fc053
Fix call OS.gtk_label_set_text_with_mnemonic with valid ptr, even for zero length strings.
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Thu, 22 May 2008 19:00:47 +0200 |
parents | ce446666f5a2 |
children | 5a30aa9820f3 |
comparison
equal
deleted
inserted
replaced
247:da992144273f | 248:34409a2fc053 |
---|---|
191 return size; | 191 return size; |
192 } | 192 } |
193 | 193 |
194 override void createHandle (int index) { | 194 override void createHandle (int index) { |
195 state |= HANDLE; | 195 state |= HANDLE; |
196 if ((style & (DWT.PUSH | DWT.TOGGLE)) is 0) state |= THEME_BACKGROUND; | 196 if ((style & (DWT.PUSH | DWT.TOGGLE)) is 0) state |= THEME_BACKGROUND; |
197 int bits = DWT.ARROW | DWT.TOGGLE | DWT.CHECK | DWT.RADIO | DWT.PUSH; | 197 int bits = DWT.ARROW | DWT.TOGGLE | DWT.CHECK | DWT.RADIO | DWT.PUSH; |
198 fixedHandle = cast(GtkWidget*)OS.g_object_new (display.gtk_fixed_get_type (), null); | 198 fixedHandle = cast(GtkWidget*)OS.g_object_new (display.gtk_fixed_get_type (), null); |
199 if (fixedHandle is null) error (DWT.ERROR_NO_HANDLES); | 199 if (fixedHandle is null) error (DWT.ERROR_NO_HANDLES); |
200 OS.gtk_fixed_set_has_window (cast(GtkFixed*)fixedHandle, true); | 200 OS.gtk_fixed_set_has_window (cast(GtkFixed*)fixedHandle, true); |
201 switch (style & bits) { | 201 switch (style & bits) { |
794 checkWidget (); | 794 checkWidget (); |
795 if (string is null) error (DWT.ERROR_NULL_ARGUMENT); | 795 if (string is null) error (DWT.ERROR_NULL_ARGUMENT); |
796 if ((style & DWT.ARROW) !is 0) return; | 796 if ((style & DWT.ARROW) !is 0) return; |
797 text = string; | 797 text = string; |
798 char [] chars = fixMnemonic (string); | 798 char [] chars = fixMnemonic (string); |
799 OS.gtk_label_set_text_with_mnemonic (cast(GtkLabel*)labelHandle, toStringz(chars)); | 799 OS.gtk_label_set_text_with_mnemonic (cast(GtkLabel*)labelHandle, chars.toStringzValidPtr() ); |
800 if (image is null) OS.gtk_widget_hide (imageHandle); | 800 if (image is null) OS.gtk_widget_hide (imageHandle); |
801 OS.gtk_widget_show (labelHandle); | 801 OS.gtk_widget_show (labelHandle); |
802 _setAlignment (style); | 802 _setAlignment (style); |
803 } | 803 } |
804 | 804 |