Changeset 241:b4846fd3437a
- Timestamp:
- 06/22/08 19:45:58
(7 months ago)
- Author:
- Frank Benoit <benoit@tionex.de>
- branch:
- default
- Message:
work on allow null strings and arrays
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r213 |
r241 |
|
| 346 | 346 | * @param string the new text |
|---|
| 347 | 347 | * |
|---|
| 348 | | * @exception IllegalArgumentException <ul> |
|---|
| 349 | | * <li>ERROR_NULL_ARGUMENT - if the text is null</li> |
|---|
| 350 | | * </ul> |
|---|
| 351 | 348 | * @exception DWTException <ul> |
|---|
| 352 | 349 | * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> |
|---|
| … | … | |
| 356 | 353 | public void setText (String string) { |
|---|
| 357 | 354 | checkWidget (); |
|---|
| 358 | | if (string is null) error (DWT.ERROR_NULL_ARGUMENT); |
|---|
| | 355 | // DWT extension: allow null string |
|---|
| | 356 | //if (string is null) error (DWT.ERROR_NULL_ARGUMENT); |
|---|
| 359 | 357 | text = string; |
|---|
| 360 | 358 | /* |
|---|
| r212 |
r241 |
|
| 172 | 172 | * @param string the new text |
|---|
| 173 | 173 | * |
|---|
| 174 | | * @exception IllegalArgumentException <ul> |
|---|
| 175 | | * <li>ERROR_NULL_ARGUMENT - if the text is null</li> |
|---|
| 176 | | * </ul> |
|---|
| 177 | 174 | * @exception DWTException <ul> |
|---|
| 178 | 175 | * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> |
|---|
| … | … | |
| 182 | 179 | public void setText (String string) { |
|---|
| 183 | 180 | checkWidget (); |
|---|
| 184 | | if (string is null) error (DWT.ERROR_NULL_ARGUMENT); |
|---|
| | 181 | // DWT extension: allow null string |
|---|
| | 182 | //if (string is null) error (DWT.ERROR_NULL_ARGUMENT); |
|---|
| 185 | 183 | text = string; |
|---|
| 186 | 184 | } |
|---|
| r213 |
r241 |
|
| 392 | 392 | * @param string the new text |
|---|
| 393 | 393 | * |
|---|
| 394 | | * @exception IllegalArgumentException <ul> |
|---|
| 395 | | * <li>ERROR_NULL_ARGUMENT - if the text is null</li> |
|---|
| 396 | | * </ul> |
|---|
| 397 | 394 | * @exception DWTException <ul> |
|---|
| 398 | 395 | * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> |
|---|
| … | … | |
| 402 | 399 | public void setText (String string) { |
|---|
| 403 | 400 | checkWidget (); |
|---|
| 404 | | if (string is null) error (DWT.ERROR_NULL_ARGUMENT); |
|---|
| 405 | 401 | // DWT extensions allow null argument |
|---|
| 406 | | //if ((style & DWT.SEPARATOR) !is 0) return; |
|---|
| | 402 | //if (string is null) error (DWT.ERROR_NULL_ARGUMENT); |
|---|
| | 403 | if ((style & DWT.SEPARATOR) !is 0) return; |
|---|
| 407 | 404 | /* |
|---|
| 408 | 405 | * Feature in Windows. For some reason, SetWindowText() for |
|---|
| r213 |
r241 |
|
| 671 | 671 | * @param string the new text |
|---|
| 672 | 672 | * |
|---|
| 673 | | * @exception IllegalArgumentException <ul> |
|---|
| 674 | | * <li>ERROR_NULL_ARGUMENT - if the text is null</li> |
|---|
| 675 | | * </ul> |
|---|
| 676 | 673 | * @exception DWTException <ul> |
|---|
| 677 | 674 | * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> |
|---|
| … | … | |
| 681 | 678 | public void setText (String string) { |
|---|
| 682 | 679 | checkWidget (); |
|---|
| 683 | | if (string is null) error (DWT.ERROR_NULL_ARGUMENT); |
|---|
| 684 | | if (string==/*eq*/text) return; |
|---|
| | 680 | // DWT extension: allow null string |
|---|
| | 681 | //if (string is null) error (DWT.ERROR_NULL_ARGUMENT); |
|---|
| | 682 | if (string.equals (text)) return; |
|---|
| 685 | 683 | text = string; |
|---|
| 686 | 684 | if (OS.COMCTL32_MAJOR >= 6) { |
|---|
| r214 |
r241 |
|
| 109 | 109 | * @param string the new item |
|---|
| 110 | 110 | * |
|---|
| 111 | | * @exception IllegalArgumentException <ul> |
|---|
| 112 | | * <li>ERROR_NULL_ARGUMENT - if the string is null</li> |
|---|
| 113 | | * </ul> |
|---|
| 114 | 111 | * @exception DWTException <ul> |
|---|
| 115 | 112 | * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> |
|---|
| … | … | |
| 121 | 118 | public void add (String string) { |
|---|
| 122 | 119 | checkWidget (); |
|---|
| 123 | | if (string is null) error (DWT.ERROR_NULL_ARGUMENT); |
|---|
| | 120 | // DWT extension: allow null string |
|---|
| | 121 | //if (string is null) error (DWT.ERROR_NULL_ARGUMENT); |
|---|
| 124 | 122 | TCHAR* buffer = StrToTCHARz ( getCodePage (), string); |
|---|
| 125 | 123 | int result = OS.SendMessage (handle, OS.LB_ADDSTRING, 0, buffer); |
|---|
| … | … | |
| 141 | 139 | * |
|---|
| 142 | 140 | * @exception IllegalArgumentException <ul> |
|---|
| 143 | | * <li>ERROR_NULL_ARGUMENT - if the string is null</li> |
|---|
| 144 | 141 | * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list (inclusive)</li> |
|---|
| 145 | 142 | * </ul> |
|---|
| … | … | |
| 153 | 150 | public void add (String string, int index) { |
|---|
| 154 | 151 | checkWidget (); |
|---|
| 155 | | if (string is null) error (DWT.ERROR_NULL_ARGUMENT); |
|---|
| | 152 | // DWT extension: allow null string |
|---|
| | 153 | //if (string is null) error (DWT.ERROR_NULL_ARGUMENT); |
|---|
| 156 | 154 | if (index is -1) error (DWT.ERROR_INVALID_RANGE); |
|---|
| 157 | 155 | TCHAR* buffer = StrToTCHARz(getCodePage (), string); |
|---|
| … | … | |
| 300 | 298 | * @param indices the array of indices for the items to deselect |
|---|
| 301 | 299 | * |
|---|
| 302 | | * @exception IllegalArgumentException <ul> |
|---|
| 303 | | * <li>ERROR_NULL_ARGUMENT - if the set of indices is null</li> |
|---|
| 304 | | * </ul> |
|---|
| 305 | 300 | * @exception DWTException <ul> |
|---|
| 306 | 301 | * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> |
|---|
| … | … | |
| 310 | 305 | public void deselect (int [] indices) { |
|---|
| 311 | 306 | checkWidget (); |
|---|
| 312 | | if (indices is null) error (DWT.ERROR_NULL_ARGUMENT); |
|---|
| | 307 | // DWT extension: allow null array |
|---|
| | 308 | //if (indices is null) error (DWT.ERROR_NULL_ARGUMENT); |
|---|
| 313 | 309 | if (indices.length is 0) return; |
|---|
| 314 | 310 | if ((style & DWT.SINGLE) !is 0) { |
|---|
| … | … | |
| 657 | 653 | * @return the index of the item |
|---|
| 658 | 654 | * |
|---|
| 659 | | * @exception IllegalArgumentException <ul> |
|---|
| 660 | | * <li>ERROR_NULL_ARGUMENT - if the string is null</li> |
|---|
| 661 | | * </ul> |
|---|
| 662 | 655 | * @exception DWTException <ul> |
|---|
| 663 | 656 | * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> |
|---|
| … | … | |
| 680 | 673 | * @return the index of the item |
|---|
| 681 | 674 | * |
|---|
| 682 | | * @exception IllegalArgumentException <ul> |
|---|
| 683 | | * <li>ERROR_NULL_ARGUMENT - if the string is null</li> |
|---|
| 684 | | * </ul> |
|---|
| 685 | 675 | * @exception DWTException <ul> |
|---|
| 686 | 676 | * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> |
|---|
| … | … | |
| 690 | 680 | public int indexOf (String string, int start) { |
|---|
| 691 | 681 | checkWidget (); |
|---|
| 692 | | if (string is null) error (DWT.ERROR_NULL_ARGUMENT); |
|---|
| | 682 | // DWT extension: allow null string |
|---|
| | 683 | //if (string is null) error (DWT.ERROR_NULL_ARGUMENT); |
|---|
| 693 | 684 | |
|---|
| 694 | 685 | /* |
|---|
| … | … | |
| 745 | 736 | * @exception IllegalArgumentException <ul> |
|---|
| 746 | 737 | * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li> |
|---|
| 747 | | * <li>ERROR_NULL_ARGUMENT - if the indices array is null</li> |
|---|
| 748 | 738 | * </ul> |
|---|
| 749 | 739 | * @exception DWTException <ul> |
|---|
| … | … | |
| 754 | 744 | public void remove (int [] indices) { |
|---|
| 755 | 745 | checkWidget (); |
|---|
| 756 | | if (indices is null) error (DWT.ERROR_NULL_ARGUMENT); |
|---|
| | 746 | // DWT extension: allow null array |
|---|
| | 747 | //if (indices is null) error (DWT.ERROR_NULL_ARGUMENT); |
|---|
| 757 | 748 | if (indices.length is 0) return; |
|---|
| 758 | 749 | int [] newIndices = new int [indices.length]; |
|---|
| … | … | |
| 935 | 926 | * |
|---|
| 936 | 927 | * @exception IllegalArgumentException <ul> |
|---|
| 937 | | * <li>ERROR_NULL_ARGUMENT - if the string is null</li> |
|---|
| 938 | 928 | * <li>ERROR_INVALID_ARGUMENT - if the string is not found in the list</li> |
|---|
| 939 | 929 | * </ul> |
|---|
| … | … | |
| 945 | 935 | public void remove (String string) { |
|---|
| 946 | 936 | checkWidget (); |
|---|
| 947 | | if (string is null) error (DWT.ERROR_NULL_ARGUMENT); |
|---|
| | 937 | // DWT extension: allow null string |
|---|
| | 938 | //if (string is null) error (DWT.ERROR_NULL_ARGUMENT); |
|---|
| 948 | 939 | int index = indexOf (string, 0); |
|---|
| 949 | 940 | if (index is -1) error (DWT.ERROR_INVALID_ARGUMENT); |
|---|
| … | … | |
| 1004 | 995 | * @param indices the array of indices for the items to select |
|---|
| 1005 | 996 | * |
|---|
| 1006 | | * @exception IllegalArgumentException <ul> |
|---|
| 1007 | | * <li>ERROR_NULL_ARGUMENT - if the array of indices is null</li> |
|---|
| 1008 | | * </ul> |
|---|
| 1009 | 997 | * @exception DWTException <ul> |
|---|
| 1010 | 998 | * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> |
|---|
| … | … | |
| 1016 | 1004 | public void select (int [] indices) { |
|---|
| 1017 | 1005 | checkWidget (); |
|---|
| 1018 | | if (indices is null) error (DWT.ERROR_NULL_ARGUMENT); |
|---|
| | 1006 | // DWT extension: allow null array |
|---|
| | 1007 | //if (indices is null) error (DWT.ERROR_NULL_ARGUMENT); |
|---|
| 1019 | 1008 | int length = indices.length; |
|---|
| 1020 | 1009 | if (length is 0 || ((style & DWT.SINGLE) !is 0 && length > 1)) return; |
|---|
| … | … | |
| 1188 | 1177 | * @exception IllegalArgumentException <ul> |
|---|
| 1189 | 1178 | * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li> |
|---|
| 1190 | | * <li>ERROR_NULL_ARGUMENT - if the string is null</li> |
|---|
| 1191 | 1179 | * </ul> |
|---|
| 1192 | 1180 | * @exception DWTException <ul> |
|---|
| … | … | |
| 1197 | 1185 | public void setItem (int index, String string) { |
|---|
| 1198 | 1186 | checkWidget (); |
|---|
| 1199 | | if (string is null) error (DWT.ERROR_NULL_ARGUMENT); |
|---|
| | 1187 | // DWT extension: allow null string |
|---|
| | 1188 | //if (string is null) error (DWT.ERROR_NULL_ARGUMENT); |
|---|
| 1200 | 1189 | int topIndex = getTopIndex (); |
|---|
| 1201 | 1190 | bool isSelected = isSelected (index); |
|---|
| … | … | |
| 1212 | 1201 | * |
|---|
| 1213 | 1202 | * @exception IllegalArgumentException <ul> |
|---|
| 1214 | | * <li>ERROR_NULL_ARGUMENT - if the items array is null</li> |
|---|
| 1215 | 1203 | * <li>ERROR_INVALID_ARGUMENT - if an item in the items array is null</li> |
|---|
| 1216 | 1204 | * </ul> |
|---|
| … | … | |
| 1222 | 1210 | public void setItems (String [] items) { |
|---|
| 1223 | 1211 | checkWidget (); |
|---|
| 1224 | | if (items is null) error (DWT.ERROR_NULL_ARGUMENT); |
|---|
| 1225 | | for (int i=0; i<items.length; i++) { |
|---|
| 1226 | | if (items [i] is null) error (DWT.ERROR_INVALID_ARGUMENT); |
|---|
| 1227 | | } |
|---|
| | 1212 | // DWT extension: allow null array |
|---|
| | 1213 | //if (items is null) error (DWT.ERROR_NULL_ARGUMENT); |
|---|
| | 1214 | // DWT extension: allow null item strings |
|---|
| | 1215 | //for (int i=0; i<items.length; i++) { |
|---|
| | 1216 | // if (items [i] is null) error (DWT.ERROR_INVALID_ARGUMENT); |
|---|
| | 1217 | //} |
|---|
| 1228 | 1218 | int /*long*/ oldProc = OS.GetWindowLongPtr (handle, OS.GWLP_WNDPROC); |
|---|
| 1229 | 1219 | OS.SetWindowLongPtr (handle, OS.GWLP_WNDPROC, cast(LONG_PTR) ListProc); |
|---|
| … | … | |
| 1343 | 1333 | * @param indices the indices of the items to select |
|---|
| 1344 | 1334 | * |
|---|
| 1345 | | * @exception IllegalArgumentException <ul> |
|---|
| 1346 | | * <li>ERROR_NULL_ARGUMENT - if the array of indices is null</li> |
|---|
| 1347 | | * </ul> |
|---|
| 1348 | 1335 | * @exception DWTException <ul> |
|---|
| 1349 | 1336 | * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> |
|---|
| … | … | |
| 1356 | 1343 | public void setSelection(int [] indices) { |
|---|
| 1357 | 1344 | checkWidget (); |
|---|
| 1358 | | if (indices is null) error (DWT.ERROR_NULL_ARGUMENT); |
|---|
| | 1345 | // DWT extension: allow null array |
|---|
| | 1346 | //if (indices is null) error (DWT.ERROR_NULL_ARGUMENT); |
|---|
| 1359 | 1347 | deselectAll (); |
|---|
| 1360 | 1348 | int length = indices.length; |
|---|
| … | … | |
| 1377 | 1365 | * @param items the array of items |
|---|
| 1378 | 1366 | * |
|---|
| 1379 | | * @exception IllegalArgumentException <ul> |
|---|
| 1380 | | * <li>ERROR_NULL_ARGUMENT - if the array of items is null</li> |
|---|
| 1381 | | * </ul> |
|---|
| 1382 | 1367 | * @exception DWTException <ul> |
|---|
| 1383 | 1368 | * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> |
|---|
| … | … | |
| 1391 | 1376 | public void setSelection (String [] items) { |
|---|
| 1392 | 1377 | checkWidget (); |
|---|
| 1393 | | if (items is null) error (DWT.ERROR_NULL_ARGUMENT); |
|---|
| | 1378 | // DWT extension: allow null array |
|---|
| | 1379 | //if (items is null) error (DWT.ERROR_NULL_ARGUMENT); |
|---|
| 1394 | 1380 | deselectAll (); |
|---|
| 1395 | 1381 | int length = items.length; |
|---|