# HG changeset patch
# User Frank Benoit
# Date 1213972056 -7200
# Node ID 43b41c7fe84a4099f99fa56569615f17986e9593
# Parent efe25e7c8a96bad02a95f1bab3ce662215bb7ca9
work on allow null strings and arrays
diff -r efe25e7c8a96 -r 43b41c7fe84a dwt/graphics/GC.d
--- a/dwt/graphics/GC.d Fri Jun 20 01:29:54 2008 +0200
+++ b/dwt/graphics/GC.d Fri Jun 20 16:27:36 2008 +0200
@@ -1798,16 +1798,14 @@
*
* @param pointArray an array of alternating x and y values which are the vertices of the polygon
*
- * @exception IllegalArgumentException
- * - ERROR_NULL_ARGUMENT if pointArray is null
- *
* @exception DWTException
* - ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed
*
*/
public void drawPolygon( int[] pointArray) {
if (handle is null) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED);
- if (pointArray is null) DWT.error(DWT.ERROR_NULL_ARGUMENT);
+ // DWT extension: allow null array
+ //if (pointArray is null) DWT.error(DWT.ERROR_NULL_ARGUMENT);
checkGC(DRAW);
auto gdipGraphics = data.gdipGraphics;
if (gdipGraphics !is null) {
@@ -1843,16 +1841,14 @@
*
* @param pointArray an array of alternating x and y values which are the corners of the polyline
*
- * @exception IllegalArgumentException
- * - ERROR_NULL_ARGUMENT - if the point array is null
- *
* @exception DWTException
* - ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed
*
*/
public void drawPolyline(int[] pointArray) {
if (handle is null) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED);
- if (pointArray is null) DWT.error(DWT.ERROR_NULL_ARGUMENT);
+ // DWT externsion: allow null array
+ //if (pointArray is null) DWT.error(DWT.ERROR_NULL_ARGUMENT);
checkGC(DRAW);
auto gdipGraphics = data.gdipGraphics;
if (gdipGraphics !is null) {
@@ -2091,9 +2087,6 @@
* @param x the x coordinate of the top left corner of the rectangular area where the string is to be drawn
* @param y the y coordinate of the top left corner of the rectangular area where the string is to be drawn
*
- * @exception IllegalArgumentException
- * - ERROR_NULL_ARGUMENT - if the string is null
- *
* @exception DWTException
* - ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed
*
@@ -2115,16 +2108,14 @@
* @param y the y coordinate of the top left corner of the rectangular area where the string is to be drawn
* @param isTransparent if true
the background will be transparent, otherwise it will be opaque
*
- * @exception IllegalArgumentException
- * - ERROR_NULL_ARGUMENT - if the string is null
- *
* @exception DWTException
* - ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed
*
*/
public void drawString (String string, int x, int y, bool isTransparent) {
if (handle is null) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED);
- if (string is null) DWT.error(DWT.ERROR_NULL_ARGUMENT);
+ // DWT extension: allow null string
+ //if (string is null) DWT.error(DWT.ERROR_NULL_ARGUMENT);
// TCHAR buffer = new TCHAR (getCodePage(), string, false);
wchar[] wstr = StrToWCHARs( string );
int length_ = wstr.length;
@@ -2247,9 +2238,6 @@
* @param x the x coordinate of the top left corner of the rectangular area where the text is to be drawn
* @param y the y coordinate of the top left corner of the rectangular area where the text is to be drawn
*
- * @exception IllegalArgumentException
- * - ERROR_NULL_ARGUMENT - if the string is null
- *
* @exception DWTException
* - ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed
*
@@ -2271,9 +2259,6 @@
* @param y the y coordinate of the top left corner of the rectangular area where the text is to be drawn
* @param isTransparent if true
the background will be transparent, otherwise it will be opaque
*
- * @exception IllegalArgumentException
- * - ERROR_NULL_ARGUMENT - if the string is null
- *
* @exception DWTException
* - ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed
*
@@ -2311,16 +2296,14 @@
* @param y the y coordinate of the top left corner of the rectangular area where the text is to be drawn
* @param flags the flags specifying how to process the text
*
- * @exception IllegalArgumentException
- * - ERROR_NULL_ARGUMENT - if the string is null
- *
* @exception DWTException
* - ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed
*
*/
public void drawText (String string, int x, int y, int flags) {
if (handle is null) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED);
- if (string is null) DWT.error(DWT.ERROR_NULL_ARGUMENT);
+ // DWT extension: allow null string
+ //if (string is null) DWT.error(DWT.ERROR_NULL_ARGUMENT);
if (string.length is 0) return;
auto gdipGraphics = data.gdipGraphics;
if (gdipGraphics !is null) {
@@ -2771,9 +2754,6 @@
*
* @param pointArray an array of alternating x and y values which are the vertices of the polygon
*
- * @exception IllegalArgumentException
- * - ERROR_NULL_ARGUMENT if pointArray is null
- *
* @exception DWTException
* - ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed
*
@@ -2782,7 +2762,8 @@
*/
public void fillPolygon(int[] pointArray) {
if (handle is null) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED);
- if (pointArray is null) DWT.error(DWT.ERROR_NULL_ARGUMENT);
+ // DWT externsion: allow null array
+ //if (pointArray is null) DWT.error(DWT.ERROR_NULL_ARGUMENT);
checkGC(FILL);
if (data.gdipGraphics !is null) {
int mode = OS.GetPolyFillMode(handle) is OS.WINDING ? Gdip.FillModeWinding : Gdip.FillModeAlternate;
@@ -4736,16 +4717,14 @@
* @param string the string to measure
* @return a point containing the extent of the string
*
- * @exception IllegalArgumentException
- * - ERROR_NULL_ARGUMENT - if the string is null
- *
* @exception DWTException
* - ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed
*
*/
public Point stringExtent(String string) {
if (handle is null) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED);
- if (string is null) DWT.error (DWT.ERROR_NULL_ARGUMENT);
+ // DWT externsion: allow null string
+ //if (string is null) DWT.error (DWT.ERROR_NULL_ARGUMENT);
checkGC(FONT);
int length_ = string.length;
if (data.gdipGraphics !is null) {
diff -r efe25e7c8a96 -r 43b41c7fe84a dwt/program/Program.d
--- a/dwt/program/Program.d Fri Jun 20 01:29:54 2008 +0200
+++ b/dwt/program/Program.d Fri Jun 20 16:27:36 2008 +0200
@@ -74,12 +74,10 @@
* @param extension the program extension
* @return the program or null
*
- * @exception IllegalArgumentException
- * - ERROR_NULL_ARGUMENT when extension is null
- *
*/
public static Program findProgram (String extension) {
- if (extension is null) DWT.error (DWT.ERROR_NULL_ARGUMENT);
+ // DWT extension: allow null string
+ //if (extension is null) DWT.error (DWT.ERROR_NULL_ARGUMENT);
if (extension.length is 0) return null;
if (extension.charAt (0) !is '.') extension = "." ~ extension; //$NON-NLS-1$
/* Use the character encoding for the default locale */
diff -r efe25e7c8a96 -r 43b41c7fe84a dwt/widgets/Button.d
--- a/dwt/widgets/Button.d Fri Jun 20 01:29:54 2008 +0200
+++ b/dwt/widgets/Button.d Fri Jun 20 16:27:36 2008 +0200
@@ -1024,7 +1024,8 @@
*/
/*public*/ void setMessage (String message) {
checkWidget ();
- if (message is null) error (DWT.ERROR_NULL_ARGUMENT);
+ // DWT externsion: allow null string
+ //if (message is null) error (DWT.ERROR_NULL_ARGUMENT);
this.message = message;
if (OS.COMCTL32_VERSION >= OS.VERSION (6, 1)) {
if ((style & DWT.COMMAND) !is 0) {
@@ -1109,9 +1110,6 @@
*
* @param string the new text
*
- * @exception IllegalArgumentException
- * - ERROR_NULL_ARGUMENT - if the text is null
- *
* @exception DWTException
* - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
* - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
@@ -1119,7 +1117,8 @@
*/
public void setText (String string) {
checkWidget ();
- if (string is null) error (DWT.ERROR_NULL_ARGUMENT);
+ // DWT externsion: allow null string
+ //if (string is null) error (DWT.ERROR_NULL_ARGUMENT);
if ((style & DWT.ARROW) !is 0) return;
text = string;
/* This code is intentionally commented */
diff -r efe25e7c8a96 -r 43b41c7fe84a dwt/widgets/Combo.d
--- a/dwt/widgets/Combo.d Fri Jun 20 01:29:54 2008 +0200
+++ b/dwt/widgets/Combo.d Fri Jun 20 16:27:36 2008 +0200
@@ -174,9 +174,6 @@
*
* @param string the new item
*
- * @exception IllegalArgumentException
- * - ERROR_NULL_ARGUMENT - if the string is null
- *
* @exception DWTException
* - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
* - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
@@ -186,7 +183,8 @@
*/
public void add (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);
auto buffer = StrToTCHARs( getCodePage(), string, true );
int result = OS.SendMessage (handle, OS.CB_ADDSTRING, 0, buffer.ptr );
if (result is OS.CB_ERR) error (DWT.ERROR_ITEM_NOT_ADDED);
@@ -207,7 +205,6 @@
* @param index the index for the item
*
* @exception IllegalArgumentException
- * - ERROR_NULL_ARGUMENT - if the string is null
* - ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list (inclusive)
*
* @exception DWTException
@@ -219,7 +216,8 @@
*/
public void add (String string, int index) {
checkWidget ();
- if (string is null) error (DWT.ERROR_NULL_ARGUMENT);
+ // DWT extension: allow null string
+ //if (string is null) error (DWT.ERROR_NULL_ARGUMENT);
int count = OS.SendMessage (handle, OS.CB_GETCOUNT, 0, 0);
if (!(0 <= index && index <= count)) {
error (DWT.ERROR_INVALID_RANGE);
@@ -979,9 +977,6 @@
* @param string the search item
* @return the index of the item
*
- * @exception IllegalArgumentException
- * - ERROR_NULL_ARGUMENT - if the string is null
- *
* @exception DWTException
* - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
* - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
@@ -1002,9 +997,6 @@
* @param start the zero-relative index at which to begin the search
* @return the index of the item
*
- * @exception IllegalArgumentException
- * - ERROR_NULL_ARGUMENT - if the string is null
- *
* @exception DWTException
* - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
* - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
@@ -1012,7 +1004,8 @@
*/
public int indexOf (String string, int start) {
checkWidget ();
- if (string is null) error (DWT.ERROR_NULL_ARGUMENT);
+ // DWT externsion: allow null string
+ //if (string is null) error (DWT.ERROR_NULL_ARGUMENT);
/*
* Bug in Windows. For some reason, CB_FINDSTRINGEXACT
@@ -1023,7 +1016,7 @@
if (string.length is 0) {
int count = getItemCount ();
for (int i=start; i
- * - ERROR_NULL_ARGUMENT - if the string is null
* - ERROR_INVALID_ARGUMENT - if the string is not found in the list
*
* @exception DWTException
@@ -1235,7 +1227,8 @@
*/
public void remove (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);
int index = indexOf (string, 0);
if (index is -1) error (DWT.ERROR_INVALID_ARGUMENT);
remove (index);
@@ -1530,7 +1523,6 @@
*
* @exception IllegalArgumentException
* - ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)
- * - ERROR_NULL_ARGUMENT - if the string is null
*
* @exception DWTException
* - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
@@ -1539,7 +1531,8 @@
*/
public void setItem (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);
int selection = getSelectionIndex ();
remove (index, false);
if (isDisposed ()) return;
@@ -1553,7 +1546,6 @@
* @param items the array of items
*
* @exception IllegalArgumentException
- * - ERROR_NULL_ARGUMENT - if the items array is null
* - ERROR_INVALID_ARGUMENT - if an item in the items array is null
*
* @exception DWTException
@@ -1563,7 +1555,8 @@
*/
public void setItems (String [] items) {
checkWidget ();
- if (items is null) error (DWT.ERROR_NULL_ARGUMENT);
+ // DWT extension: allow null string
+ //if (items is null) error (DWT.ERROR_NULL_ARGUMENT);
for (int i=0; i
- * - ERROR_NULL_ARGUMENT - if the string is null
- *
* @exception DWTException
* - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
* - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
@@ -1814,7 +1804,8 @@
*/
public void setText (String string) {
checkWidget ();
- if (string is null) error (DWT.ERROR_NULL_ARGUMENT);
+ // DWT externsion: allow null string
+ //if (string is null) error (DWT.ERROR_NULL_ARGUMENT);
if ((style & DWT.READ_ONLY) !is 0) {
int index = indexOf (string);
if (index !is -1) select (index);
diff -r efe25e7c8a96 -r 43b41c7fe84a dwt/widgets/CoolBar.d
--- a/dwt/widgets/CoolBar.d Fri Jun 20 01:29:54 2008 +0200
+++ b/dwt/widgets/CoolBar.d Fri Jun 20 16:27:36 2008 +0200
@@ -815,7 +815,6 @@
* - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
*
* @exception IllegalArgumentException
- * - ERROR_NULL_ARGUMENT - if item order or sizes is null
* - ERROR_INVALID_ARGUMENT - if item order or sizes is not the same length as the number of items
*
*/
@@ -841,12 +840,12 @@
* - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
*
* @exception IllegalArgumentException
- * - ERROR_NULL_ARGUMENT - if the item order is null
* - ERROR_INVALID_ARGUMENT - if the item order is not the same length as the number of items
*
*/
void setItemOrder (int [] itemOrder) {
- if (itemOrder is null) error (DWT.ERROR_NULL_ARGUMENT);
+ // DWT extension: allow null array
+ //if (itemOrder is null) error (DWT.ERROR_NULL_ARGUMENT);
int itemCount = OS.SendMessage (handle, OS.RB_GETBANDCOUNT, 0, 0);
if (itemOrder.length !is itemCount) error (DWT.ERROR_INVALID_ARGUMENT);
@@ -905,7 +904,8 @@
*
*/
void setItemSizes (Point [] sizes) {
- if (sizes is null) error (DWT.ERROR_NULL_ARGUMENT);
+ // DWT extension: allow null array
+ //if (sizes is null) error (DWT.ERROR_NULL_ARGUMENT);
int count = OS.SendMessage (handle, OS.RB_GETBANDCOUNT, 0, 0);
if (sizes.length !is count) error (DWT.ERROR_INVALID_ARGUMENT);
REBARBANDINFO rbBand;
diff -r efe25e7c8a96 -r 43b41c7fe84a dwt/widgets/Decorations.d
--- a/dwt/widgets/Decorations.d Fri Jun 20 01:29:54 2008 +0200
+++ b/dwt/widgets/Decorations.d Fri Jun 20 16:27:36 2008 +0200
@@ -1060,7 +1060,6 @@
* @param images the new image array
*
* @exception IllegalArgumentException
- * - ERROR_NULL_ARGUMENT - if the array of images is null
* - ERROR_INVALID_ARGUMENT - if one of the images is null or has been disposed
*
* @exception DWTException
@@ -1072,7 +1071,8 @@
*/
public void setImages (Image [] images) {
checkWidget ();
- if (images is null) error (DWT.ERROR_INVALID_ARGUMENT);
+ // DWT extension: allow null array
+ //if (images is null) error (DWT.ERROR_INVALID_ARGUMENT);
for (int i = 0; i < images.length; i++) {
if (images [i] is null || images [i].isDisposed ()) error (DWT.ERROR_INVALID_ARGUMENT);
}
@@ -1328,9 +1328,6 @@
*
* @param string the new text
*
- * @exception IllegalArgumentException
- * - ERROR_NULL_ARGUMENT - if the text is null
- *
* @exception DWTException
* - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
* - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
@@ -1338,7 +1335,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);
/* Use the character encoding for the default locale */
TCHAR[] buffer = StrToTCHARs (string, true);
/* Ensure that the title appears in the task bar.*/
diff -r efe25e7c8a96 -r 43b41c7fe84a dwt/widgets/Dialog.d
--- a/dwt/widgets/Dialog.d Fri Jun 20 01:29:54 2008 +0200
+++ b/dwt/widgets/Dialog.d Fri Jun 20 16:27:36 2008 +0200
@@ -255,16 +255,14 @@
*
* @param string the new text
*
- * @exception IllegalArgumentException
- * - ERROR_NULL_ARGUMENT - if the text is null
- *
* @exception DWTException
* - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
* - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
*
*/
public void setText (String string) {
- if (string is null) error (DWT.ERROR_NULL_ARGUMENT);
+ // DWT extension: allow null string
+ //if (string is null) error (DWT.ERROR_NULL_ARGUMENT);
title = string;
}
diff -r efe25e7c8a96 -r 43b41c7fe84a dwt/widgets/DirectoryDialog.d
--- a/dwt/widgets/DirectoryDialog.d Fri Jun 20 01:29:54 2008 +0200
+++ b/dwt/widgets/DirectoryDialog.d Fri Jun 20 16:27:36 2008 +0200
@@ -308,12 +308,10 @@
*
* @param string the message
*
- * @exception IllegalArgumentException
- * - ERROR_NULL_ARGUMENT - if the string is null
- *
*/
public void setMessage (String string) {
- 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;
}
diff -r efe25e7c8a96 -r 43b41c7fe84a dwt/widgets/Display.d
--- a/dwt/widgets/Display.d Fri Jun 20 01:29:54 2008 +0200
+++ b/dwt/widgets/Display.d Fri Jun 20 16:27:36 2008 +0200
@@ -1626,9 +1626,6 @@
* @param key the name of the property
* @return the value of the property or null if it has not been set
*
- * @exception IllegalArgumentException
- * - ERROR_NULL_ARGUMENT - if the key is null
- *
* @exception DWTException
* - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
* - ERROR_DEVICE_DISPOSED - if the receiver has been disposed
@@ -1639,7 +1636,8 @@
*/
public Object getData (String key) {
checkDevice ();
- if (key is null) error (DWT.ERROR_NULL_ARGUMENT);
+ // DWT extension: allow null string
+ //if (key is null) error (DWT.ERROR_NULL_ARGUMENT);
if (key ==/*eq*/RUN_MESSAGES_IN_IDLE_KEY) {
return new ValueWrapperBool(runMessagesInIdle);
}
@@ -4081,9 +4079,6 @@
* @param key the name of the property
* @param value the new value for the property
*
- * @exception IllegalArgumentException
- * - ERROR_NULL_ARGUMENT - if the key is null
- *
* @exception DWTException
* - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
* - ERROR_DEVICE_DISPOSED - if the receiver has been disposed
@@ -4094,7 +4089,8 @@
*/
public void setData (String key, Object value) {
checkDevice ();
- if (key is null) error (DWT.ERROR_NULL_ARGUMENT);
+ // DWT extension: allow null string
+ //if (key is null) error (DWT.ERROR_NULL_ARGUMENT);
if (key ==/*eq*/RUN_MESSAGES_IN_IDLE_KEY) {
auto data = cast(ValueWrapperBool) value;