# HG changeset patch
# User Frank Benoit
# Date 1214178358 -7200
# Node ID b4846fd3437ac4c1a27ab76bdfb2c3b3cba5fec2
# Parent c84e3d3feb3f1b36bd64c07f7152283d42d2fe7b
work on allow null strings and arrays
diff -r c84e3d3feb3f -r b4846fd3437a dwt/widgets/Group.d
--- a/dwt/widgets/Group.d Sat Jun 21 02:24:49 2008 +0200
+++ b/dwt/widgets/Group.d Mon Jun 23 01:45:58 2008 +0200
@@ -345,9 +345,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
@@ -355,7 +352,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);
text = string;
/*
* Bug in Windows. When a group control is right-to-left and
diff -r c84e3d3feb3f -r b4846fd3437a dwt/widgets/Item.d
--- a/dwt/widgets/Item.d Sat Jun 21 02:24:49 2008 +0200
+++ b/dwt/widgets/Item.d Mon Jun 23 01:45:58 2008 +0200
@@ -171,9 +171,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
@@ -181,7 +178,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);
text = string;
}
diff -r c84e3d3feb3f -r b4846fd3437a dwt/widgets/Label.d
--- a/dwt/widgets/Label.d Sat Jun 21 02:24:49 2008 +0200
+++ b/dwt/widgets/Label.d Mon Jun 23 01:45:58 2008 +0200
@@ -391,9 +391,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
@@ -401,9 +398,9 @@
*/
public void setText (String string) {
checkWidget ();
- if (string is null) error (DWT.ERROR_NULL_ARGUMENT);
// DWT extensions allow null argument
- //if ((style & DWT.SEPARATOR) !is 0) return;
+ //if (string is null) error (DWT.ERROR_NULL_ARGUMENT);
+ if ((style & DWT.SEPARATOR) !is 0) return;
/*
* Feature in Windows. For some reason, SetWindowText() for
* static controls redraws the control, even when the text has
diff -r c84e3d3feb3f -r b4846fd3437a dwt/widgets/Link.d
--- a/dwt/widgets/Link.d Sat Jun 21 02:24:49 2008 +0200
+++ b/dwt/widgets/Link.d Mon Jun 23 01:45:58 2008 +0200
@@ -670,9 +670,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
@@ -680,8 +677,9 @@
*/
public void setText (String string) {
checkWidget ();
- if (string is null) error (DWT.ERROR_NULL_ARGUMENT);
- if (string==/*eq*/text) return;
+ // DWT extension: allow null string
+ //if (string is null) error (DWT.ERROR_NULL_ARGUMENT);
+ if (string.equals (text)) return;
text = string;
if (OS.COMCTL32_MAJOR >= 6) {
bool enabled = cast(bool) OS.IsWindowEnabled (handle);
diff -r c84e3d3feb3f -r b4846fd3437a dwt/widgets/List.d
--- a/dwt/widgets/List.d Sat Jun 21 02:24:49 2008 +0200
+++ b/dwt/widgets/List.d Mon Jun 23 01:45:58 2008 +0200
@@ -108,9 +108,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
@@ -120,7 +117,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);
TCHAR* buffer = StrToTCHARz ( getCodePage (), string);
int result = OS.SendMessage (handle, OS.LB_ADDSTRING, 0, buffer);
if (result is OS.LB_ERR) error (DWT.ERROR_ITEM_NOT_ADDED);
@@ -140,7 +138,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
@@ -152,7 +149,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);
if (index is -1) error (DWT.ERROR_INVALID_RANGE);
TCHAR* buffer = StrToTCHARz(getCodePage (), string);
int result = OS.SendMessage (handle, OS.LB_INSERTSTRING, index, buffer);
@@ -299,9 +297,6 @@
*
* @param indices the array of indices for the items to deselect
*
- * @exception IllegalArgumentException
- * - ERROR_NULL_ARGUMENT - if the set of indices 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
@@ -309,7 +304,8 @@
*/
public void deselect (int [] indices) {
checkWidget ();
- if (indices is null) error (DWT.ERROR_NULL_ARGUMENT);
+ // DWT extension: allow null array
+ //if (indices is null) error (DWT.ERROR_NULL_ARGUMENT);
if (indices.length is 0) return;
if ((style & DWT.SINGLE) !is 0) {
int oldIndex = OS.SendMessage (handle, OS.LB_GETCURSEL, 0, 0);
@@ -656,9 +652,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
@@ -679,9 +672,6 @@
* @param start the zero-relative index at which to start 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
@@ -689,7 +679,8 @@
*/
public int indexOf (String string, int start) {
checkWidget ();
- if (string is null) error (DWT.ERROR_NULL_ARGUMENT);
+ // DWT extension: allow null string
+ //if (string is null) error (DWT.ERROR_NULL_ARGUMENT);
/*
* Bug in Windows. For some reason, LB_FINDSTRINGEXACT
@@ -744,7 +735,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 indices array is null
*
* @exception DWTException
* - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
@@ -753,7 +743,8 @@
*/
public void remove (int [] indices) {
checkWidget ();
- if (indices is null) error (DWT.ERROR_NULL_ARGUMENT);
+ // DWT extension: allow null array
+ //if (indices is null) error (DWT.ERROR_NULL_ARGUMENT);
if (indices.length is 0) return;
int [] newIndices = new int [indices.length];
System.arraycopy (indices, 0, newIndices, 0, indices.length);
@@ -934,7 +925,6 @@
* @param string the item to remove
*
* @exception IllegalArgumentException
- * - ERROR_NULL_ARGUMENT - if the string is null
* - ERROR_INVALID_ARGUMENT - if the string is not found in the list
*
* @exception DWTException
@@ -944,7 +934,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);
@@ -1003,9 +994,6 @@
*
* @param indices the array of indices for the items to select
*
- * @exception IllegalArgumentException
- * - ERROR_NULL_ARGUMENT - if the array of indices 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
@@ -1015,7 +1003,8 @@
*/
public void select (int [] indices) {
checkWidget ();
- if (indices is null) error (DWT.ERROR_NULL_ARGUMENT);
+ // DWT extension: allow null array
+ //if (indices is null) error (DWT.ERROR_NULL_ARGUMENT);
int length = indices.length;
if (length is 0 || ((style & DWT.SINGLE) !is 0 && length > 1)) return;
select (indices, false);
@@ -1187,7 +1176,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
@@ -1196,7 +1184,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 topIndex = getTopIndex ();
bool isSelected = isSelected (index);
remove (index);
@@ -1211,7 +1200,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
@@ -1221,10 +1209,12 @@
*/
public void setItems (String [] items) {
checkWidget ();
- if (items is null) error (DWT.ERROR_NULL_ARGUMENT);
- for (int i=0; i
- * - ERROR_NULL_ARGUMENT - if the array of indices 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
@@ -1355,7 +1342,8 @@
*/
public void setSelection(int [] indices) {
checkWidget ();
- if (indices is null) error (DWT.ERROR_NULL_ARGUMENT);
+ // DWT extension: allow null array
+ //if (indices is null) error (DWT.ERROR_NULL_ARGUMENT);
deselectAll ();
int length = indices.length;
if (length is 0 || ((style & DWT.SINGLE) !is 0 && length > 1)) return;
@@ -1376,9 +1364,6 @@
*
* @param items the array of items
*
- * @exception IllegalArgumentException
- * - ERROR_NULL_ARGUMENT - if the array of items 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
@@ -1390,7 +1375,8 @@
*/
public void setSelection (String [] items) {
checkWidget ();
- if (items is null) error (DWT.ERROR_NULL_ARGUMENT);
+ // DWT extension: allow null array
+ //if (items is null) error (DWT.ERROR_NULL_ARGUMENT);
deselectAll ();
int length = items.length;
if (length is 0 || ((style & DWT.SINGLE) !is 0 && length > 1)) return;