comparison 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
comparison
equal deleted inserted replaced
212:ab60f3309436 213:36f5cb12e1a2
1536 style &= ~(DWT.TOP | DWT.BOTTOM); 1536 style &= ~(DWT.TOP | DWT.BOTTOM);
1537 style |= onBottom ? DWT.BOTTOM : DWT.TOP; 1537 style |= onBottom ? DWT.BOTTOM : DWT.TOP;
1538 style &= ~(DWT.SINGLE | DWT.MULTI); 1538 style &= ~(DWT.SINGLE | DWT.MULTI);
1539 style |= single ? DWT.SINGLE : DWT.MULTI; 1539 style |= single ? DWT.SINGLE : DWT.MULTI;
1540 if (borderLeft !is 0) style |= DWT.BORDER; 1540 if (borderLeft !is 0) style |= DWT.BORDER;
1541 style &= ~DWT.CLOSE;
1542 if (showClose) style |= DWT.CLOSE;
1541 return style; 1543 return style;
1542 } 1544 }
1543 /** 1545 /**
1544 * Returns the height of the tab 1546 * Returns the height of the tab
1545 * 1547 *
1710 e.childID = childID; 1712 e.childID = childID;
1711 } 1713 }
1712 1714
1713 public void getLocation(AccessibleControlEvent e) { 1715 public void getLocation(AccessibleControlEvent e) {
1714 Rectangle location = null; 1716 Rectangle location = null;
1717 Point pt = null;
1715 int childID = e.childID; 1718 int childID = e.childID;
1716 if (childID is ACC.CHILDID_SELF) { 1719 if (childID is ACC.CHILDID_SELF) {
1717 location = getBounds(); 1720 location = getBounds();
1718 } else if (childID >= 0 && childID < items.length) { 1721 pt = getParent().toDisplay(location.x, location.y);
1719 location = items[childID].getBounds(); 1722 } else {
1720 } else if (showChevron && childID is items.length + CHEVRON_CHILD_ID) { 1723 if (childID >= 0 && childID < items.length && items[childID].isShowing()) {
1721 location = chevronRect; 1724 location = items[childID].getBounds();
1722 } else if (showMin && childID is items.length + MINIMIZE_CHILD_ID) { 1725 } else if (showChevron && childID is items.length + CHEVRON_CHILD_ID) {
1723 location = minRect; 1726 location = chevronRect;
1724 } else if (showMax && childID is items.length + MAXIMIZE_CHILD_ID) { 1727 } else if (showMin && childID is items.length + MINIMIZE_CHILD_ID) {
1725 location = maxRect; 1728 location = minRect;
1726 } 1729 } else if (showMax && childID is items.length + MAXIMIZE_CHILD_ID) {
1727 if (location !is null) { 1730 location = maxRect;
1728 Point pt = toDisplay(location.x, location.y); 1731 }
1732 if (location !is null) {
1733 pt = toDisplay(location.x, location.y);
1734 }
1735 }
1736 if (location !is null && pt !is null) {
1729 e.x = pt.x; 1737 e.x = pt.x;
1730 e.y = pt.y; 1738 e.y = pt.y;
1731 e.width = location.width; 1739 e.width = location.width;
1732 e.height = location.height; 1740 e.height = location.height;
1733 } 1741 }
2215 } 2223 }
2216 for (int j = 0; j < tabListeners.length; j++) { 2224 for (int j = 0; j < tabListeners.length; j++) {
2217 CTabFolderListener listener = tabListeners[j]; 2225 CTabFolderListener listener = tabListeners[j];
2218 listener.itemClosed(e); 2226 listener.itemClosed(e);
2219 } 2227 }
2220 if (e.doit) { 2228 if (e.doit) item.dispose();
2221 item.dispose(); 2229 if (!isDisposed() && item.isDisposed()) {
2222 Display display = getDisplay(); 2230 Display display = getDisplay();
2223 Point pt = display.getCursorLocation(); 2231 Point pt = display.getCursorLocation();
2224 pt = display.map(null, this, pt.x, pt.y); 2232 pt = display.map(null, this, pt.x, pt.y);
2225 CTabItem nextItem = getItem(pt); 2233 CTabItem nextItem = getItem(pt);
2226 if (nextItem !is null) { 2234 if (nextItem !is null) {
3259 items[oldIndex].closeImageState = NONE; 3267 items[oldIndex].closeImageState = NONE;
3260 } 3268 }
3261 selection.closeImageState = NORMAL; 3269 selection.closeImageState = NORMAL;
3262 selection.showing = false; 3270 selection.showing = false;
3263 3271
3264 Control control = selection.control; 3272 Control newControl = selection.control;
3265 if (control !is null && !control.isDisposed()) { 3273 Control oldControl = null;
3266 control.setBounds(getClientArea());
3267 control.setVisible(true);
3268 }
3269
3270 if (oldIndex !is -1) { 3274 if (oldIndex !is -1) {
3271 control = items[oldIndex].control; 3275 oldControl = items[oldIndex].control;
3272 if (control !is null && !control.isDisposed()) { 3276 }
3273 control.setVisible(false); 3277
3278 if (newControl !is oldControl) {
3279 if (newControl !is null && !newControl.isDisposed()) {
3280 newControl.setBounds(getClientArea());
3281 newControl.setVisible(true);
3282 }
3283 if (oldControl !is null && !oldControl.isDisposed()) {
3284 oldControl.setVisible(false);
3274 } 3285 }
3275 } 3286 }
3276 showItem(selection); 3287 showItem(selection);
3277 redraw(); 3288 redraw();
3278 } 3289 }