comparison dwt/custom/CCombo.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
comparison
equal deleted inserted replaced
254:8bca790583c3 255:5a30aa9820f3
190 /** 190 /**
191 * Adds the argument to the end of the receiver's list. 191 * Adds the argument to the end of the receiver's list.
192 * 192 *
193 * @param string the new item 193 * @param string the new item
194 * 194 *
195 * @exception IllegalArgumentException <ul>
196 * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
197 * </ul>
198 * @exception DWTException <ul> 195 * @exception DWTException <ul>
199 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> 196 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
200 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> 197 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
201 * </ul> 198 * </ul>
202 * 199 *
203 * @see #add(String,int) 200 * @see #add(String,int)
204 */ 201 */
205 public void add (String string) { 202 public void add (String string) {
206 checkWidget(); 203 checkWidget();
207 if (string is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); 204 // DWT extension: allow null for zero length string
205 //if (string is null) DWT.error (DWT.ERROR_NULL_ARGUMENT);
208 list.add (string); 206 list.add (string);
209 } 207 }
210 /** 208 /**
211 * Adds the argument to the receiver's list at the given 209 * Adds the argument to the receiver's list at the given
212 * zero-relative index. 210 * zero-relative index.
218 * 216 *
219 * @param string the new item 217 * @param string the new item
220 * @param index the index for the item 218 * @param index the index for the item
221 * 219 *
222 * @exception IllegalArgumentException <ul> 220 * @exception IllegalArgumentException <ul>
223 * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
224 * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list (inclusive)</li> 221 * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list (inclusive)</li>
225 * </ul> 222 * </ul>
226 * @exception DWTException <ul> 223 * @exception DWTException <ul>
227 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> 224 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
228 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> 225 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
230 * 227 *
231 * @see #add(String) 228 * @see #add(String)
232 */ 229 */
233 public void add (String string, int index) { 230 public void add (String string, int index) {
234 checkWidget(); 231 checkWidget();
235 if (string is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); 232 // DWT extension: allow null for zero length string
233 //if (string is null) DWT.error (DWT.ERROR_NULL_ARGUMENT);
236 list.add (string, index); 234 list.add (string, index);
237 } 235 }
238 /** 236 /**
239 * Adds the listener to the collection of listeners who will 237 * Adds the listener to the collection of listeners who will
240 * be notified when the receiver's text is modified, by sending 238 * be notified when the receiver's text is modified, by sending
867 * is found, returns -1. 865 * is found, returns -1.
868 * 866 *
869 * @param string the search item 867 * @param string the search item
870 * @return the index of the item 868 * @return the index of the item
871 * 869 *
872 * @exception IllegalArgumentException <ul>
873 * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
874 * </ul>
875 * @exception DWTException <ul> 870 * @exception DWTException <ul>
876 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> 871 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
877 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> 872 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
878 * </ul> 873 * </ul>
879 */ 874 */
880 public int indexOf (String string) { 875 public int indexOf (String string) {
881 checkWidget (); 876 checkWidget ();
882 if (string is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); 877 // DWT extension: allow null for zero length string
878 //if (string is null) DWT.error (DWT.ERROR_NULL_ARGUMENT);
883 return list.indexOf (string); 879 return list.indexOf (string);
884 } 880 }
885 /** 881 /**
886 * Searches the receiver's list starting at the given, 882 * Searches the receiver's list starting at the given,
887 * zero-relative index until an item is found that is equal 883 * zero-relative index until an item is found that is equal
891 * 887 *
892 * @param string the search item 888 * @param string the search item
893 * @param start the zero-relative index at which to begin the search 889 * @param start the zero-relative index at which to begin the search
894 * @return the index of the item 890 * @return the index of the item
895 * 891 *
896 * @exception IllegalArgumentException <ul>
897 * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
898 * </ul>
899 * @exception DWTException <ul> 892 * @exception DWTException <ul>
900 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> 893 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
901 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> 894 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
902 * </ul> 895 * </ul>
903 */ 896 */
904 public int indexOf (String string, int start) { 897 public int indexOf (String string, int start) {
905 checkWidget (); 898 checkWidget ();
906 if (string is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); 899 // DWT extension: allow null for zero length string
900 //if (string is null) DWT.error (DWT.ERROR_NULL_ARGUMENT);
907 return list.indexOf (string, start); 901 return list.indexOf (string, start);
908 } 902 }
909 903
910 void initAccessible() { 904 void initAccessible() {
911 AccessibleAdapter accessibleAdapter = new class() AccessibleAdapter { 905 AccessibleAdapter accessibleAdapter = new class() AccessibleAdapter {
1235 * and removes that item from the list. 1229 * and removes that item from the list.
1236 * 1230 *
1237 * @param string the item to remove 1231 * @param string the item to remove
1238 * 1232 *
1239 * @exception IllegalArgumentException <ul> 1233 * @exception IllegalArgumentException <ul>
1240 * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
1241 * <li>ERROR_INVALID_ARGUMENT - if the string is not found in the list</li> 1234 * <li>ERROR_INVALID_ARGUMENT - if the string is not found in the list</li>
1242 * </ul> 1235 * </ul>
1243 * @exception DWTException <ul> 1236 * @exception DWTException <ul>
1244 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> 1237 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
1245 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> 1238 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
1246 * </ul> 1239 * </ul>
1247 */ 1240 */
1248 public void remove (String string) { 1241 public void remove (String string) {
1249 checkWidget(); 1242 checkWidget();
1250 if (string is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); 1243 // DWT extension: allow null for zero length string
1244 //if (string is null) DWT.error (DWT.ERROR_NULL_ARGUMENT);
1251 list.remove (string); 1245 list.remove (string);
1252 } 1246 }
1253 /** 1247 /**
1254 * Removes all of the items from the receiver's list and clear the 1248 * Removes all of the items from the receiver's list and clear the
1255 * contents of receiver's text field. 1249 * contents of receiver's text field.
1419 * @param index the index for the item 1413 * @param index the index for the item
1420 * @param string the new text for the item 1414 * @param string the new text for the item
1421 * 1415 *
1422 * @exception IllegalArgumentException <ul> 1416 * @exception IllegalArgumentException <ul>
1423 * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li> 1417 * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
1424 * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
1425 * </ul> 1418 * </ul>
1426 * @exception DWTException <ul> 1419 * @exception DWTException <ul>
1427 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> 1420 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
1428 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> 1421 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
1429 * </ul> 1422 * </ul>
1436 * Sets the receiver's list to be the given array of items. 1429 * Sets the receiver's list to be the given array of items.
1437 * 1430 *
1438 * @param items the array of items 1431 * @param items the array of items
1439 * 1432 *
1440 * @exception IllegalArgumentException <ul> 1433 * @exception IllegalArgumentException <ul>
1441 * <li>ERROR_NULL_ARGUMENT - if the items array is null</li>
1442 * <li>ERROR_INVALID_ARGUMENT - if an item in the items array is null</li> 1434 * <li>ERROR_INVALID_ARGUMENT - if an item in the items array is null</li>
1443 * </ul> 1435 * </ul>
1444 * @exception DWTException <ul> 1436 * @exception DWTException <ul>
1445 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> 1437 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
1446 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> 1438 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
1528 * display incorrectly. 1520 * display incorrectly.
1529 * </p> 1521 * </p>
1530 * 1522 *
1531 * @param string the new text 1523 * @param string the new text
1532 * 1524 *
1533 * @exception IllegalArgumentException <ul>
1534 * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
1535 * </ul>
1536 * @exception DWTException <ul> 1525 * @exception DWTException <ul>
1537 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> 1526 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
1538 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> 1527 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
1539 * </ul> 1528 * </ul>
1540 */ 1529 */
1541 public void setText (String string) { 1530 public void setText (String string) {
1542 checkWidget(); 1531 checkWidget();
1543 if (string is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); 1532 // DWT extension: allow null for zero length string
1533 //if (string is null) DWT.error (DWT.ERROR_NULL_ARGUMENT);
1544 int index = list.indexOf (string); 1534 int index = list.indexOf (string);
1545 if (index is -1) { 1535 if (index is -1) {
1546 list.deselectAll (); 1536 list.deselectAll ();
1547 text.setText (string); 1537 text.setText (string);
1548 return; 1538 return;