Changeset 241:b4846fd3437a

Show
Ignore:
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
  • dwt/widgets/Group.d

    r213 r241  
    346346 * @param string the new text 
    347347 * 
    348  * @exception IllegalArgumentException <ul> 
    349  *    <li>ERROR_NULL_ARGUMENT - if the text is null</li> 
    350  * </ul> 
    351348 * @exception DWTException <ul> 
    352349 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> 
     
    356353public void setText (String string) { 
    357354    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); 
    359357    text = string; 
    360358    /* 
  • dwt/widgets/Item.d

    r212 r241  
    172172 * @param string the new text 
    173173 * 
    174  * @exception IllegalArgumentException <ul> 
    175  *    <li>ERROR_NULL_ARGUMENT - if the text is null</li> 
    176  * </ul> 
    177174 * @exception DWTException <ul> 
    178175 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> 
     
    182179public void setText (String string) { 
    183180    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); 
    185183    text = string; 
    186184} 
  • dwt/widgets/Label.d

    r213 r241  
    392392 * @param string the new text 
    393393 * 
    394  * @exception IllegalArgumentException <ul> 
    395  *    <li>ERROR_NULL_ARGUMENT - if the text is null</li> 
    396  * </ul> 
    397394 * @exception DWTException <ul> 
    398395 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> 
     
    402399public void setText (String string) { 
    403400    checkWidget (); 
    404     if (string is null) error (DWT.ERROR_NULL_ARGUMENT); 
    405401    // 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; 
    407404    /* 
    408405    * Feature in Windows.  For some reason, SetWindowText() for 
  • dwt/widgets/Link.d

    r213 r241  
    671671 * @param string the new text 
    672672 * 
    673  * @exception IllegalArgumentException <ul> 
    674  *    <li>ERROR_NULL_ARGUMENT - if the text is null</li> 
    675  * </ul> 
    676673 * @exception DWTException <ul> 
    677674 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> 
     
    681678public void setText (String string) { 
    682679    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; 
    685683    text = string; 
    686684    if (OS.COMCTL32_MAJOR >= 6) { 
  • dwt/widgets/List.d

    r214 r241  
    109109 * @param string the new item 
    110110 * 
    111  * @exception IllegalArgumentException <ul> 
    112  *    <li>ERROR_NULL_ARGUMENT - if the string is null</li> 
    113  * </ul> 
    114111 * @exception DWTException <ul> 
    115112 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> 
     
    121118public void add (String string) { 
    122119    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); 
    124122    TCHAR* buffer = StrToTCHARz ( getCodePage (), string); 
    125123    int result = OS.SendMessage (handle, OS.LB_ADDSTRING, 0, buffer); 
     
    141139 * 
    142140 * @exception IllegalArgumentException <ul> 
    143  *    <li>ERROR_NULL_ARGUMENT - if the string is null</li> 
    144141 *    <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list (inclusive)</li> 
    145142 * </ul> 
     
    153150public void add (String string, int index) { 
    154151    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); 
    156154    if (index is -1) error (DWT.ERROR_INVALID_RANGE); 
    157155    TCHAR* buffer = StrToTCHARz(getCodePage (), string); 
     
    300298 * @param indices the array of indices for the items to deselect 
    301299 * 
    302  * @exception IllegalArgumentException <ul> 
    303  *    <li>ERROR_NULL_ARGUMENT - if the set of indices is null</li> 
    304  * </ul> 
    305300 * @exception DWTException <ul> 
    306301 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> 
     
    310305public void deselect (int [] indices) { 
    311306    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); 
    313309    if (indices.length is 0) return; 
    314310    if ((style & DWT.SINGLE) !is 0) { 
     
    657653 * @return the index of the item 
    658654 * 
    659  * @exception IllegalArgumentException <ul> 
    660  *    <li>ERROR_NULL_ARGUMENT - if the string is null</li> 
    661  * </ul> 
    662655 * @exception DWTException <ul> 
    663656 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> 
     
    680673 * @return the index of the item 
    681674 * 
    682  * @exception IllegalArgumentException <ul> 
    683  *    <li>ERROR_NULL_ARGUMENT - if the string is null</li> 
    684  * </ul> 
    685675 * @exception DWTException <ul> 
    686676 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> 
     
    690680public int indexOf (String string, int start) { 
    691681    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); 
    693684 
    694685    /* 
     
    745736 * @exception IllegalArgumentException <ul> 
    746737 *    <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> 
    748738 * </ul> 
    749739 * @exception DWTException <ul> 
     
    754744public void remove (int [] indices) { 
    755745    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); 
    757748    if (indices.length is 0) return; 
    758749    int [] newIndices = new int [indices.length]; 
     
    935926 * 
    936927 * @exception IllegalArgumentException <ul> 
    937  *    <li>ERROR_NULL_ARGUMENT - if the string is null</li> 
    938928 *    <li>ERROR_INVALID_ARGUMENT - if the string is not found in the list</li> 
    939929 * </ul> 
     
    945935public void remove (String string) { 
    946936    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); 
    948939    int index = indexOf (string, 0); 
    949940    if (index is -1) error (DWT.ERROR_INVALID_ARGUMENT); 
     
    1004995 * @param indices the array of indices for the items to select 
    1005996 * 
    1006  * @exception IllegalArgumentException <ul> 
    1007  *    <li>ERROR_NULL_ARGUMENT - if the array of indices is null</li> 
    1008  * </ul> 
    1009997 * @exception DWTException <ul> 
    1010998 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> 
     
    10161004public void select (int [] indices) { 
    10171005    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); 
    10191008    int length = indices.length; 
    10201009    if (length is 0 || ((style & DWT.SINGLE) !is 0 && length > 1)) return; 
     
    11881177 * @exception IllegalArgumentException <ul> 
    11891178 *    <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> 
    11911179 * </ul> 
    11921180 * @exception DWTException <ul> 
     
    11971185public void setItem (int index, String string) { 
    11981186    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); 
    12001189    int topIndex = getTopIndex (); 
    12011190    bool isSelected = isSelected (index); 
     
    12121201 * 
    12131202 * @exception IllegalArgumentException <ul> 
    1214  *    <li>ERROR_NULL_ARGUMENT - if the items array is null</li> 
    12151203 *    <li>ERROR_INVALID_ARGUMENT - if an item in the items array is null</li> 
    12161204 * </ul> 
     
    12221210public void setItems (String [] items) { 
    12231211    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    //} 
    12281218    int /*long*/ oldProc = OS.GetWindowLongPtr (handle, OS.GWLP_WNDPROC); 
    12291219    OS.SetWindowLongPtr (handle, OS.GWLP_WNDPROC, cast(LONG_PTR) ListProc); 
     
    13431333 * @param indices the indices of the items to select 
    13441334 * 
    1345  * @exception IllegalArgumentException <ul> 
    1346  *    <li>ERROR_NULL_ARGUMENT - if the array of indices is null</li> 
    1347  * </ul> 
    13481335 * @exception DWTException <ul> 
    13491336 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> 
     
    13561343public void setSelection(int [] indices) { 
    13571344    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); 
    13591347    deselectAll (); 
    13601348    int length = indices.length; 
     
    13771365 * @param items the array of items 
    13781366 * 
    1379  * @exception IllegalArgumentException <ul> 
    1380  *    <li>ERROR_NULL_ARGUMENT - if the array of items is null</li> 
    1381  * </ul> 
    13821367 * @exception DWTException <ul> 
    13831368 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> 
     
    13911376public void setSelection (String [] items) { 
    13921377    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); 
    13941380    deselectAll (); 
    13951381    int length = items.length;