Mercurial > projects > dwt-linux
diff dwt/custom/StyledText.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 |
line wrap: on
line diff
--- a/dwt/custom/StyledText.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/custom/StyledText.d Sun Jun 15 22:32:20 2008 +0200 @@ -1598,15 +1598,13 @@ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT when listener is null</li> - * </ul> */ public void append(String string) { checkWidget(); - if (string is null) { - DWT.error(DWT.ERROR_NULL_ARGUMENT); - } + // DWT extension: allow null for zero length string +// if (string is null) { +// DWT.error(DWT.ERROR_NULL_ARGUMENT); +// } int lastChar = Math.max(getCharCount(), 0); replaceTextRange(lastChar, 0, string); } @@ -4934,15 +4932,13 @@ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT when string is null</li> - * </ul> */ public void insert(String string) { checkWidget(); - if (string is null) { - DWT.error(DWT.ERROR_NULL_ARGUMENT); - } + // DWT extension: allow null for zero length string +// if (string is null) { +// DWT.error(DWT.ERROR_NULL_ARGUMENT); +// } Point sel = getSelectionRange(); replaceTextRange(sel.x, sel.y, string); } @@ -6457,7 +6453,6 @@ * </ul> * @exception IllegalArgumentException <ul> * <li>ERROR_INVALID_RANGE when either start or end is outside the valid range (0 <= offset <= getCharCount())</li> - * <li>ERROR_NULL_ARGUMENT when ranges is null</li> * </ul> * * @since 2.0 @@ -6467,7 +6462,8 @@ public void replaceStyleRanges(int start, int length, StyleRange[] ranges) { checkWidget(); if (isListening(LineGetStyle)) return; - if (ranges is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (ranges is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); setStyleRanges(start, length, null, ranges, false); } /** @@ -6500,14 +6496,14 @@ * <li>ERROR_INVALID_RANGE when either start or end is outside the valid range (0 <= offset <= getCharCount())</li> * <li>ERROR_INVALID_ARGUMENT when either start or end is inside a multi byte line delimiter. * Splitting a line delimiter for example by inserting text in between the CR and LF and deleting part of a line delimiter is not supported</li> - * <li>ERROR_NULL_ARGUMENT when string is null</li> * </ul> */ public void replaceTextRange(int start, int length, String text) { checkWidget(); - if (text is null) { - DWT.error(DWT.ERROR_NULL_ARGUMENT); - } + // DWT extension: allow null for zero length string +// if (text is null) { +// DWT.error(DWT.ERROR_NULL_ARGUMENT); +// } int contentLength = getCharCount(); int end = start + length; if (start > end || start < 0 || end > contentLength) { @@ -8095,7 +8091,6 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT when the list of ranges is null</li> * <li>ERROR_INVALID_RANGE when the last of the style ranges is outside the valid range (> getCharCount())</li> * </ul> * @@ -8104,7 +8099,8 @@ public void setStyleRanges(StyleRange[] ranges) { checkWidget(); if (isListening(LineGetStyle)) return; - if (ranges is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (ranges is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); setStyleRanges(0, 0, null, ranges, true); } /** @@ -8142,15 +8138,13 @@ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT when string is null</li> - * </ul> */ public void setText(String text) { checkWidget(); - if (text is null) { - DWT.error(DWT.ERROR_NULL_ARGUMENT); - } + // DWT extension: allow null for zero length string +// if (text is null) { +// DWT.error(DWT.ERROR_NULL_ARGUMENT); +// } Event event = new Event(); event.start = 0; event.end = getCharCount();