Show
Ignore:
Timestamp:
05/04/08 18:42:55 (4 years ago)
Author:
Frank Benoit <benoit@tionex.de>
branch:
default
Message:

reverted char[] to String

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • dwt/widgets/Text.d

    r158 r238  
    1212 *******************************************************************************/ 
    1313module dwt.widgets.Text; 
     14 
     15import dwt.dwthelper.utils; 
    1416 
    1517 
     
    6163    int fixStart = -1, fixEnd = -1; 
    6264    bool doubleClick; 
    63     char[] message = ""; 
     65    String message = ""; 
    6466 
    6567    static const int INNER_BORDER = 2; 
     
    8082    * this delimiter. 
    8183    */ 
    82     public const static char[] DELIMITER = "\n"; 
     84    public const static String DELIMITER = "\n"; 
    8385    /* 
    8486    * These values can be different on different platforms. 
     
    298300 * </ul> 
    299301 */ 
    300 public void append (char[] string) { 
     302public void append (String string) { 
    301303    checkWidget (); 
    302304    if (string is null) error (DWT.ERROR_NULL_ARGUMENT); 
     
    756758 * @see #DELIMITER 
    757759 */ 
    758 public char[] getLineDelimiter () { 
     760public String getLineDelimiter () { 
    759761    checkWidget (); 
    760762    return "\n"; 
     
    795797 * @since 3.3 
    796798 */ 
    797 public char[] getMessage () { 
     799public String getMessage () { 
    798800    checkWidget (); 
    799801    return message; 
     
    895897 * </ul> 
    896898 */ 
    897 public char[] getSelectionText () { 
     899public String getSelectionText () { 
    898900    checkWidget (); 
    899901    Point selection = getSelection (); 
     
    944946 * </ul> 
    945947 */ 
    946 public char[] getText () { 
     948public String getText () { 
    947949    checkWidget (); 
    948950    char* address; 
     
    956958    } 
    957959    if (address is null) return ""; 
    958     char[] res = fromStringz( address ).dup; 
     960    String res = fromStringz( address ).dup; 
    959961    if ((style & DWT.MULTI) !is 0) OS.g_free (address); 
    960962    return res; 
     
    979981 * </ul> 
    980982 */ 
    981 public char[] getText (int start, int end) { 
     983public String getText (int start, int end) { 
    982984    checkWidget (); 
    983985    if (!(start <= end && 0 <= end)) return ""; 
     
    996998    } 
    997999    if (address is null) error (DWT.ERROR_CANNOT_GET_TEXT); 
    998     char[] res = fromStringz( address ).dup; 
     1000    String res = fromStringz( address ).dup; 
    9991001    OS.g_free (address); 
    10001002    return res; 
     
    11711173    int start = OS.gtk_text_iter_get_offset (&startIter); 
    11721174    int end = OS.gtk_text_iter_get_offset (&endIter); 
    1173     char[] newText = verifyText ("", start, end); 
     1175    String newText = verifyText ("", start, end); 
    11741176    if (newText is null) { 
    11751177        /* Remember the selection when the text was deleted */ 
     
    12001202override int /*long*/ gtk_delete_text (GtkWidget* widget, int /*long*/ start_pos, int /*long*/ end_pos) { 
    12011203    if (!hooks (DWT.Verify) && !filters (DWT.Verify)) return 0; 
    1202     char[] newText = verifyText ("", cast(int)/*64*/start_pos, cast(int)/*64*/end_pos); 
     1204    String newText = verifyText ("", cast(int)/*64*/start_pos, cast(int)/*64*/end_pos); 
    12031205    if (newText is null) { 
    12041206        /* Remember the selection when the text was deleted */ 
     
    12721274    if (!hooks (DWT.Verify) && !filters (DWT.Verify)) return 0; 
    12731275    if (new_text is null || new_text_length is 0) return 0; 
    1274     char[] oldText = (cast(char*)new_text)[ 0 .. new_text_length ].dup; 
     1276    String oldText = (cast(char*)new_text)[ 0 .. new_text_length ].dup; 
    12751277    int pos; 
    12761278    pos = *cast(int*)position; 
     
    12861288        fixStart = fixEnd = -1; 
    12871289    } 
    1288     char[] newText = verifyText (oldText, start, end); 
     1290    String newText = verifyText (oldText, start, end); 
    12891291    if (newText !is oldText) { 
    12901292        int newStart, newEnd; 
     
    13321334        fixStart = fixEnd = -1; 
    13331335    } 
    1334     char[] oldText = text[ 0 .. len ]; 
    1335     char[] newText = verifyText (oldText, start, end); 
     1336    String oldText = text[ 0 .. len ]; 
     1337    String newText = verifyText (oldText, start, end); 
    13361338    if (newText is null) { 
    13371339        OS.g_signal_stop_emission_by_name (bufferHandle, OS.insert_text.ptr); 
     
    13891391 * </ul> 
    13901392 */ 
    1391 public void insert (char[] string) { 
     1393public void insert (String string) { 
    13921394    checkWidget (); 
    13931395    if (string is null) error (DWT.ERROR_NULL_ARGUMENT); 
     
    16791681 * @since 3.3 
    16801682 */ 
    1681 public void setMessage (char[] message) { 
     1683public void setMessage (String message) { 
    16821684    checkWidget (); 
    16831685    if (message is null) error (DWT.ERROR_NULL_ARGUMENT); 
     
    18651867 * </ul> 
    18661868 */ 
    1867 public void setText (char[] string) { 
     1869public void setText (String string) { 
    18681870    checkWidget (); 
    18691871    if (string is null) error (DWT.ERROR_NULL_ARGUMENT); 
     
    20102012} 
    20112013 
    2012 char[] verifyText (char[] string, int start, int end) { 
     2014String verifyText (String string, int start, int end) { 
    20132015    if (string.length is 0 && start is end) return null; 
    20142016    Event event = new Event ();