changeset 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 ba11f2eee658
children 8bca790583c3
files dwt/custom/CTabFolder.d
diffstat 1 files changed, 25 insertions(+), 45 deletions(-) [+]
line wrap: on
line diff
--- a/dwt/custom/CTabFolder.d	Sun Jun 08 03:18:53 2008 +0200
+++ b/dwt/custom/CTabFolder.d	Sun Jun 08 03:19:38 2008 +0200
@@ -12,8 +12,6 @@
  *******************************************************************************/
 module dwt.custom.CTabFolder;
 
-import tango.util.log.Trace;
-
 import dwt.DWT;
 import dwt.DWTException;
 import dwt.accessibility.ACC;
@@ -1827,53 +1825,35 @@
         }
     });
 
-addListener(DWT.Selection, getInst(accessible) );
-    addListener(DWT.FocusIn, new class(accessible) Listener {
-        Accessible acc2;
-        this( Accessible acc2 ){ this.acc2 = acc2; }
+    addListener(DWT.Selection, new class(accessible) Listener {
+        Accessible acc;
+        this( Accessible a ){
+            this.acc = a;
+        }
         public void handleEvent(Event event) {
-            if (this.outer.selectedIndex is -1) {
-                acc2.setFocus(ACC.CHILDID_SELF);
+            if (isFocusControl()) {
+                if (selectedIndex is -1) {
+                    acc.setFocus(ACC.CHILDID_SELF);
+                } else {
+                    acc.setFocus(selectedIndex);
+                }
+            }
+        }
+    });
+
+    addListener(DWT.FocusIn, new class(accessible) Listener {
+        Accessible acc;
+        this( Accessible a ){ this.acc = a; }
+        public void handleEvent(Event event) {
+            if (selectedIndex is -1) {
+                acc.setFocus(ACC.CHILDID_SELF);
             } else {
-                acc2.setFocus(this.outer.selectedIndex);
+                acc.setFocus(selectedIndex);
             }
         }
     });
 }
-Listener getInst(Accessible accessible ){
-    return new class/+accessible+/ Listener {
-        //Accessible acc;
-        //this( Accessible acc ){ this.acc = acc; }
-        public void handleEvent(Event event) {
-        Trace.formatln( "{} {}", __FILE__, __LINE__ );
-        Trace.formatln( "{} {} {}", __FILE__, __LINE__, cast(void*)this );
-        Trace.formatln( "{} {} {}", __FILE__, __LINE__, cast(void*)this.outer );
-        //auto p = &this.outer.isFocusControl;
-        //Trace.formatln( "{} {} {}", __FILE__, __LINE__, cast(void*)p.ptr );
-        //Trace.formatln( "{} {} {}", __FILE__, __LINE__, cast(void*)p.funcptr );
-        test();
-        Trace.formatln( "{} {}", __FILE__, __LINE__ );
-//             if (this.outer.isFocusControl()) {
-//         Trace.formatln( "{} {}", __FILE__, __LINE__ );
-                if (selectedIndex is -1) {
-//         Trace.formatln( "{} {}", __FILE__, __LINE__ );
-        //            acc.setFocus(ACC.CHILDID_SELF);
-//         Trace.formatln( "{} {}", __FILE__, __LINE__ );
-//                 } else {
-//         Trace.formatln( "{} {}", __FILE__, __LINE__ );
-//         //            acc.setFocus(this.outer.selectedIndex);
-//         Trace.formatln( "{} {}", __FILE__, __LINE__ );
-//                 }
-        Trace.formatln( "{} {}", __FILE__, __LINE__ );
-            }
-        Trace.formatln( "{} {}", __FILE__, __LINE__ );
 
-        }
-    };
-}
-void test(){
-        Trace.formatln( "{} {}", __FILE__, __LINE__ );
-}
 void onKeyDown (Event event) {
     switch (event.keyCode) {
         case DWT.ARROW_LEFT:
@@ -2790,7 +2770,7 @@
         topRight.setBounds(topRightRect);
     }
     if (oldX !is topRightRect.x || oldWidth !is topRightRect.width ||
-        oldY !is topRightRect.y || oldHeight !is topRightRect.height) { 
+        oldY !is topRightRect.y || oldHeight !is topRightRect.height) {
         int left = Math.min(oldX, topRightRect.x);
         int right = Math.max(oldX + oldWidth, topRightRect.x + topRightRect.width);
         int top = onBottom ? size.y - borderBottom - tabHeight : borderTop + 1;
@@ -3313,7 +3293,7 @@
     showItem(selection);
     redraw();
 }
-void setSelection(int index, bool notify) { 
+void setSelection(int index, bool notify) {
     int oldSelectedIndex = selectedIndex;
     setSelection(index);
     if (notify && selectedIndex !is oldSelectedIndex && selectedIndex !is -1) {
@@ -4026,7 +4006,7 @@
 }
 bool updateTabHeight(bool force){
     int style = getStyle();
-    if (fixedTabHeight is 0 && (style & DWT.FLAT) !is 0 && (style & DWT.BORDER) is 0) highlight_header = 0;     
+    if (fixedTabHeight is 0 && (style & DWT.FLAT) !is 0 && (style & DWT.BORDER) is 0) highlight_header = 0;
     int oldHeight = tabHeight;
     if (fixedTabHeight !is DWT.DEFAULT) {
         tabHeight = fixedTabHeight is 0 ? 0 : fixedTabHeight + 1; // +1 for line drawn across top of tab