Mercurial > projects > dwt-win
comparison dwt/widgets/TreeItem.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 | 25f88bf5a6df |
children | 36f5cb12e1a2 |
comparison
equal
deleted
inserted
replaced
211:ff59aeb96cac | 212:ab60f3309436 |
---|---|
54 * platforms and should never be accessed from application code. | 54 * platforms and should never be accessed from application code. |
55 * </p> | 55 * </p> |
56 */ | 56 */ |
57 public HANDLE handle; | 57 public HANDLE handle; |
58 Tree parent; | 58 Tree parent; |
59 char[] [] strings; | 59 String [] strings; |
60 Image [] images; | 60 Image [] images; |
61 bool cached; | 61 bool cached; |
62 int background = -1, foreground = -1; | 62 int background = -1, foreground = -1; |
63 HFONT font = cast(HFONT)-1; | 63 HFONT font = cast(HFONT)-1; |
64 int [] cellBackground, cellForeground; | 64 int [] cellBackground, cellForeground; |
509 if (getText) { | 509 if (getText) { |
510 if (fullText) { | 510 if (fullText) { |
511 rect.left = rect.right + Tree.INSET; | 511 rect.left = rect.right + Tree.INSET; |
512 rect.right = headerRect.right; | 512 rect.right = headerRect.right; |
513 } else { | 513 } else { |
514 char[] string = index is 0 ? text : strings !is null ? strings [index] : null; | 514 String string = index is 0 ? text : strings !is null ? strings [index] : null; |
515 if (string !is null) { | 515 if (string !is null) { |
516 RECT textRect; | 516 RECT textRect; |
517 TCHAR[] buffer = StrToTCHARs (parent.getCodePage (), string, false); | 517 TCHAR[] buffer = StrToTCHARs (parent.getCodePage (), string, false); |
518 int flags = OS.DT_NOPREFIX | OS.DT_SINGLELINE | OS.DT_CALCRECT; | 518 int flags = OS.DT_NOPREFIX | OS.DT_SINGLELINE | OS.DT_CALCRECT; |
519 auto hNewDC = hDC; | 519 auto hNewDC = hDC; |
881 auto hwnd = parent.handle; | 881 auto hwnd = parent.handle; |
882 auto hItem = cast(HANDLE) OS.SendMessage (hwnd, OS.TVM_GETNEXTITEM, OS.TVGN_PARENT, handle); | 882 auto hItem = cast(HANDLE) OS.SendMessage (hwnd, OS.TVM_GETNEXTITEM, OS.TVGN_PARENT, handle); |
883 return hItem !is null ? parent._getItem (hItem) : null; | 883 return hItem !is null ? parent._getItem (hItem) : null; |
884 } | 884 } |
885 | 885 |
886 override public char[] getText () { | 886 override public String getText () { |
887 checkWidget(); | 887 checkWidget(); |
888 if (!parent.checkData (this, true)) error (DWT.ERROR_WIDGET_DISPOSED); | 888 if (!parent.checkData (this, true)) error (DWT.ERROR_WIDGET_DISPOSED); |
889 return super.getText (); | 889 return super.getText (); |
890 } | 890 } |
891 | 891 |
901 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> | 901 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> |
902 * </ul> | 902 * </ul> |
903 * | 903 * |
904 * @since 3.1 | 904 * @since 3.1 |
905 */ | 905 */ |
906 public char[] getText (int index) { | 906 public String getText (int index) { |
907 checkWidget(); | 907 checkWidget(); |
908 if (!parent.checkData (this, true)) error (DWT.ERROR_WIDGET_DISPOSED); | 908 if (!parent.checkData (this, true)) error (DWT.ERROR_WIDGET_DISPOSED); |
909 if (index is 0) return getText (); | 909 if (index is 0) return getText (); |
910 if (strings !is null) { | 910 if (strings !is null) { |
911 if (0 <= index && index < strings.length) { | 911 if (0 <= index && index < strings.length) { |
912 char[] string = strings [index]; | 912 String string = strings [index]; |
913 return string !is null ? string : ""; | 913 return string !is null ? string : ""; |
914 } | 914 } |
915 } | 915 } |
916 return ""; | 916 return ""; |
917 } | 917 } |
1775 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> | 1775 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> |
1776 * </ul> | 1776 * </ul> |
1777 * | 1777 * |
1778 * @since 3.1 | 1778 * @since 3.1 |
1779 */ | 1779 */ |
1780 public void setText (char[][] strings) { | 1780 public void setText (String[] strings) { |
1781 checkWidget(); | 1781 checkWidget(); |
1782 if (strings is null) error (DWT.ERROR_NULL_ARGUMENT); | 1782 if (strings is null) error (DWT.ERROR_NULL_ARGUMENT); |
1783 for (int i=0; i<strings.length; i++) { | 1783 for (int i=0; i<strings.length; i++) { |
1784 char[] string = strings [i]; | 1784 String string = strings [i]; |
1785 if (string !is null) setText (i, string); | 1785 if (string !is null) setText (i, string); |
1786 } | 1786 } |
1787 } | 1787 } |
1788 | 1788 |
1789 /** | 1789 /** |
1800 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> | 1800 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> |
1801 * </ul> | 1801 * </ul> |
1802 * | 1802 * |
1803 * @since 3.1 | 1803 * @since 3.1 |
1804 */ | 1804 */ |
1805 public void setText (int index, char[] string) { | 1805 public void setText (int index, String string) { |
1806 checkWidget(); | 1806 checkWidget(); |
1807 if (string is null) error (DWT.ERROR_NULL_ARGUMENT); | 1807 if (string is null) error (DWT.ERROR_NULL_ARGUMENT); |
1808 if (index is 0) { | 1808 if (index is 0) { |
1809 if (string==/*eq*/text) return; | 1809 if (string==/*eq*/text) return; |
1810 super.setText (string); | 1810 super.setText (string); |
1811 } | 1811 } |
1812 int count = Math.max (1, parent.getColumnCount ()); | 1812 int count = Math.max (1, parent.getColumnCount ()); |
1813 if (0 > index || index > count - 1) return; | 1813 if (0 > index || index > count - 1) return; |
1814 if (strings is null && index !is 0) { | 1814 if (strings is null && index !is 0) { |
1815 strings = new char[] [count]; | 1815 strings = new String [count]; |
1816 strings [0] = text; | 1816 strings [0] = text; |
1817 } | 1817 } |
1818 if (strings !is null) { | 1818 if (strings !is null) { |
1819 if (string==/*eq*/strings [index]) return; | 1819 if (string==/*eq*/strings [index]) return; |
1820 strings [index] = string; | 1820 strings [index] = string; |
1833 } else { | 1833 } else { |
1834 redraw (index, true, false); | 1834 redraw (index, true, false); |
1835 } | 1835 } |
1836 } | 1836 } |
1837 | 1837 |
1838 override public void setText (char[] string) { | 1838 override public void setText (String string) { |
1839 checkWidget(); | 1839 checkWidget(); |
1840 setText (0, string); | 1840 setText (0, string); |
1841 } | 1841 } |
1842 | 1842 |
1843 /*public*/ void sort () { | 1843 /*public*/ void sort () { |