comparison dwt/custom/TableTreeItem.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 a5afe31f5cdd
children 36f5cb12e1a2
comparison
equal deleted inserted replaced
211:ff59aeb96cac 212:ab60f3309436
40 public class TableTreeItem : Item { 40 public class TableTreeItem : Item {
41 TableItem tableItem; 41 TableItem tableItem;
42 TableTree parent; 42 TableTree parent;
43 TableTreeItem parentItem; 43 TableTreeItem parentItem;
44 TableTreeItem [] items; 44 TableTreeItem [] items;
45 char[][] texts; 45 String[] texts;
46 Image[] images; 46 Image[] images;
47 Color background; 47 Color background;
48 Color foreground; 48 Color foreground;
49 Font font; 49 Font font;
50 bool expanded; 50 bool expanded;
486 */ 486 */
487 public TableTreeItem getParentItem () { 487 public TableTreeItem getParentItem () {
488 //checkWidget(); 488 //checkWidget();
489 return parentItem; 489 return parentItem;
490 } 490 }
491 public override char[] getText () { 491 public override String getText () {
492 checkWidget(); 492 checkWidget();
493 return getText(0); 493 return getText(0);
494 } 494 }
495 495
496 /** 496 /**
503 * the OS. 503 * the OS.
504 * 504 *
505 * @param index the index of the item 505 * @param index the index of the item
506 * @return the item text at the specified index, which can be null 506 * @return the item text at the specified index, which can be null
507 */ 507 */
508 public char[] getText(int index) { 508 public String getText(int index) {
509 //checkWidget(); 509 //checkWidget();
510 if (0 <= index && index < texts.length) return texts[index]; 510 if (0 <= index && index < texts.length) return texts[index];
511 return null; 511 return null;
512 } 512 }
513 513
825 * @exception DWTException <ul> 825 * @exception DWTException <ul>
826 * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> 826 * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
827 * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> 827 * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
828 * </ul> 828 * </ul>
829 */ 829 */
830 public void setText(int index, char[] text) { 830 public void setText(int index, String text) {
831 checkWidget(); 831 checkWidget();
832 if (text is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); 832 if (text is null) DWT.error (DWT.ERROR_NULL_ARGUMENT);
833 int columnCount = Math.max(parent.getTable().getColumnCount(), 1); 833 int columnCount = Math.max(parent.getTable().getColumnCount(), 1);
834 if (index < 0 || index >= columnCount) return; 834 if (index < 0 || index >= columnCount) return;
835 if (texts.length < columnCount) { 835 if (texts.length < columnCount) {
836 char[][] newTexts = new char[][columnCount]; 836 String[] newTexts = new String[columnCount];
837 System.arraycopy(texts, 0, newTexts, 0, texts.length); 837 System.arraycopy(texts, 0, newTexts, 0, texts.length);
838 texts = newTexts; 838 texts = newTexts;
839 } 839 }
840 texts[index] = text; 840 texts[index] = text;
841 if (tableItem !is null) tableItem.setText(index, text); 841 if (tableItem !is null) tableItem.setText(index, text);
842 } 842 }
843 public override void setText (char[] string) { 843 public override void setText (String string) {
844 setText(0, string); 844 setText(0, string);
845 } 845 }
846 846
847 void setVisible (bool show) { 847 void setVisible (bool show) {
848 if (parentItem is null) return; // this is a root and can not be toggled between visible and hidden 848 if (parentItem is null) return; // this is a root and can not be toggled between visible and hidden