Mercurial > projects > dwt-linux
comparison dwt/custom/CTabFolder.d @ 253:cf113c9ff968
Fix: removed debugging prints and reactivated the code.
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 08 Jun 2008 03:19:38 +0200 |
parents | ce446666f5a2 |
children | c0d810de7093 |
comparison
equal
deleted
inserted
replaced
252:ba11f2eee658 | 253:cf113c9ff968 |
---|---|
9 * IBM Corporation - initial API and implementation | 9 * IBM Corporation - initial API and implementation |
10 * Port to the D programming language: | 10 * Port to the D programming language: |
11 * Frank Benoit <benoit@tionex.de> | 11 * Frank Benoit <benoit@tionex.de> |
12 *******************************************************************************/ | 12 *******************************************************************************/ |
13 module dwt.custom.CTabFolder; | 13 module dwt.custom.CTabFolder; |
14 | |
15 import tango.util.log.Trace; | |
16 | 14 |
17 import dwt.DWT; | 15 import dwt.DWT; |
18 import dwt.DWTException; | 16 import dwt.DWTException; |
19 import dwt.accessibility.ACC; | 17 import dwt.accessibility.ACC; |
20 import dwt.accessibility.Accessible; | 18 import dwt.accessibility.Accessible; |
1825 } | 1823 } |
1826 e.children = children; | 1824 e.children = children; |
1827 } | 1825 } |
1828 }); | 1826 }); |
1829 | 1827 |
1830 addListener(DWT.Selection, getInst(accessible) ); | 1828 addListener(DWT.Selection, new class(accessible) Listener { |
1829 Accessible acc; | |
1830 this( Accessible a ){ | |
1831 this.acc = a; | |
1832 } | |
1833 public void handleEvent(Event event) { | |
1834 if (isFocusControl()) { | |
1835 if (selectedIndex is -1) { | |
1836 acc.setFocus(ACC.CHILDID_SELF); | |
1837 } else { | |
1838 acc.setFocus(selectedIndex); | |
1839 } | |
1840 } | |
1841 } | |
1842 }); | |
1843 | |
1831 addListener(DWT.FocusIn, new class(accessible) Listener { | 1844 addListener(DWT.FocusIn, new class(accessible) Listener { |
1832 Accessible acc2; | 1845 Accessible acc; |
1833 this( Accessible acc2 ){ this.acc2 = acc2; } | 1846 this( Accessible a ){ this.acc = a; } |
1834 public void handleEvent(Event event) { | 1847 public void handleEvent(Event event) { |
1835 if (this.outer.selectedIndex is -1) { | 1848 if (selectedIndex is -1) { |
1836 acc2.setFocus(ACC.CHILDID_SELF); | 1849 acc.setFocus(ACC.CHILDID_SELF); |
1837 } else { | 1850 } else { |
1838 acc2.setFocus(this.outer.selectedIndex); | 1851 acc.setFocus(selectedIndex); |
1839 } | 1852 } |
1840 } | 1853 } |
1841 }); | 1854 }); |
1842 } | 1855 } |
1843 Listener getInst(Accessible accessible ){ | 1856 |
1844 return new class/+accessible+/ Listener { | |
1845 //Accessible acc; | |
1846 //this( Accessible acc ){ this.acc = acc; } | |
1847 public void handleEvent(Event event) { | |
1848 Trace.formatln( "{} {}", __FILE__, __LINE__ ); | |
1849 Trace.formatln( "{} {} {}", __FILE__, __LINE__, cast(void*)this ); | |
1850 Trace.formatln( "{} {} {}", __FILE__, __LINE__, cast(void*)this.outer ); | |
1851 //auto p = &this.outer.isFocusControl; | |
1852 //Trace.formatln( "{} {} {}", __FILE__, __LINE__, cast(void*)p.ptr ); | |
1853 //Trace.formatln( "{} {} {}", __FILE__, __LINE__, cast(void*)p.funcptr ); | |
1854 test(); | |
1855 Trace.formatln( "{} {}", __FILE__, __LINE__ ); | |
1856 // if (this.outer.isFocusControl()) { | |
1857 // Trace.formatln( "{} {}", __FILE__, __LINE__ ); | |
1858 if (selectedIndex is -1) { | |
1859 // Trace.formatln( "{} {}", __FILE__, __LINE__ ); | |
1860 // acc.setFocus(ACC.CHILDID_SELF); | |
1861 // Trace.formatln( "{} {}", __FILE__, __LINE__ ); | |
1862 // } else { | |
1863 // Trace.formatln( "{} {}", __FILE__, __LINE__ ); | |
1864 // // acc.setFocus(this.outer.selectedIndex); | |
1865 // Trace.formatln( "{} {}", __FILE__, __LINE__ ); | |
1866 // } | |
1867 Trace.formatln( "{} {}", __FILE__, __LINE__ ); | |
1868 } | |
1869 Trace.formatln( "{} {}", __FILE__, __LINE__ ); | |
1870 | |
1871 } | |
1872 }; | |
1873 } | |
1874 void test(){ | |
1875 Trace.formatln( "{} {}", __FILE__, __LINE__ ); | |
1876 } | |
1877 void onKeyDown (Event event) { | 1857 void onKeyDown (Event event) { |
1878 switch (event.keyCode) { | 1858 switch (event.keyCode) { |
1879 case DWT.ARROW_LEFT: | 1859 case DWT.ARROW_LEFT: |
1880 case DWT.ARROW_RIGHT: | 1860 case DWT.ARROW_RIGHT: |
1881 int count = items.length; | 1861 int count = items.length; |
2788 default: | 2768 default: |
2789 } | 2769 } |
2790 topRight.setBounds(topRightRect); | 2770 topRight.setBounds(topRightRect); |
2791 } | 2771 } |
2792 if (oldX !is topRightRect.x || oldWidth !is topRightRect.width || | 2772 if (oldX !is topRightRect.x || oldWidth !is topRightRect.width || |
2793 oldY !is topRightRect.y || oldHeight !is topRightRect.height) { | 2773 oldY !is topRightRect.y || oldHeight !is topRightRect.height) { |
2794 int left = Math.min(oldX, topRightRect.x); | 2774 int left = Math.min(oldX, topRightRect.x); |
2795 int right = Math.max(oldX + oldWidth, topRightRect.x + topRightRect.width); | 2775 int right = Math.max(oldX + oldWidth, topRightRect.x + topRightRect.width); |
2796 int top = onBottom ? size.y - borderBottom - tabHeight : borderTop + 1; | 2776 int top = onBottom ? size.y - borderBottom - tabHeight : borderTop + 1; |
2797 redraw(left, top, right - left, tabHeight, false); | 2777 redraw(left, top, right - left, tabHeight, false); |
2798 } | 2778 } |
3311 } | 3291 } |
3312 } | 3292 } |
3313 showItem(selection); | 3293 showItem(selection); |
3314 redraw(); | 3294 redraw(); |
3315 } | 3295 } |
3316 void setSelection(int index, bool notify) { | 3296 void setSelection(int index, bool notify) { |
3317 int oldSelectedIndex = selectedIndex; | 3297 int oldSelectedIndex = selectedIndex; |
3318 setSelection(index); | 3298 setSelection(index); |
3319 if (notify && selectedIndex !is oldSelectedIndex && selectedIndex !is -1) { | 3299 if (notify && selectedIndex !is oldSelectedIndex && selectedIndex !is -1) { |
3320 Event event = new Event(); | 3300 Event event = new Event(); |
3321 event.item = getItem(selectedIndex); | 3301 event.item = getItem(selectedIndex); |
4024 } | 4004 } |
4025 return changed; | 4005 return changed; |
4026 } | 4006 } |
4027 bool updateTabHeight(bool force){ | 4007 bool updateTabHeight(bool force){ |
4028 int style = getStyle(); | 4008 int style = getStyle(); |
4029 if (fixedTabHeight is 0 && (style & DWT.FLAT) !is 0 && (style & DWT.BORDER) is 0) highlight_header = 0; | 4009 if (fixedTabHeight is 0 && (style & DWT.FLAT) !is 0 && (style & DWT.BORDER) is 0) highlight_header = 0; |
4030 int oldHeight = tabHeight; | 4010 int oldHeight = tabHeight; |
4031 if (fixedTabHeight !is DWT.DEFAULT) { | 4011 if (fixedTabHeight !is DWT.DEFAULT) { |
4032 tabHeight = fixedTabHeight is 0 ? 0 : fixedTabHeight + 1; // +1 for line drawn across top of tab | 4012 tabHeight = fixedTabHeight is 0 ? 0 : fixedTabHeight + 1; // +1 for line drawn across top of tab |
4033 } else { | 4013 } else { |
4034 int tempHeight = 0; | 4014 int tempHeight = 0; |