Mercurial > projects > dwt-win
comparison dwt/custom/CTabFolder.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 | 184ab53b7785 |
children | 36f5cb12e1a2 |
comparison
equal
deleted
inserted
replaced
211:ff59aeb96cac | 212:ab60f3309436 |
---|---|
409 * but a texture. To show the correct default background, we must allow | 409 * but a texture. To show the correct default background, we must allow |
410 * the operating system to draw it and therefore, we can not use the | 410 * the operating system to draw it and therefore, we can not use the |
411 * NO_BACKGROUND style. The NO_BACKGROUND style is not required on platforms | 411 * NO_BACKGROUND style. The NO_BACKGROUND style is not required on platforms |
412 * that use double buffering which is true in both of these cases. | 412 * that use double buffering which is true in both of these cases. |
413 */ | 413 */ |
414 char[] platform = DWT.getPlatform(); | 414 String platform = DWT.getPlatform(); |
415 if ("carbon"==platform || "gtk"==platform) return style; //$NON-NLS-1$ //$NON-NLS-2$ | 415 if ("carbon"==platform || "gtk"==platform) return style; //$NON-NLS-1$ //$NON-NLS-2$ |
416 | 416 |
417 //TEMPORARY CODE | 417 //TEMPORARY CODE |
418 /* | 418 /* |
419 * In Right To Left orientation on Windows, all GC calls that use a brush are drawing | 419 * In Right To Left orientation on Windows, all GC calls that use a brush are drawing |
877 while (showCount < priority.length && items[priority[showCount]].showing) { | 877 while (showCount < priority.length && items[priority[showCount]].showing) { |
878 showCount++; | 878 showCount++; |
879 } | 879 } |
880 count = items.length - showCount; | 880 count = items.length - showCount; |
881 } | 881 } |
882 char[] chevronString = count > 99 ? "99+" : to!(char[])(count); //$NON-NLS-1$ | 882 String chevronString = count > 99 ? "99+" : to!(String)(count); //$NON-NLS-1$ |
883 switch (chevronImageState) { | 883 switch (chevronImageState) { |
884 case NORMAL: { | 884 case NORMAL: { |
885 Color chevronBorder = single ? getSelectionForeground() : getForeground(); | 885 Color chevronBorder = single ? getSelectionForeground() : getForeground(); |
886 gc.setForeground(chevronBorder); | 886 gc.setForeground(chevronBorder); |
887 gc.setFont(f); | 887 gc.setFont(f); |
1294 /* | 1294 /* |
1295 * Return the lowercase of the first non-'&' character following | 1295 * Return the lowercase of the first non-'&' character following |
1296 * an '&' character in the given string. If there are no '&' | 1296 * an '&' character in the given string. If there are no '&' |
1297 * characters in the given string, return '\0'. | 1297 * characters in the given string, return '\0'. |
1298 */ | 1298 */ |
1299 dchar _findMnemonic (char[] string) { | 1299 dchar _findMnemonic (String string) { |
1300 if (string is null) return '\0'; | 1300 if (string is null) return '\0'; |
1301 int index = 0; | 1301 int index = 0; |
1302 int length_ = string.length; | 1302 int length_ = string.length; |
1303 do { | 1303 do { |
1304 while (index < length_ && string[index] !is '&') index++; | 1304 while (index < length_ && string[index] !is '&') index++; |
1306 if (string[index] !is '&') return CharacterToLower(firstCodePoint( string[index..$])); | 1306 if (string[index] !is '&') return CharacterToLower(firstCodePoint( string[index..$])); |
1307 index++; | 1307 index++; |
1308 } while (index < length_); | 1308 } while (index < length_); |
1309 return '\0'; | 1309 return '\0'; |
1310 } | 1310 } |
1311 char[] stripMnemonic (char[] string) { | 1311 String stripMnemonic (String string) { |
1312 int index = 0; | 1312 int index = 0; |
1313 int length_ = string.length; | 1313 int length_ = string.length; |
1314 do { | 1314 do { |
1315 while ((index < length_) && (string[index] !is '&')) index++; | 1315 while ((index < length_) && (string[index] !is '&')) index++; |
1316 if (++index >= length_) return string; | 1316 if (++index >= length_) return string; |
1639 } | 1639 } |
1640 void initAccessible() { | 1640 void initAccessible() { |
1641 final Accessible accessible = getAccessible(); | 1641 final Accessible accessible = getAccessible(); |
1642 accessible.addAccessibleListener(new class() AccessibleAdapter { | 1642 accessible.addAccessibleListener(new class() AccessibleAdapter { |
1643 public void getName(AccessibleEvent e) { | 1643 public void getName(AccessibleEvent e) { |
1644 char[] name = null; | 1644 String name = null; |
1645 int childID = e.childID; | 1645 int childID = e.childID; |
1646 if (childID >= 0 && childID < items.length) { | 1646 if (childID >= 0 && childID < items.length) { |
1647 name = stripMnemonic(items[childID].getText()); | 1647 name = stripMnemonic(items[childID].getText()); |
1648 } else if (childID is items.length + CHEVRON_CHILD_ID) { | 1648 } else if (childID is items.length + CHEVRON_CHILD_ID) { |
1649 name = DWT.getMessage("SWT_ShowList"); //$NON-NLS-1$ | 1649 name = DWT.getMessage("SWT_ShowList"); //$NON-NLS-1$ |
1654 } | 1654 } |
1655 e.result = name; | 1655 e.result = name; |
1656 } | 1656 } |
1657 | 1657 |
1658 public void getHelp(AccessibleEvent e) { | 1658 public void getHelp(AccessibleEvent e) { |
1659 char[] help = null; | 1659 String help = null; |
1660 int childID = e.childID; | 1660 int childID = e.childID; |
1661 if (childID is ACC.CHILDID_SELF) { | 1661 if (childID is ACC.CHILDID_SELF) { |
1662 help = getToolTipText(); | 1662 help = getToolTipText(); |
1663 } else if (childID >= 0 && childID < items.length) { | 1663 } else if (childID >= 0 && childID < items.length) { |
1664 help = items[childID].getToolTipText(); | 1664 help = items[childID].getToolTipText(); |
1665 } | 1665 } |
1666 e.result = help; | 1666 e.result = help; |
1667 } | 1667 } |
1668 | 1668 |
1669 public void getKeyboardShortcut(AccessibleEvent e) { | 1669 public void getKeyboardShortcut(AccessibleEvent e) { |
1670 char[] shortcut = null; | 1670 String shortcut = null; |
1671 int childID = e.childID; | 1671 int childID = e.childID; |
1672 if (childID >= 0 && childID < items.length) { | 1672 if (childID >= 0 && childID < items.length) { |
1673 char[] text = items[childID].getText(); | 1673 String text = items[childID].getText(); |
1674 if (text !is null) { | 1674 if (text !is null) { |
1675 dchar mnemonic = _findMnemonic(text); | 1675 dchar mnemonic = _findMnemonic(text); |
1676 if (mnemonic !is '\0') { | 1676 if (mnemonic !is '\0') { |
1677 shortcut = "Alt+"~tango.text.convert.Utf.toString([mnemonic]); //$NON-NLS-1$ | 1677 shortcut = "Alt+"~tango.text.convert.Utf.toString([mnemonic]); //$NON-NLS-1$ |
1678 } | 1678 } |
1736 public void getChildCount(AccessibleControlEvent e) { | 1736 public void getChildCount(AccessibleControlEvent e) { |
1737 e.detail = items.length + EXTRA_CHILD_ID_COUNT; | 1737 e.detail = items.length + EXTRA_CHILD_ID_COUNT; |
1738 } | 1738 } |
1739 | 1739 |
1740 public void getDefaultAction(AccessibleControlEvent e) { | 1740 public void getDefaultAction(AccessibleControlEvent e) { |
1741 char[] action = null; | 1741 String action = null; |
1742 int childID = e.childID; | 1742 int childID = e.childID; |
1743 if (childID >= 0 && childID < items.length) { | 1743 if (childID >= 0 && childID < items.length) { |
1744 action = DWT.getMessage ("SWT_Switch"); //$NON-NLS-1$ | 1744 action = DWT.getMessage ("SWT_Switch"); //$NON-NLS-1$ |
1745 } | 1745 } |
1746 if (childID >= items.length && childID < items.length + EXTRA_CHILD_ID_COUNT) { | 1746 if (childID >= items.length && childID < items.length + EXTRA_CHILD_ID_COUNT) { |
3866 MenuItem[] items = showMenu.getItems(); | 3866 MenuItem[] items = showMenu.getItems(); |
3867 for (int i = 0; i < items.length; i++) { | 3867 for (int i = 0; i < items.length; i++) { |
3868 items[i].dispose(); | 3868 items[i].dispose(); |
3869 } | 3869 } |
3870 } | 3870 } |
3871 static const char[] id = "CTabFolder_showList_Index"; //$NON-NLS-1$ | 3871 static const String id = "CTabFolder_showList_Index"; //$NON-NLS-1$ |
3872 for (int i = 0; i < items.length; i++) { | 3872 for (int i = 0; i < items.length; i++) { |
3873 CTabItem tab = items[i]; | 3873 CTabItem tab = items[i]; |
3874 if (tab.showing) continue; | 3874 if (tab.showing) continue; |
3875 MenuItem item = new MenuItem(showMenu, DWT.NONE); | 3875 MenuItem item = new MenuItem(showMenu, DWT.NONE); |
3876 item.setText(tab.getText()); | 3876 item.setText(tab.getText()); |
3910 showItem(getSelection()); | 3910 showItem(getSelection()); |
3911 } | 3911 } |
3912 } | 3912 } |
3913 | 3913 |
3914 void _setToolTipText (int x, int y) { | 3914 void _setToolTipText (int x, int y) { |
3915 char[] oldTip = getToolTipText(); | 3915 String oldTip = getToolTipText(); |
3916 char[] newTip = _getToolTip(x, y); | 3916 String newTip = _getToolTip(x, y); |
3917 if (newTip is null || newTip!=oldTip) { | 3917 if (newTip is null || newTip!=oldTip) { |
3918 setToolTipText(newTip); | 3918 setToolTipText(newTip); |
3919 } | 3919 } |
3920 } | 3920 } |
3921 | 3921 |
4043 20+d, 12+d, 21+d, 12+d, 22+d, 12+d ]; | 4043 20+d, 12+d, 21+d, 12+d, 22+d, 12+d ]; |
4044 } | 4044 } |
4045 notifyListeners(DWT.Resize, new Event()); | 4045 notifyListeners(DWT.Resize, new Event()); |
4046 return true; | 4046 return true; |
4047 } | 4047 } |
4048 char[] _getToolTip(int x, int y) { | 4048 String _getToolTip(int x, int y) { |
4049 if (showMin && minRect.contains(x, y)) return minimized ? DWT.getMessage("SWT_Restore") : DWT.getMessage("SWT_Minimize"); //$NON-NLS-1$ //$NON-NLS-2$ | 4049 if (showMin && minRect.contains(x, y)) return minimized ? DWT.getMessage("SWT_Restore") : DWT.getMessage("SWT_Minimize"); //$NON-NLS-1$ //$NON-NLS-2$ |
4050 if (showMax && maxRect.contains(x, y)) return maximized ? DWT.getMessage("SWT_Restore") : DWT.getMessage("SWT_Maximize"); //$NON-NLS-1$ //$NON-NLS-2$ | 4050 if (showMax && maxRect.contains(x, y)) return maximized ? DWT.getMessage("SWT_Restore") : DWT.getMessage("SWT_Maximize"); //$NON-NLS-1$ //$NON-NLS-2$ |
4051 if (showChevron && chevronRect.contains(x, y)) return DWT.getMessage("SWT_ShowList"); //$NON-NLS-1$ | 4051 if (showChevron && chevronRect.contains(x, y)) return DWT.getMessage("SWT_ShowList"); //$NON-NLS-1$ |
4052 CTabItem item = getItem(new Point (x, y)); | 4052 CTabItem item = getItem(new Point (x, y)); |
4053 if (item is null) return null; | 4053 if (item is null) return null; |