diff dwt/custom/CTabFolder.d @ 213:36f5cb12e1a2

Update to SWT 3.4M7
author Frank Benoit <benoit@tionex.de>
date Sat, 17 May 2008 17:34:28 +0200
parents ab60f3309436
children fd9c62a2998e
line wrap: on
line diff
--- a/dwt/custom/CTabFolder.d	Mon May 05 00:12:38 2008 +0200
+++ b/dwt/custom/CTabFolder.d	Sat May 17 17:34:28 2008 +0200
@@ -1538,6 +1538,8 @@
     style &= ~(DWT.SINGLE | DWT.MULTI);
     style |= single ? DWT.SINGLE : DWT.MULTI;
     if (borderLeft !is 0) style |= DWT.BORDER;
+    style &= ~DWT.CLOSE;
+    if (showClose) style |= DWT.CLOSE;
     return style;
 }
 /**
@@ -1712,20 +1714,26 @@
 
         public void getLocation(AccessibleControlEvent e) {
             Rectangle location = null;
+            Point pt = null;
             int childID = e.childID;
             if (childID is ACC.CHILDID_SELF) {
                 location = getBounds();
-            } else if (childID >= 0 && childID < items.length) {
-                location = items[childID].getBounds();
-            } else if (showChevron && childID is items.length + CHEVRON_CHILD_ID) {
-                location = chevronRect;
-            } else if (showMin && childID is items.length + MINIMIZE_CHILD_ID) {
-                location = minRect;
-            } else if (showMax && childID is items.length + MAXIMIZE_CHILD_ID) {
-                location = maxRect;
+                pt = getParent().toDisplay(location.x, location.y);
+            } else {
+                if (childID >= 0 && childID < items.length && items[childID].isShowing()) {
+                    location = items[childID].getBounds();
+                } else if (showChevron && childID is items.length + CHEVRON_CHILD_ID) {
+                    location = chevronRect;
+                } else if (showMin && childID is items.length + MINIMIZE_CHILD_ID) {
+                    location = minRect;
+                } else if (showMax && childID is items.length + MAXIMIZE_CHILD_ID) {
+                    location = maxRect;
+                }
+                if (location !is null) {
+                    pt = toDisplay(location.x, location.y);
+                }
             }
-            if (location !is null) {
-                Point pt = toDisplay(location.x, location.y);
+            if (location !is null && pt !is null) {
                 e.x = pt.x;
                 e.y = pt.y;
                 e.width = location.width;
@@ -2217,8 +2225,8 @@
                         CTabFolderListener listener = tabListeners[j];
                         listener.itemClosed(e);
                     }
-                    if (e.doit) {
-                        item.dispose();
+                    if (e.doit) item.dispose();
+                    if (!isDisposed() && item.isDisposed()) {
                         Display display = getDisplay();
                         Point pt = display.getCursorLocation();
                         pt = display.map(null, this, pt.x, pt.y);
@@ -3261,16 +3269,19 @@
     selection.closeImageState = NORMAL;
     selection.showing = false;
 
-    Control control = selection.control;
-    if (control !is null && !control.isDisposed()) {
-        control.setBounds(getClientArea());
-        control.setVisible(true);
+    Control newControl = selection.control;
+    Control oldControl = null;
+    if (oldIndex !is -1) {
+        oldControl = items[oldIndex].control;
     }
 
-    if (oldIndex !is -1) {
-        control = items[oldIndex].control;
-        if (control !is null && !control.isDisposed()) {
-            control.setVisible(false);
+    if (newControl !is oldControl) {
+        if (newControl !is null && !newControl.isDisposed()) {
+            newControl.setBounds(getClientArea());
+            newControl.setVisible(true);
+        }
+        if (oldControl !is null && !oldControl.isDisposed()) {
+            oldControl.setVisible(false);
         }
     }
     showItem(selection);