Mercurial > projects > dwt-linux
diff dwt/widgets/Combo.d @ 238:380bad9f6852
reverted char[] to String
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Mon, 05 May 2008 00:42:55 +0200 |
parents | 08789b28bdf3 |
children | ce446666f5a2 |
line wrap: on
line diff
--- a/dwt/widgets/Combo.d Sat Apr 26 10:01:30 2008 +0200 +++ b/dwt/widgets/Combo.d Mon May 05 00:42:55 2008 +0200 @@ -79,7 +79,7 @@ int lastEventTime, visibleCount = 5; GdkEventKey* gdkEventKey; int fixStart = -1, fixEnd = -1; - char[][] items; + String[] items; bool ignoreSelect, lockText; static const int INNER_BORDER = 2; @@ -148,7 +148,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); add (string, items.length); @@ -177,13 +177,13 @@ * * @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); if (!(0 <= index && index <= items.length)) { error (DWT.ERROR_INVALID_RANGE); } - char[] [] newItems = new char[][]( items.length + 1 ); + String [] newItems = new String[]( items.length + 1 ); System.arraycopy (items, 0, newItems, 0, index); newItems [index] = string; System.arraycopy (items, index, newItems, index + 1, items.length - index); @@ -774,7 +774,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(); if (!(0 <= index && index < items.length)) { error (DWT.ERROR_INVALID_RANGE); @@ -829,9 +829,9 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public char[] [] getItems () { +public String [] getItems () { checkWidget(); - char[] [] result = new char[][](items.length); + String [] result = new String[](items.length); System.arraycopy (items, 0, result, 0, items.length); return result; } @@ -937,7 +937,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(); if (entryHandle !is null) { auto str = OS.gtk_entry_get_text (entryHandle); @@ -949,7 +949,7 @@ } } -char[] getText (int start, int stop) { +String getText (int start, int stop) { /* * NOTE: The current implementation uses substring () * which can reference a potentially large character @@ -1048,7 +1048,7 @@ } else { if (!ignoreSelect) { auto ptr = OS.gtk_entry_get_text (entryHandle); - char[] text = fromStringz(ptr).dup; + String text = fromStringz(ptr).dup; for (int i = 0; i < items.length; i++) { if (items [i] ==/*eq*/ text) { postEvent (DWT.Selection); @@ -1125,7 +1125,7 @@ return 0; } if (!hooks (DWT.Verify) && !filters (DWT.Verify)) return 0; - char[] newText = verifyText ("", cast(int)/*64*/start_pos, cast(int)/*64*/end_pos); + String newText = verifyText ("", cast(int)/*64*/start_pos, cast(int)/*64*/end_pos); if (newText is null) { OS.g_signal_stop_emission_by_name (entryHandle, OS.delete_text.ptr); } else { @@ -1156,14 +1156,14 @@ } if (!hooks (DWT.Verify) && !filters (DWT.Verify)) return 0; if (new_text is null || new_text_length is 0) return 0; - char[] oldText = new_text[0..new_text_length]; + String oldText = new_text[0..new_text_length]; int pos; pos = position; if (pos is -1) { auto ptr = OS.gtk_entry_get_text (entryHandle); pos = fromStringz(ptr).length; } - char[] newText = verifyText (oldText, pos, pos); + String newText = verifyText (oldText, pos, pos); if (newText !is oldText) { int newStart, newEnd; OS.gtk_editable_get_selection_bounds (entryHandle, &newStart, &newEnd); @@ -1216,7 +1216,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) { checkWidget(); return indexOf (string, 0); } @@ -1240,7 +1240,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); if (!(0 <= start && start < items.length)) return -1; @@ -1325,8 +1325,8 @@ if (!(0 <= index && index < items.length)) { error (DWT.ERROR_INVALID_RANGE); } - char[] [] oldItems = items; - char[] [] newItems = new char[][]( oldItems.length - 1 ); + String [] oldItems = items; + String [] newItems = new String[]( oldItems.length - 1 ); System.arraycopy (oldItems, 0, newItems, 0, index); System.arraycopy (oldItems, index + 1, newItems, index, oldItems.length - index - 1); items = newItems; @@ -1371,8 +1371,8 @@ if (!(0 <= start && start <= end && end < items.length)) { error (DWT.ERROR_INVALID_RANGE); } - char[] [] oldItems = items; - char[] [] newItems = new char[][](oldItems.length - (end - start + 1)); + String [] oldItems = items; + String [] newItems = new String[](oldItems.length - (end - start + 1)); System.arraycopy (oldItems, 0, newItems, 0, start); System.arraycopy (oldItems, end + 1, newItems, start, oldItems.length - end - 1); items = newItems; @@ -1418,7 +1418,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); @@ -1641,7 +1641,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); if (!(0 <= index && index < items.length)) { @@ -1677,14 +1677,14 @@ * <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++) { if (items [i] is null) error (DWT.ERROR_INVALID_ARGUMENT); } int count = this.items.length; - this.items = new char[][](items.length); + this.items = new String[](items.length); System.arraycopy (items, 0, this.items, 0, items.length); if (OS.GTK_VERSION >= OS.buildVERSION (2, 4, 0)) { clearText (); @@ -1692,7 +1692,7 @@ OS.gtk_combo_box_remove_text (handle, i); } for (int i = 0; i < items.length; i++) { - char[] string = items [i]; + String string = items [i]; char* buffer = toStringz(string); OS.gtk_combo_box_insert_text (handle, i, buffer); } @@ -1704,7 +1704,7 @@ int direction = OS.gtk_widget_get_direction (handle); int i = 0; while (i < items.length) { - char[] string = items [i]; + String string = items [i]; char * buffer = toStringz(string); auto item = OS.gtk_list_item_new_with_label (buffer); auto label = OS.gtk_bin_get_child (item); @@ -1824,7 +1824,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) { @@ -1890,7 +1890,7 @@ if (entryHandle !is null) OS.gtk_entry_set_max_length (entryHandle, limit); } -override void setToolTipText (Shell shell, char[] newString) { +override void setToolTipText (Shell shell, String newString) { if (entryHandle !is null) shell.setToolTipText (entryHandle, newString); if (buttonHandle !is null) shell.setToolTipText (buttonHandle, newString); } @@ -1939,7 +1939,7 @@ return super.translateTraversal (keyEvent); } -char[] verifyText (char[] string, int start, int end) { +String verifyText (String string, int start, int end) { if (string.length is 0 && start is end) return null; Event event = new Event (); event.text = string;