Changeset 239:43b41c7fe84a

Show
Ignore:
Timestamp:
06/20/08 10:27:36 (3 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/graphics/GC.d

    r220 r239  
    17991799 * @param pointArray an array of alternating x and y values which are the vertices of the polygon 
    18001800 * 
    1801  * @exception IllegalArgumentException <ul> 
    1802  *    <li>ERROR_NULL_ARGUMENT if pointArray is null</li> 
    1803  * </ul> 
    18041801 * @exception DWTException <ul> 
    18051802 *    <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> 
     
    18081805public void drawPolygon( int[] pointArray) { 
    18091806    if (handle is null) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); 
    1810     if (pointArray is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 
     1807    // DWT extension: allow null array 
     1808    //if (pointArray is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 
    18111809    checkGC(DRAW); 
    18121810    auto gdipGraphics = data.gdipGraphics; 
     
    18441842 * @param pointArray an array of alternating x and y values which are the corners of the polyline 
    18451843 * 
    1846  * @exception IllegalArgumentException <ul> 
    1847  *    <li>ERROR_NULL_ARGUMENT - if the point array is null</li> 
    1848  * </ul> 
    18491844 * @exception DWTException <ul> 
    18501845 *    <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> 
     
    18531848public void drawPolyline(int[] pointArray) { 
    18541849    if (handle is null) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); 
    1855     if (pointArray is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 
     1850    // DWT externsion: allow null array 
     1851    //if (pointArray is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 
    18561852    checkGC(DRAW); 
    18571853    auto gdipGraphics = data.gdipGraphics; 
     
    20922088 * @param y the y coordinate of the top left corner of the rectangular area where the string is to be drawn 
    20932089 * 
    2094  * @exception IllegalArgumentException <ul> 
    2095  *    <li>ERROR_NULL_ARGUMENT - if the string is null</li> 
    2096  * </ul> 
    20972090 * @exception DWTException <ul> 
    20982091 *    <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> 
     
    21162109 * @param isTransparent if <code>true</code> the background will be transparent, otherwise it will be opaque 
    21172110 * 
    2118  * @exception IllegalArgumentException <ul> 
    2119  *    <li>ERROR_NULL_ARGUMENT - if the string is null</li> 
    2120  * </ul> 
    21212111 * @exception DWTException <ul> 
    21222112 *    <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> 
     
    21252115public void drawString (String string, int x, int y, bool isTransparent) { 
    21262116    if (handle is null) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); 
    2127     if (string is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 
     2117    // DWT extension: allow null string 
     2118    //if (string is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 
    21282119//  TCHAR buffer = new TCHAR (getCodePage(), string, false); 
    21292120    wchar[] wstr = StrToWCHARs( string ); 
     
    22482239 * @param y the y coordinate of the top left corner of the rectangular area where the text is to be drawn 
    22492240 * 
    2250  * @exception IllegalArgumentException <ul> 
    2251  *    <li>ERROR_NULL_ARGUMENT - if the string is null</li> 
    2252  * </ul> 
    22532241 * @exception DWTException <ul> 
    22542242 *    <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> 
     
    22722260 * @param isTransparent if <code>true</code> the background will be transparent, otherwise it will be opaque 
    22732261 * 
    2274  * @exception IllegalArgumentException <ul> 
    2275  *    <li>ERROR_NULL_ARGUMENT - if the string is null</li> 
    2276  * </ul> 
    22772262 * @exception DWTException <ul> 
    22782263 *    <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> 
     
    23122297 * @param flags the flags specifying how to process the text 
    23132298 * 
    2314  * @exception IllegalArgumentException <ul> 
    2315  *    <li>ERROR_NULL_ARGUMENT - if the string is null</li> 
    2316  * </ul> 
    23172299 * @exception DWTException <ul> 
    23182300 *    <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> 
     
    23212303public void drawText (String string, int x, int y, int flags) { 
    23222304    if (handle is null) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); 
    2323     if (string is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 
     2305    // DWT extension: allow null string 
     2306    //if (string is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 
    23242307    if (string.length is 0) return; 
    23252308    auto gdipGraphics = data.gdipGraphics; 
     
    27722755 * @param pointArray an array of alternating x and y values which are the vertices of the polygon 
    27732756 * 
    2774  * @exception IllegalArgumentException <ul> 
    2775  *    <li>ERROR_NULL_ARGUMENT if pointArray is null</li> 
    2776  * </ul> 
    27772757 * @exception DWTException <ul> 
    27782758 *    <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> 
     
    27832763public void fillPolygon(int[] pointArray) { 
    27842764    if (handle is null) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); 
    2785     if (pointArray is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 
     2765    // DWT externsion: allow null array 
     2766    //if (pointArray is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 
    27862767    checkGC(FILL); 
    27872768    if (data.gdipGraphics !is null) { 
     
    47374718 * @return a point containing the extent of the string 
    47384719 * 
    4739  * @exception IllegalArgumentException <ul> 
    4740  *    <li>ERROR_NULL_ARGUMENT - if the string is null</li> 
    4741  * </ul> 
    47424720 * @exception DWTException <ul> 
    47434721 *    <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> 
     
    47464724public Point stringExtent(String string) { 
    47474725    if (handle is null) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); 
    4748     if (string is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); 
     4726    // DWT externsion: allow null string 
     4727    //if (string is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); 
    47494728    checkGC(FONT); 
    47504729    int length_ = string.length; 
  • dwt/program/Program.d

    r213 r239  
    7575 * @return the program or <code>null</code> 
    7676 * 
    77  * @exception IllegalArgumentException <ul> 
    78  *      <li>ERROR_NULL_ARGUMENT when extension is null</li> 
    79  *  </ul> 
    8077 */ 
    8178public static Program findProgram (String extension) { 
    82     if (extension is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); 
     79    // DWT extension: allow null string 
     80    //if (extension is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); 
    8381    if (extension.length is 0) return null; 
    8482    if (extension.charAt (0) !is '.') extension = "." ~ extension; //$NON-NLS-1$ 
  • dwt/widgets/Button.d

    r213 r239  
    10251025/*public*/ void setMessage (String message) { 
    10261026    checkWidget (); 
    1027     if (message is null) error (DWT.ERROR_NULL_ARGUMENT); 
     1027    // DWT externsion: allow null string 
     1028    //if (message is null) error (DWT.ERROR_NULL_ARGUMENT); 
    10281029    this.message = message; 
    10291030    if (OS.COMCTL32_VERSION >= OS.VERSION (6, 1)) { 
     
    11101111 * @param string the new text 
    11111112 * 
    1112  * @exception IllegalArgumentException <ul> 
    1113  *    <li>ERROR_NULL_ARGUMENT - if the text is null</li> 
    1114  * </ul> 
    11151113 * @exception DWTException <ul> 
    11161114 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> 
     
    11201118public void setText (String string) { 
    11211119    checkWidget (); 
    1122     if (string is null) error (DWT.ERROR_NULL_ARGUMENT); 
     1120    // DWT externsion: allow null string 
     1121    //if (string is null) error (DWT.ERROR_NULL_ARGUMENT); 
    11231122    if ((style & DWT.ARROW) !is 0) return; 
    11241123    text = string; 
  • dwt/widgets/Combo.d

    r237 r239  
    175175 * @param string the new item 
    176176 * 
    177  * @exception IllegalArgumentException <ul> 
    178  *    <li>ERROR_NULL_ARGUMENT - if the string is null</li> 
    179  * </ul> 
    180177 * @exception DWTException <ul> 
    181178 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> 
     
    187184public void add (String string) { 
    188185    checkWidget (); 
    189     if (string is null) error (DWT.ERROR_NULL_ARGUMENT); 
     186    // DWT extension: allow null string 
     187    //if (string is null) error (DWT.ERROR_NULL_ARGUMENT); 
    190188    auto buffer = StrToTCHARs( getCodePage(), string, true ); 
    191189    int result = OS.SendMessage (handle, OS.CB_ADDSTRING, 0, buffer.ptr ); 
     
    208206 * 
    209207 * @exception IllegalArgumentException <ul> 
    210  *    <li>ERROR_NULL_ARGUMENT - if the string is null</li> 
    211208 *    <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list (inclusive)</li> 
    212209 * </ul> 
     
    220217public void add (String string, int index) { 
    221218    checkWidget (); 
    222     if (string is null) error (DWT.ERROR_NULL_ARGUMENT); 
     219    // DWT extension: allow null string 
     220    //if (string is null) error (DWT.ERROR_NULL_ARGUMENT); 
    223221    int count = OS.SendMessage (handle, OS.CB_GETCOUNT, 0, 0); 
    224222    if (!(0 <= index && index <= count)) { 
     
    980978 * @return the index of the item 
    981979 * 
    982  * @exception IllegalArgumentException <ul> 
    983  *    <li>ERROR_NULL_ARGUMENT - if the string is null</li> 
    984  * </ul> 
    985980 * @exception DWTException <ul> 
    986981 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> 
     
    1003998 * @return the index of the item 
    1004999 * 
    1005  * @exception IllegalArgumentException <ul> 
    1006  *    <li>ERROR_NULL_ARGUMENT - if the string is null</li> 
    1007  * </ul> 
    10081000 * @exception DWTException <ul> 
    10091001 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> 
     
    10131005public int indexOf (String string, int start) { 
    10141006    checkWidget (); 
    1015     if (string is null) error (DWT.ERROR_NULL_ARGUMENT); 
     1007    // DWT externsion: allow null string 
     1008    //if (string is null) error (DWT.ERROR_NULL_ARGUMENT); 
    10161009 
    10171010    /* 
     
    10241017        int count = getItemCount (); 
    10251018        for (int i=start; i<count; i++) { 
    1026             if (string==/*eq*/getItem (i)) return i; 
     1019            if (string.equals (getItem (i))) return i; 
    10271020        } 
    10281021        return -1; 
     
    12261219 * 
    12271220 * @exception IllegalArgumentException <ul> 
    1228  *    <li>ERROR_NULL_ARGUMENT - if the string is null</li> 
    12291221 *    <li>ERROR_INVALID_ARGUMENT - if the string is not found in the list</li> 
    12301222 * </ul> 
     
    12361228public void remove (String string) { 
    12371229    checkWidget (); 
    1238     if (string is null) error (DWT.ERROR_NULL_ARGUMENT); 
     1230    // DWT extension: allow null string 
     1231    //if (string is null) error (DWT.ERROR_NULL_ARGUMENT); 
    12391232    int index = indexOf (string, 0); 
    12401233    if (index is -1) error (DWT.ERROR_INVALID_ARGUMENT); 
     
    15311524 * @exception IllegalArgumentException <ul> 
    15321525 *    <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li> 
    1533  *    <li>ERROR_NULL_ARGUMENT - if the string is null</li> 
    15341526 * </ul> 
    15351527 * @exception DWTException <ul> 
     
    15401532public void setItem (int index, String string) { 
    15411533    checkWidget (); 
    1542     if (string is null) error (DWT.ERROR_NULL_ARGUMENT); 
     1534    // DWT extension: allow null string 
     1535    //if (string is null) error (DWT.ERROR_NULL_ARGUMENT); 
    15431536    int selection = getSelectionIndex (); 
    15441537    remove (index, false); 
     
    15541547 * 
    15551548 * @exception IllegalArgumentException <ul> 
    1556  *    <li>ERROR_NULL_ARGUMENT - if the items array is null</li> 
    15571549 *    <li>ERROR_INVALID_ARGUMENT - if an item in the items array is null</li> 
    15581550 * </ul> 
     
    15641556public void setItems (String [] items) { 
    15651557    checkWidget (); 
    1566     if (items is null) error (DWT.ERROR_NULL_ARGUMENT); 
     1558    // DWT extension: allow null string 
     1559    //if (items is null) error (DWT.ERROR_NULL_ARGUMENT); 
    15671560    for (int i=0; i<items.length; i++) { 
    15681561        if (items [i] is null) error (DWT.ERROR_INVALID_ARGUMENT); 
     
    18051798 * @param string the new text 
    18061799 * 
    1807  * @exception IllegalArgumentException <ul> 
    1808  *    <li>ERROR_NULL_ARGUMENT - if the string is null</li> 
    1809  * </ul> 
    18101800 * @exception DWTException <ul> 
    18111801 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> 
     
    18151805public void setText (String string) { 
    18161806    checkWidget (); 
    1817     if (string is null) error (DWT.ERROR_NULL_ARGUMENT); 
     1807    // DWT externsion: allow null string 
     1808    //if (string is null) error (DWT.ERROR_NULL_ARGUMENT); 
    18181809    if ((style & DWT.READ_ONLY) !is 0) { 
    18191810        int index = indexOf (string); 
  • dwt/widgets/CoolBar.d

    r213 r239  
    816816 * </ul> 
    817817 * @exception IllegalArgumentException <ul> 
    818  *    <li>ERROR_NULL_ARGUMENT - if item order or sizes is null</li> 
    819818 *    <li>ERROR_INVALID_ARGUMENT - if item order or sizes is not the same length as the number of items</li> 
    820819 * </ul> 
     
    842841 * </ul> 
    843842 * @exception IllegalArgumentException <ul> 
    844  *    <li>ERROR_NULL_ARGUMENT - if the item order is null</li> 
    845843 *    <li>ERROR_INVALID_ARGUMENT - if the item order is not the same length as the number of items</li> 
    846844 * </ul> 
    847845 */ 
    848846void setItemOrder (int [] itemOrder) { 
    849     if (itemOrder is null) error (DWT.ERROR_NULL_ARGUMENT); 
     847    // DWT extension: allow null array 
     848    //if (itemOrder is null) error (DWT.ERROR_NULL_ARGUMENT); 
    850849    int itemCount = OS.SendMessage (handle, OS.RB_GETBANDCOUNT, 0, 0); 
    851850    if (itemOrder.length !is itemCount) error (DWT.ERROR_INVALID_ARGUMENT); 
     
    906905 */ 
    907906void setItemSizes (Point [] sizes) { 
    908     if (sizes is null) error (DWT.ERROR_NULL_ARGUMENT); 
     907    // DWT extension: allow null array 
     908    //if (sizes is null) error (DWT.ERROR_NULL_ARGUMENT); 
    909909    int count = OS.SendMessage (handle, OS.RB_GETBANDCOUNT, 0, 0); 
    910910    if (sizes.length !is count) error (DWT.ERROR_INVALID_ARGUMENT); 
  • dwt/widgets/Decorations.d

    r213 r239  
    10611061 * 
    10621062 * @exception IllegalArgumentException <ul> 
    1063  *    <li>ERROR_NULL_ARGUMENT - if the array of images is null</li> 
    10641063 *    <li>ERROR_INVALID_ARGUMENT - if one of the images is null or has been disposed</li> 
    10651064 * </ul> 
     
    10731072public void setImages (Image [] images) { 
    10741073    checkWidget (); 
    1075     if (images is null) error (DWT.ERROR_INVALID_ARGUMENT); 
     1074    // DWT extension: allow null array 
     1075    //if (images is null) error (DWT.ERROR_INVALID_ARGUMENT); 
    10761076    for (int i = 0; i < images.length; i++) { 
    10771077        if (images [i] is null || images [i].isDisposed ()) error (DWT.ERROR_INVALID_ARGUMENT); 
     
    13291329 * @param string the new text 
    13301330 * 
    1331  * @exception IllegalArgumentException <ul> 
    1332  *    <li>ERROR_NULL_ARGUMENT - if the text is null</li> 
    1333  * </ul> 
    13341331 * @exception DWTException <ul> 
    13351332 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> 
     
    13391336public void setText (String string) { 
    13401337    checkWidget (); 
    1341     if (string is null) error (DWT.ERROR_NULL_ARGUMENT); 
     1338    // DWT extension: allow null string 
     1339    //if (string is null) error (DWT.ERROR_NULL_ARGUMENT); 
    13421340    /* Use the character encoding for the default locale */ 
    13431341    TCHAR[] buffer = StrToTCHARs (string, true); 
  • dwt/widgets/Dialog.d

    r213 r239  
    256256 * @param string the new text 
    257257 * 
    258  * @exception IllegalArgumentException <ul> 
    259  *    <li>ERROR_NULL_ARGUMENT - if the text is null</li> 
    260  * </ul> 
    261258 * @exception DWTException <ul> 
    262259 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> 
     
    265262 */ 
    266263public void setText (String string) { 
    267     if (string is null) error (DWT.ERROR_NULL_ARGUMENT); 
     264    // DWT extension: allow null string 
     265    //if (string is null) error (DWT.ERROR_NULL_ARGUMENT); 
    268266    title = string; 
    269267} 
  • dwt/widgets/DirectoryDialog.d

    r213 r239  
    309309 * @param string the message 
    310310 * 
    311  * @exception IllegalArgumentException <ul> 
    312  *    <li>ERROR_NULL_ARGUMENT - if the string is null</li> 
    313  * </ul> 
    314311 */ 
    315312public void setMessage (String string) { 
    316     if (string is null) error (DWT.ERROR_NULL_ARGUMENT); 
     313    // DWT extension: allow null string 
     314    //if (string is null) error (DWT.ERROR_NULL_ARGUMENT); 
    317315    message = string; 
    318316} 
  • dwt/widgets/Display.d

    r237 r239  
    16271627 * @return the value of the property or null if it has not been set 
    16281628 * 
    1629  * @exception IllegalArgumentException <ul> 
    1630  *    <li>ERROR_NULL_ARGUMENT - if the key is null</li> 
    1631  * </ul> 
    16321629 * @exception DWTException <ul> 
    16331630 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> 
     
    16401637public Object getData (String key) { 
    16411638    checkDevice (); 
    1642     if (key is null) error (DWT.ERROR_NULL_ARGUMENT); 
     1639    // DWT extension: allow null string 
     1640    //if (key is null) error (DWT.ERROR_NULL_ARGUMENT); 
    16431641    if (key ==/*eq*/RUN_MESSAGES_IN_IDLE_KEY) { 
    16441642        return new ValueWrapperBool(runMessagesInIdle); 
     
    40824080 * @param value the new value for the property 
    40834081 * 
    4084  * @exception IllegalArgumentException <ul> 
    4085  *    <li>ERROR_NULL_ARGUMENT - if the key is null</li> 
    4086  * </ul> 
    40874082 * @exception DWTException <ul> 
    40884083 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> 
     
    40954090public void setData (String key, Object value) { 
    40964091    checkDevice (); 
    4097     if (key is null) error (DWT.ERROR_NULL_ARGUMENT); 
     4092    // DWT extension: allow null string 
     4093    //if (key is null) error (DWT.ERROR_NULL_ARGUMENT); 
    40984094 
    40994095    if (key ==/*eq*/RUN_MESSAGES_IN_IDLE_KEY) {