Changeset 238:380bad9f6852 for dwt/widgets/Combo.d
- Timestamp:
- 05/04/08 18:42:55 (4 years ago)
- Files:
-
- dwt/widgets/Combo.d (modified) (25 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
dwt/widgets/Combo.d
r200 r238 80 80 GdkEventKey* gdkEventKey; 81 81 int fixStart = -1, fixEnd = -1; 82 char[][] items;82 String[] items; 83 83 bool ignoreSelect, lockText; 84 84 … … 149 149 * @see #add(String,int) 150 150 */ 151 public void add ( char[]string) {151 public void add (String string) { 152 152 checkWidget(); 153 153 if (string is null) error (DWT.ERROR_NULL_ARGUMENT); … … 178 178 * @see #add(String) 179 179 */ 180 public void add ( char[]string, int index) {180 public void add (String string, int index) { 181 181 checkWidget(); 182 182 if (string is null) error (DWT.ERROR_NULL_ARGUMENT); … … 184 184 error (DWT.ERROR_INVALID_RANGE); 185 185 } 186 char[] [] newItems = new char[][]( items.length + 1 );186 String [] newItems = new String[]( items.length + 1 ); 187 187 System.arraycopy (items, 0, newItems, 0, index); 188 188 newItems [index] = string; … … 775 775 * </ul> 776 776 */ 777 public char[]getItem (int index) {777 public String getItem (int index) { 778 778 checkWidget(); 779 779 if (!(0 <= index && index < items.length)) { … … 830 830 * </ul> 831 831 */ 832 public char[][] getItems () {833 checkWidget(); 834 char[] [] result = new char[][](items.length);832 public String [] getItems () { 833 checkWidget(); 834 String [] result = new String[](items.length); 835 835 System.arraycopy (items, 0, result, 0, items.length); 836 836 return result; … … 938 938 * </ul> 939 939 */ 940 public char[]getText () {940 public String getText () { 941 941 checkWidget(); 942 942 if (entryHandle !is null) { … … 950 950 } 951 951 952 char[]getText (int start, int stop) {952 String getText (int start, int stop) { 953 953 /* 954 954 * NOTE: The current implementation uses substring () … … 1049 1049 if (!ignoreSelect) { 1050 1050 auto ptr = OS.gtk_entry_get_text (entryHandle); 1051 char[]text = fromStringz(ptr).dup;1051 String text = fromStringz(ptr).dup; 1052 1052 for (int i = 0; i < items.length; i++) { 1053 1053 if (items [i] ==/*eq*/ text) { … … 1126 1126 } 1127 1127 if (!hooks (DWT.Verify) && !filters (DWT.Verify)) return 0; 1128 char[]newText = verifyText ("", cast(int)/*64*/start_pos, cast(int)/*64*/end_pos);1128 String newText = verifyText ("", cast(int)/*64*/start_pos, cast(int)/*64*/end_pos); 1129 1129 if (newText is null) { 1130 1130 OS.g_signal_stop_emission_by_name (entryHandle, OS.delete_text.ptr); … … 1157 1157 if (!hooks (DWT.Verify) && !filters (DWT.Verify)) return 0; 1158 1158 if (new_text is null || new_text_length is 0) return 0; 1159 char[]oldText = new_text[0..new_text_length];1159 String oldText = new_text[0..new_text_length]; 1160 1160 int pos; 1161 1161 pos = position; … … 1164 1164 pos = fromStringz(ptr).length; 1165 1165 } 1166 char[]newText = verifyText (oldText, pos, pos);1166 String newText = verifyText (oldText, pos, pos); 1167 1167 if (newText !is oldText) { 1168 1168 int newStart, newEnd; … … 1217 1217 * </ul> 1218 1218 */ 1219 public int indexOf ( char[]string) {1219 public int indexOf (String string) { 1220 1220 checkWidget(); 1221 1221 return indexOf (string, 0); … … 1241 1241 * </ul> 1242 1242 */ 1243 public int indexOf ( char[]string, int start) {1243 public int indexOf (String string, int start) { 1244 1244 checkWidget(); 1245 1245 if (string is null) error (DWT.ERROR_NULL_ARGUMENT); … … 1326 1326 error (DWT.ERROR_INVALID_RANGE); 1327 1327 } 1328 char[][] oldItems = items;1329 char[] [] newItems = new char[][]( oldItems.length - 1 );1328 String [] oldItems = items; 1329 String [] newItems = new String[]( oldItems.length - 1 ); 1330 1330 System.arraycopy (oldItems, 0, newItems, 0, index); 1331 1331 System.arraycopy (oldItems, index + 1, newItems, index, oldItems.length - index - 1); … … 1372 1372 error (DWT.ERROR_INVALID_RANGE); 1373 1373 } 1374 char[][] oldItems = items;1375 char[] [] newItems = new char[][](oldItems.length - (end - start + 1));1374 String [] oldItems = items; 1375 String [] newItems = new String[](oldItems.length - (end - start + 1)); 1376 1376 System.arraycopy (oldItems, 0, newItems, 0, start); 1377 1377 System.arraycopy (oldItems, end + 1, newItems, start, oldItems.length - end - 1); … … 1419 1419 * </ul> 1420 1420 */ 1421 public void remove ( char[]string) {1421 public void remove (String string) { 1422 1422 checkWidget(); 1423 1423 if (string is null) error (DWT.ERROR_NULL_ARGUMENT); … … 1642 1642 * </ul> 1643 1643 */ 1644 public void setItem (int index, char[]string) {1644 public void setItem (int index, String string) { 1645 1645 checkWidget(); 1646 1646 if (string is null) error (DWT.ERROR_NULL_ARGUMENT); … … 1678 1678 * </ul> 1679 1679 */ 1680 public void setItems ( char[][] items) {1680 public void setItems (String [] items) { 1681 1681 checkWidget(); 1682 1682 if (items is null) error (DWT.ERROR_NULL_ARGUMENT); … … 1685 1685 } 1686 1686 int count = this.items.length; 1687 this.items = new char[][](items.length);1687 this.items = new String[](items.length); 1688 1688 System.arraycopy (items, 0, this.items, 0, items.length); 1689 1689 if (OS.GTK_VERSION >= OS.buildVERSION (2, 4, 0)) { … … 1693 1693 } 1694 1694 for (int i = 0; i < items.length; i++) { 1695 char[]string = items [i];1695 String string = items [i]; 1696 1696 char* buffer = toStringz(string); 1697 1697 OS.gtk_combo_box_insert_text (handle, i, buffer); … … 1705 1705 int i = 0; 1706 1706 while (i < items.length) { 1707 char[]string = items [i];1707 String string = items [i]; 1708 1708 char * buffer = toStringz(string); 1709 1709 auto item = OS.gtk_list_item_new_with_label (buffer); … … 1825 1825 * </ul> 1826 1826 */ 1827 public void setText ( char[]string) {1827 public void setText (String string) { 1828 1828 checkWidget(); 1829 1829 if (string is null) error (DWT.ERROR_NULL_ARGUMENT); … … 1891 1891 } 1892 1892 1893 override void setToolTipText (Shell shell, char[]newString) {1893 override void setToolTipText (Shell shell, String newString) { 1894 1894 if (entryHandle !is null) shell.setToolTipText (entryHandle, newString); 1895 1895 if (buttonHandle !is null) shell.setToolTipText (buttonHandle, newString); … … 1940 1940 } 1941 1941 1942 char[] verifyText (char[]string, int start, int end) {1942 String verifyText (String string, int start, int end) { 1943 1943 if (string.length is 0 && start is end) return null; 1944 1944 Event event = new Event ();
