Mercurial > projects > dwt-win
changeset 243:ecb80b2a89e1
work on allow null strings and arrays
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sat, 28 Jun 2008 20:18:36 +0200 |
parents | 32a6819fef61 |
children | a59d51c12b42 |
files | dwt/widgets/Table.d dwt/widgets/TableColumn.d dwt/widgets/Text.d dwt/widgets/ToolItem.d dwt/widgets/ToolTip.d dwt/widgets/Tracker.d dwt/widgets/Tree.d dwt/widgets/TreeColumn.d dwt/widgets/TreeItem.d dwt/widgets/Widget.d |
diffstat | 10 files changed, 51 insertions(+), 76 deletions(-) [+] |
line wrap: on
line diff
--- a/dwt/widgets/Table.d Tue Jun 24 22:05:28 2008 +0200 +++ b/dwt/widgets/Table.d Sat Jun 28 20:18:36 2008 +0200 @@ -1123,7 +1123,6 @@ * * @exception IllegalArgumentException <ul> * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li> - * <li>ERROR_NULL_ARGUMENT - if the indices array is null</li> * </ul> * @exception DWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> @@ -1137,7 +1136,8 @@ */ public void clear (int [] indices) { checkWidget (); - if (indices is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null array + //if (indices is null) error (DWT.ERROR_NULL_ARGUMENT); if (indices.length is 0) return; int count = OS.SendMessage (handle, OS.LVM_GETITEMCOUNT, 0, 0); for (int i=0; i<indices.length; i++) { @@ -1677,9 +1677,6 @@ * * @param indices the array of indices for the items to deselect * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the set of indices 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> @@ -1687,7 +1684,8 @@ */ public void deselect (int [] indices) { checkWidget (); - if (indices is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null array + //if (indices is null) error (DWT.ERROR_NULL_ARGUMENT); if (indices.length is 0) return; LVITEM lvItem; lvItem.stateMask = OS.LVIS_SELECTED; @@ -2913,7 +2911,6 @@ * * @exception IllegalArgumentException <ul> * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li> - * <li>ERROR_NULL_ARGUMENT - if the indices array is null</li> * </ul> * @exception DWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> @@ -2922,7 +2919,8 @@ */ public void remove (int [] indices) { checkWidget (); - if (indices is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null array + //if (indices is null) error (DWT.ERROR_NULL_ARGUMENT); if (indices.length is 0) return; int [] newIndices = new int [indices.length]; System.arraycopy (indices, 0, newIndices, 0, indices.length); @@ -3134,9 +3132,6 @@ * * @param indices the array of indices for the items to select * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the array of indices 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> @@ -3146,7 +3141,8 @@ */ public void select (int [] indices) { checkWidget (); - if (indices is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null array + //if (indices is null) error (DWT.ERROR_NULL_ARGUMENT); int length = indices.length; if (length is 0 || ((style & DWT.SINGLE) !is 0 && length > 1)) return; LVITEM lvItem; @@ -3962,7 +3958,6 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the item order is null</li> * <li>ERROR_INVALID_ARGUMENT - if the item order is not the same length as the number of items</li> * </ul> * @@ -3975,7 +3970,8 @@ */ public void setColumnOrder (int [] order) { checkWidget (); - if (order is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null array + //if (order is null) error (DWT.ERROR_NULL_ARGUMENT); auto hwndHeader = cast(HWND) OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0); if (columnCount is 0) { if (order.length !is 0) error (DWT.ERROR_INVALID_ARGUMENT); @@ -4698,9 +4694,6 @@ * * @param indices the indices of the items to select * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the array of indices 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> @@ -4711,7 +4704,8 @@ */ public void setSelection (int [] indices) { checkWidget (); - if (indices is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null array + //if (indices is null) error (DWT.ERROR_NULL_ARGUMENT); deselectAll (); int length = indices.length; if (length is 0 || ((style & DWT.SINGLE) !is 0 && length > 1)) return; @@ -4759,7 +4753,6 @@ * @param items the array of items * * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the array of items is null</li> * <li>ERROR_INVALID_ARGUMENT - if one of the items has been disposed</li> * </ul> * @exception DWTException <ul> @@ -4773,7 +4766,8 @@ */ public void setSelection (TableItem [] items) { checkWidget (); - if (items is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null array + //if (items is null) error (DWT.ERROR_NULL_ARGUMENT); deselectAll (); int length = items.length; if (length is 0 || ((style & DWT.SINGLE) !is 0 && length > 1)) return;
--- a/dwt/widgets/TableColumn.d Tue Jun 24 22:05:28 2008 +0200 +++ b/dwt/widgets/TableColumn.d Sat Jun 28 20:18:36 2008 +0200 @@ -780,8 +780,9 @@ override public void setText (String string) { checkWidget (); - if (string is null) error (DWT.ERROR_NULL_ARGUMENT); - if (string==/*eq*/text) return; + // DWT extension: allow null string + //if (string is null) error (DWT.ERROR_NULL_ARGUMENT); + if (string.equals (text)) return; int index = parent.indexOf (this); if (index is -1) return; super.setText (string);
--- a/dwt/widgets/Text.d Tue Jun 24 22:05:28 2008 +0200 +++ b/dwt/widgets/Text.d Sat Jun 28 20:18:36 2008 +0200 @@ -336,9 +336,6 @@ * * @param string the string to be appended * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the string 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> @@ -346,7 +343,8 @@ */ public void append (String string) { checkWidget (); - if (string is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null string + //if (string is null) error (DWT.ERROR_NULL_ARGUMENT); string = Display.withCrLf (string); int length = OS.GetWindowTextLength (handle); if (hooks (DWT.Verify) || filters (DWT.Verify)) { @@ -1209,9 +1207,6 @@ * * @param string the string * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the string is <code>null</code></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> @@ -1219,7 +1214,8 @@ */ public void insert (String string) { checkWidget (); - if (string is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null string + //if (string is null) error (DWT.ERROR_NULL_ARGUMENT); string = Display.withCrLf (string); if (hooks (DWT.Verify) || filters (DWT.Verify)) { int start, end; @@ -1657,9 +1653,6 @@ * * @param message the new message * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the message 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> @@ -1669,7 +1662,8 @@ */ public void setMessage (String message) { checkWidget (); - if (message is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null string + //if (message is null) error (DWT.ERROR_NULL_ARGUMENT); this.message = message; if (OS.COMCTL32_MAJOR >= 6) { if ((style & DWT.SEARCH) !is 0) { @@ -1877,9 +1871,6 @@ * * @param string the new text * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the string 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> @@ -1887,7 +1878,8 @@ */ public void setText (String string) { checkWidget (); - if (string is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null string + //if (string is null) error (DWT.ERROR_NULL_ARGUMENT); string = Display.withCrLf (string); if (hooks (DWT.Verify) || filters (DWT.Verify)) { int length = OS.GetWindowTextLength (handle);
--- a/dwt/widgets/ToolItem.d Tue Jun 24 22:05:28 2008 +0200 +++ b/dwt/widgets/ToolItem.d Sat Jun 28 20:18:36 2008 +0200 @@ -760,9 +760,6 @@ * * @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> @@ -770,9 +767,10 @@ */ override public void setText (String string) { checkWidget(); - if (string is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null string + //if (string is null) error (DWT.ERROR_NULL_ARGUMENT); if ((style & DWT.SEPARATOR) !is 0) return; - if (string==/*eq*/text) return; + if (string.equals(text)) return; super.setText (string); auto hwnd = parent.handle; TBBUTTONINFO info;
--- a/dwt/widgets/ToolTip.d Tue Jun 24 22:05:28 2008 +0200 +++ b/dwt/widgets/ToolTip.d Sat Jun 28 20:18:36 2008 +0200 @@ -394,9 +394,6 @@ * * @param string the new message * - * @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> @@ -404,7 +401,8 @@ */ public void setMessage (String string) { checkWidget (); - if (string is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null string + //if (string is null) error (DWT.ERROR_NULL_ARGUMENT); message = string; //TODO - update when visible } @@ -414,9 +412,6 @@ * * @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> @@ -424,7 +419,8 @@ */ public void setText (String string) { checkWidget (); - if (string is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null string + //if (string is null) error (DWT.ERROR_NULL_ARGUMENT); text = string; //TODO - update when visible }
--- a/dwt/widgets/Tracker.d Tue Jun 24 22:05:28 2008 +0200 +++ b/dwt/widgets/Tracker.d Sat Jun 28 20:18:36 2008 +0200 @@ -802,7 +802,7 @@ * @param rectangles the bounds of the rectangles to be drawn * * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the set of rectangles is null or contains a null rectangle</li> + * <li>ERROR_NULL_ARGUMENT - if the set of rectangles contains a null rectangle</li> * </ul> * @exception DWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> @@ -811,7 +811,8 @@ */ public void setRectangles (Rectangle [] rectangles) { checkWidget (); - if (rectangles is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null array + //if (rectangles is null) error (DWT.ERROR_NULL_ARGUMENT); this.rectangles = new Rectangle [rectangles.length]; for (int i = 0; i < rectangles.length; i++) { Rectangle current = rectangles [i];
--- a/dwt/widgets/Tree.d Tue Jun 24 22:05:28 2008 +0200 +++ b/dwt/widgets/Tree.d Sat Jun 28 20:18:36 2008 +0200 @@ -4520,7 +4520,6 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the item order is null</li> * <li>ERROR_INVALID_ARGUMENT - if the item order is not the same length as the number of items</li> * </ul> * @@ -4533,7 +4532,8 @@ */ public void setColumnOrder (int [] order) { checkWidget (); - if (order is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null array + //if (order is null) error (DWT.ERROR_NULL_ARGUMENT); if (columnCount is 0) { if (order.length !is 0) error (DWT.ERROR_INVALID_ARGUMENT); return; @@ -4900,7 +4900,6 @@ * @param items the array of items * * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the array of items is null</li> * <li>ERROR_INVALID_ARGUMENT - if one of the items has been disposed</li> * </ul> * @exception DWTException <ul> @@ -4912,7 +4911,8 @@ */ public void setSelection (TreeItem [] items) { checkWidget (); - if (items is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null array + //if (items is null) error (DWT.ERROR_NULL_ARGUMENT); int length = items.length; if (length is 0 || ((style & DWT.SINGLE) !is 0 && length > 1)) { deselectAll();
--- a/dwt/widgets/TreeColumn.d Tue Jun 24 22:05:28 2008 +0200 +++ b/dwt/widgets/TreeColumn.d Sat Jun 28 20:18:36 2008 +0200 @@ -658,7 +658,8 @@ override public void setText (String string) { checkWidget (); - if (string is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null string + //if (string is null) error (DWT.ERROR_NULL_ARGUMENT); if (string.equals (text)) return; int index = parent.indexOf (this); if (index is -1) return;
--- a/dwt/widgets/TreeItem.d Tue Jun 24 22:05:28 2008 +0200 +++ b/dwt/widgets/TreeItem.d Sat Jun 28 20:18:36 2008 +0200 @@ -1630,7 +1630,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> @@ -1642,7 +1641,8 @@ */ public void setImage (Image [] images) { checkWidget(); - if (images is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension; allow null array + //if (images is null) error (DWT.ERROR_NULL_ARGUMENT); for (int i=0; i<images.length; i++) { setImage (i, images [i]); } @@ -1750,9 +1750,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> @@ -1762,7 +1759,8 @@ */ public void setText (String[] strings) { checkWidget(); - if (strings is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null array + //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); @@ -1775,9 +1773,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> @@ -1787,7 +1782,8 @@ */ public void setText (int index, String string) { checkWidget(); - if (string is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null string + //if (string is null) error (DWT.ERROR_NULL_ARGUMENT); if (index is 0) { if (string==/*eq*/text) return; super.setText (string);
--- a/dwt/widgets/Widget.d Tue Jun 24 22:05:28 2008 +0200 +++ b/dwt/widgets/Widget.d Sat Jun 28 20:18:36 2008 +0200 @@ -568,9 +568,6 @@ * @param key the name of the property * @return the value of the property or null if it has not been set * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the key 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> @@ -580,7 +577,8 @@ */ public Object getData (String key) { checkWidget(); - if (key is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null key + //if (key is null) error (DWT.ERROR_NULL_ARGUMENT); if ((state & KEYED_DATA) !is 0) { Object [] table = (cast(ArrayWrapperObject) data).array; for (int i=1; i<table.length; i+=2) { @@ -1143,9 +1141,6 @@ * @param key the name of the property * @param value the new value for the property * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the key 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> @@ -1155,7 +1150,8 @@ */ public void setData (String key, Object value) { checkWidget(); - if (key.length is 0) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null key + //if (key.length is 0) error (DWT.ERROR_NULL_ARGUMENT); int index = 1; Object [] table = null; if ((state & KEYED_DATA) !is 0) {