diff options
author | Bogdan Gheorghe <gheorghe> | 2010-04-27 22:34:03 +0000 |
---|---|---|
committer | Bogdan Gheorghe <gheorghe> | 2010-04-27 22:34:03 +0000 |
commit | 8bc31837bf1118e0f6900791d0a755114af85b3e (patch) | |
tree | b03e7098c626df2d85b939559febef77dd25b4c6 /bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.java | |
parent | 487b46b6d3c8e3fef6ae57b4a33a6c8bb9b541f0 (diff) | |
download | eclipse.platform.swt-8bc31837bf1118e0f6900791d0a755114af85b3e.tar.gz eclipse.platform.swt-8bc31837bf1118e0f6900791d0a755114af85b3e.tar.xz eclipse.platform.swt-8bc31837bf1118e0f6900791d0a755114af85b3e.zip |
Fix hot state in CTabItem
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.java')
-rwxr-xr-x | bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.java | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.java index 74f29c46bc..4f1fb850bb 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.java @@ -1360,6 +1360,10 @@ void onMouse(Event event) { item.closeImageState = SWT.BACKGROUND; redraw(item.closeRect.x, item.closeRect.y, item.closeRect.width, item.closeRect.height, false); } + if ((item.state & SWT.HOT) != 0) { + item.state &= ~SWT.HOT; + redraw(item.x, item.y, item.width, item.height, false); + } if (i == selectedIndex && item.closeImageState != SWT.NONE) { item.closeImageState = SWT.NONE; redraw(item.closeRect.x, item.closeRect.y, item.closeRect.width, item.closeRect.height, false); @@ -1479,11 +1483,19 @@ void onMouse(Event event) { redraw(item.closeRect.x, item.closeRect.y, item.closeRect.width, item.closeRect.height, false); } } - } + if ((item.state & SWT.HOT) == 0) { + item.state |= SWT.HOT; + redraw(item.x, item.y, item.width, item.height, false); + } + } if (i != selectedIndex && item.closeImageState != SWT.BACKGROUND && !close) { item.closeImageState = SWT.BACKGROUND; redraw(item.closeRect.x, item.closeRect.y, item.closeRect.width, item.closeRect.height, false); } + if ((item.state & SWT.HOT) != 0 && !close) { + item.state &= ~SWT.HOT; + redraw(item.x, item.y, item.width, item.height, false); + } if (i == selectedIndex && item.closeImageState != SWT.NONE && !close) { item.closeImageState = SWT.NONE; redraw(item.closeRect.x, item.closeRect.y, item.closeRect.width, item.closeRect.height, false); @@ -1694,7 +1706,7 @@ void onPaint(Event event) { for (int i=0; i < items.length; i++) { Rectangle itemBounds = items[i].getBounds(); if (i != selectedIndex && event.getBounds().intersects(itemBounds)) { - renderer.draw(i, SWT.BACKGROUND | SWT.FOREGROUND, itemBounds, gc); + renderer.draw(i, SWT.BACKGROUND | SWT.FOREGROUND | items[i].state , itemBounds, gc); } } } @@ -1704,7 +1716,7 @@ void onPaint(Event event) { gc.setBackground(gcBackground); if (selectedIndex != -1) { - renderer.draw(selectedIndex, SWT.SELECTED | SWT.BACKGROUND | SWT.FOREGROUND, items[selectedIndex].getBounds(), gc); + renderer.draw(selectedIndex, items[selectedIndex].state | SWT.BACKGROUND | SWT.FOREGROUND, items[selectedIndex].getBounds(), gc); } gc.setFont(gcFont); @@ -2691,9 +2703,11 @@ public void setSelection(int index) { selectedIndex = index; if (oldIndex != -1) { items[oldIndex].closeImageState = SWT.BACKGROUND; + items[oldIndex].state &= ~SWT.SELECTED; } selection.closeImageState = SWT.NONE; selection.showing = false; + selection.state |= SWT.SELECTED; Control newControl = selection.control; Control oldControl = null; |