diff dwt/widgets/Combo.d @ 212:ab60f3309436

reverted the char[] to String and use the an alias.
author Frank Benoit <benoit@tionex.de>
date Mon, 05 May 2008 00:12:38 +0200
parents ee3ee677f5fc
children 36f5cb12e1a2
line wrap: on
line diff
--- a/dwt/widgets/Combo.d	Sat Apr 26 10:01:48 2008 +0200
+++ b/dwt/widgets/Combo.d	Mon May 05 00:12:38 2008 +0200
@@ -184,7 +184,7 @@
  *
  * @see #add(String,int)
  */
-public void add (char[] string) {
+public void add (String string) {
     checkWidget ();
     if (string is null) error (DWT.ERROR_NULL_ARGUMENT);
     auto buffer = StrToTCHARs( getCodePage(), string, true );
@@ -217,7 +217,7 @@
  *
  * @see #add(String)
  */
-public void add (char[] string, int index) {
+public void add (String string, int index) {
     checkWidget ();
     if (string is null) error (DWT.ERROR_NULL_ARGUMENT);
     int count = OS.SendMessage (handle, OS.CB_GETCOUNT, 0, 0);
@@ -342,7 +342,7 @@
     if (nCode is OS.HCBT_CREATEWND) {
         TCHAR[128] buffer = 0;
         OS.GetClassName (cast(HANDLE)wParam, buffer.ptr, buffer.length );
-        char[] className = TCHARzToStr(buffer.ptr);
+        String className = TCHARzToStr(buffer.ptr);
         if (className=="Edit" || className=="EDIT") { //$NON-NLS-1$  //$NON-NLS-2$
             int bits = OS.GetWindowLong (cast(HANDLE)wParam, OS.GWL_STYLE);
             OS.SetWindowLong (cast(HANDLE)wParam, OS.GWL_STYLE, bits & ~OS.ES_NOHIDESEL);
@@ -669,7 +669,7 @@
  *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
  * </ul>
  */
-public char[] getItem (int index) {
+public String getItem (int index) {
     checkWidget ();
     int length_ = OS.SendMessage (handle, OS.CB_GETLBTEXTLEN, index, 0);
     if (length_ !is OS.CB_ERR) {
@@ -734,10 +734,10 @@
  *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
  * </ul>
  */
-public char[] [] getItems () {
+public String [] getItems () {
     checkWidget ();
     int count = getItemCount ();
-    char[] [] result = new char[] [count];
+    String [] result = new String [count];
     for (int i=0; i<count; i++) result [i] = getItem (i);
     return result;
 }
@@ -769,7 +769,7 @@
     return true;
 }
 
-override char[] getNameText () {
+override String getNameText () {
     return getText ();
 }
 
@@ -852,7 +852,7 @@
  *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
  * </ul>
  */
-public char[] getText () {
+public String getText () {
     checkWidget ();
     int length_ = OS.GetWindowTextLength (handle);
     if (length_ is 0) return "";
@@ -955,7 +955,7 @@
  *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
  * </ul>
  */
-public int indexOf (char[] string) {
+public int indexOf (String string) {
     return indexOf (string, 0);
 }
 
@@ -978,7 +978,7 @@
  *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
  * </ul>
  */
-public int indexOf (char[] string, int start) {
+public int indexOf (String string, int start) {
     checkWidget ();
     if (string is null) error (DWT.ERROR_NULL_ARGUMENT);
 
@@ -1201,7 +1201,7 @@
  *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
  * </ul>
  */
-public void remove (char[] string) {
+public void remove (String string) {
     checkWidget ();
     if (string is null) error (DWT.ERROR_NULL_ARGUMENT);
     int index = indexOf (string, 0);
@@ -1338,7 +1338,7 @@
     }
 
     /* Verify the character */
-    char[] oldText = "";
+    String oldText = "";
     int start, end;
     auto hwndText = OS.GetDlgItem (handle, CBID_EDIT);
     if (hwndText is null) return true;
@@ -1378,7 +1378,7 @@
             oldText = [key];
             break;
     }
-    char[] newText = verifyText (oldText, start, end, event);
+    String newText = verifyText (oldText, start, end, event);
     if (newText is null) return false;
     if (newText is oldText) return true;
     TCHAR* buffer = StrToTCHARz( newText );
@@ -1505,7 +1505,7 @@
  *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
  * </ul>
  */
-public void setItem (int index, char[] string) {
+public void setItem (int index, String string) {
     checkWidget ();
     if (string is null) error (DWT.ERROR_NULL_ARGUMENT);
     int selection = getSelectionIndex ();
@@ -1529,7 +1529,7 @@
  *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
  * </ul>
  */
-public void setItems (char[] [] items) {
+public void setItems (String [] items) {
     checkWidget ();
     if (items is null) error (DWT.ERROR_NULL_ARGUMENT);
     for (int i=0; i<items.length; i++) {
@@ -1549,7 +1549,7 @@
     OS.SendMessage (handle, OS.CB_RESETCONTENT, 0, 0);
     int codePage = getCodePage ();
     for (int i=0; i<items.length; i++) {
-        char[] string = items [i];
+        String string = items [i];
         TCHAR* buffer = StrToTCHARz( string );
         int code = OS.SendMessage (handle, OS.CB_ADDSTRING, 0, buffer);
         if (code is OS.CB_ERR) error (DWT.ERROR_ITEM_NOT_ADDED);
@@ -1803,7 +1803,7 @@
  *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
  * </ul>
  */
-public void setText (char[] string) {
+public void setText (String string) {
     checkWidget ();
     if (string is null) error (DWT.ERROR_NULL_ARGUMENT);
     if ((style & DWT.READ_ONLY) !is 0) {
@@ -1850,7 +1850,7 @@
     OS.SendMessage (handle, OS.CB_LIMITTEXT, limit, 0);
 }
 
-override void setToolTipText (Shell shell, char[] string) {
+override void setToolTipText (Shell shell, String string) {
     auto hwndText = OS.GetDlgItem (handle, CBID_EDIT);
     auto hwndList = OS.GetDlgItem (handle, CBID_LIST);
     if (hwndText !is null) shell.setToolTipText (hwndText, string);
@@ -1952,7 +1952,7 @@
     }
 }
 
-char[] verifyText (char[] string, int start, int end, Event keyEvent) {
+String verifyText (String string, int start, int end, Event keyEvent) {
     Event event = new Event ();
     event.text = string;
     event.start = start;
@@ -2006,7 +2006,7 @@
     return bits | OS.CBS_DROPDOWN;
 }
 
-override char[] windowClass () {
+override String windowClass () {
     return TCHARzToStr( ComboClass );
 }
 
@@ -2076,7 +2076,7 @@
     if (msg is OS.CB_SETCURSEL) {
         if ((style & DWT.READ_ONLY) !is 0) {
             if (hooks (DWT.Verify) || filters (DWT.Verify)) {
-                char[] oldText = getText (), newText = null;
+                String oldText = getText (), newText = null;
                 if (wParam is -1) {
                     newText = "";
                 } else {
@@ -2272,7 +2272,7 @@
     if (!hooks (DWT.Verify) && !filters (DWT.Verify)) return null;
     bool call = false;
     int start, end;
-    char[] newText = null;
+    String newText = null;
     switch (msg) {
         case OS.WM_CLEAR:
         case OS.WM_CUT:
@@ -2318,7 +2318,7 @@
         default:
     }
     if (newText !is null) {
-        char[] oldText = newText;
+        String oldText = newText;
         newText = verifyText (newText, start, end, null);
         if (newText is null) return LRESULT.ZERO;
         if (newText!=/*eq*/oldText) {