Mercurial > projects > dwt-linux
diff dwt/widgets/TreeItem.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 | ce446666f5a2 |
children | c0d810de7093 |
line wrap: on
line diff
--- a/dwt/widgets/TreeItem.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/widgets/TreeItem.d Sun Jun 15 22:32:20 2008 +0200 @@ -27,7 +27,6 @@ import dwt.widgets.Tree; import dwt.widgets.ImageList; -static import tango.stdc.stringz; import Math = tango.math.Math; /** @@ -289,7 +288,7 @@ int modelIndex = parent.columnCount is 0 ? Tree.FIRST_COLUMN : parent.columns [index].modelIndex; OS.gtk_tree_model_get1 (parent.modelHandle, handle, modelIndex + Tree.CELL_TEXT, &ptr); if (ptr is null) return ""; //$NON-NLS-1$ - char[] buffer = tango.stdc.stringz.fromStringz( cast(char*)ptr).dup; + char[] buffer = fromStringz( cast(char*)ptr).dup; OS.g_free (ptr); return buffer; } @@ -1657,7 +1656,6 @@ * @param images the array of new images * * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the array of images is null</li> * <li>ERROR_INVALID_ARGUMENT - if one of the images has been disposed</li> * </ul> * @exception DWTException <ul> @@ -1669,7 +1667,8 @@ */ public void setImage (Image [] images) { checkWidget (); - if (images is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (images is null) error (DWT.ERROR_NULL_ARGUMENT); for (int i=0; i<images.length; i++) { setImage (i, images [i]); } @@ -1699,9 +1698,6 @@ * @param index the column index * @param string the new text * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the text is null</li> - * </ul> * @exception DWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -1711,11 +1707,12 @@ */ public void setText (int index, String string) { checkWidget (); - if (string is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (string is null) error (DWT.ERROR_NULL_ARGUMENT); if (_getText (index).equals (string)) return; int count = Math.max (1, parent.getColumnCount ()); if (0 > index || index > count - 1) return; - char* buffer = tango.stdc.stringz.toStringz(string); + char* buffer = toStringz(string); int modelIndex = parent.columnCount is 0 ? Tree.FIRST_COLUMN : parent.columns [index].modelIndex; OS.gtk_tree_store_set1 (parent.modelHandle, cast(GtkTreeIter*)handle, modelIndex + Tree.CELL_TEXT, buffer); /* @@ -1741,9 +1738,6 @@ * * @param strings the array of new strings * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the text is null</li> - * </ul> * @exception DWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -1753,7 +1747,8 @@ */ public void setText (String [] strings) { checkWidget (); - if (strings is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (strings is null) error (DWT.ERROR_NULL_ARGUMENT); for (int i=0; i<strings.length; i++) { String string = strings [i]; if (string !is null) setText (i, string);