Show
Ignore:
Timestamp:
05/04/08 18:12:38 (7 months ago)
Author:
Frank Benoit <benoit@tionex.de>
branch:
default
Message:

reverted the char[] to String and use the an alias.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • dwt/custom/CLabel.d

    r155 r212  
    7575    private static const int INDENT = 3; 
    7676    /** a string inserted in the middle of text that has been shortened */ 
    77     private static const char[] ELLIPSIS = "..."; //$NON-NLS-1$ // could use the ellipsis glyph on some platforms "\u2026" 
     77    private static const String ELLIPSIS = "..."; //$NON-NLS-1$ // could use the ellipsis glyph on some platforms "\u2026" 
    7878    /** the alignment. Either CENTER, RIGHT, LEFT. Default is LEFT*/ 
    7979    private int align_ = DWT.LEFT; 
     
    8181    private int vIndent = INDENT; 
    8282    /** the current text */ 
    83     private char[] text; 
     83    private String text; 
    8484    /** the current icon */ 
    8585    private Image image; 
     
    8989    // The appToolTip stores the tooltip set by the application.  Control.tooltiptext 
    9090    // contains whatever tooltip is currently being displayed. 
    91     private char[] appToolTipText; 
     91    private String appToolTipText; 
    9292 
    9393    private Image backgroundImage; 
     
    210210 * characters in the given string, return '\0'. 
    211211 */ 
    212 dchar _findMnemonic (char[] string) { 
     212dchar _findMnemonic (String string) { 
    213213    if (string is null) return '\0'; 
    214214    int index = 0; 
     
    249249 * Compute the minimum size. 
    250250 */ 
    251 private Point getTotalSize(Image image, char[] text) { 
     251private Point getTotalSize(Image image, String text) { 
    252252    Point size = new Point(0, 0); 
    253253 
     
    287287 * @return the text of the label or null 
    288288 */ 
    289 public char[] getText() { 
     289public String getText() { 
    290290    //checkWidget(); 
    291291    return text; 
    292292} 
    293 public override char[] getToolTipText () { 
     293public override String getToolTipText () { 
    294294    checkWidget(); 
    295295    return appToolTipText; 
     
    380380 
    381381    bool shortenText_ = false; 
    382     char[] t = text; 
     382    String t = text; 
    383383    Image img = image; 
    384384    int availableWidth = Math.max(0, rect.width - 2*hIndent); 
     
    393393 
    394394    GC gc = event.gc; 
    395     char[][] lines = text is null ? null : splitString(text); 
     395    String[] lines = text is null ? null : splitString(text); 
    396396 
    397397    // shorten the text 
     
    766766 * </ul> 
    767767 */ 
    768 public void setText(char[] text) { 
     768public void setText(String text) { 
    769769    checkWidget(); 
    770770    if (text is null) text = ""; //$NON-NLS-1$ 
     
    774774    } 
    775775} 
    776 public override void setToolTipText (char[] string) { 
     776public override void setToolTipText (String string) { 
    777777    super.setToolTipText (string); 
    778778    appToolTipText = super.getToolTipText(); 
     
    789789 * @return the shortened text 
    790790 */ 
    791 protected char[] shortenText(GC gc, char[] t, int width) { 
     791protected String shortenText(GC gc, String t, int width) { 
    792792    if (t is null) return null; 
    793793    int w = gc.textExtent(ELLIPSIS, DRAW_FLAGS).x; 
     
    799799    if (mid <= 0) return t; 
    800800    while (min < mid && mid < max) { 
    801         char[] s1 = t[0 .. mid].dup; 
    802         char[] s2 = t[l-mid .. l].dup; 
     801        String s1 = t[0 .. mid].dup; 
     802        String s2 = t[l-mid .. l].dup; 
    803803        int l1 = gc.textExtent(s1, DRAW_FLAGS).x; 
    804804        int l2 = gc.textExtent(s2, DRAW_FLAGS).x; 
     
    817817} 
    818818 
    819 private char[][] splitString(char[] text) { 
    820     char[][] lines = new char[][1]; 
     819private String[] splitString(String text) { 
     820    String[] lines = new String[1]; 
    821821    int start = 0, pos; 
    822822    do { 
     
    828828            lines[lines.length - 1] = text[ start .. pos - (crlf ? 1 : 0)]; 
    829829            start = pos + 1; 
    830             char[][] newLines = new char[][lines.length+1]; 
     830            String[] newLines = new String[lines.length+1]; 
    831831            System.arraycopy(lines, 0, newLines, 0, lines.length); 
    832832            lines = newLines;