summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt/Eclipse SWT/win32/org
diff options
context:
space:
mode:
authorSteve Northover <steve>2006-04-07 17:44:22 +0000
committerSteve Northover <steve>2006-04-07 17:44:22 +0000
commit40f1c5f7d31e08753ce42641a6aa8235fd0a0a50 (patch)
tree88ebdc32dfe745d1678428e71e574318b15c91cf /bundles/org.eclipse.swt/Eclipse SWT/win32/org
parent842af3804926d31ad2f49f4ce7faac1998bf8575 (diff)
downloadeclipse.platform.swt-40f1c5f7d31e08753ce42641a6aa8235fd0a0a50.tar.gz
eclipse.platform.swt-40f1c5f7d31e08753ce42641a6aa8235fd0a0a50.tar.xz
eclipse.platform.swt-40f1c5f7d31e08753ce42641a6aa8235fd0a0a50.zip
82769 - [Contributions] Disabled menu items have enabled images when armed
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/win32/org')
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Label.java7
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/MenuItem.java2
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolItem.java37
3 files changed, 7 insertions, 39 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Label.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Label.java
index 5b2b05bb29..a4513a2689 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Label.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Label.java
@@ -587,9 +587,9 @@ LRESULT wmDrawChild (int wParam, int lParam) {
GCData data = new GCData();
data.device = display;
GC gc = GC.win32_new (struct.hDC, data);
- Image drawnImage = getEnabled () ? image : new Image (display, image, SWT.IMAGE_DISABLE);
- gc.drawImage (drawnImage, x, Math.max (0, (height - imageHeight) / 2));
- if (drawnImage != image) drawnImage.dispose ();
+ Image image = getEnabled () ? this.image : new Image (display, this.image, SWT.IMAGE_DISABLE);
+ gc.drawImage (image, x, Math.max (0, (height - imageHeight) / 2));
+ if (image != this.image) image.dispose ();
gc.dispose ();
x += imageWidth + margin;
}
@@ -602,7 +602,6 @@ LRESULT wmDrawChild (int wParam, int lParam) {
OS.DrawText (struct.hDC, buffer, -1, rect, flags);
}
}
-
}
return null;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/MenuItem.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/MenuItem.java
index c893201d59..3edc5f0ce4 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/MenuItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/MenuItem.java
@@ -1088,7 +1088,9 @@ LRESULT wmDrawChild (int wParam, int lParam) {
* the item is in a menu bar.
*/
int x = (parent.style & SWT.BAR) != 0 ? MARGIN_WIDTH * 2 : struct.left;
+ Image image = getEnabled () ? this.image : new Image (display, this.image, SWT.IMAGE_DISABLE);
gc.drawImage (image, x, struct.top + MARGIN_HEIGHT);
+ if (this.image != image) image.dispose ();
gc.dispose ();
}
return null;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolItem.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolItem.java
index e88c8b77c9..0dc45535bd 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolItem.java
@@ -190,37 +190,6 @@ void click (boolean dropDown) {
}
}
-Image createDisabledImage (Image image, Color color) {
- /*
- * In order to be consistent with the way that disabled
- * images appear in other places in the user interface,
- * use the SWT Graphics to create a disabled image instead
- * of calling DrawState().
- */
- return new Image (display, image, SWT.IMAGE_DISABLE);
- /*
- * This code is intentionally commented.
- */
-// if (OS.IsWinCE) {
-// return new Image (display, image, SWT.IMAGE_DISABLE);
-// }
-// Rectangle rect = image.getBounds ();
-// Image disabled = new Image (display, rect);
-// GC gc = new GC (disabled);
-// gc.setBackground (color);
-// gc.fillRectangle (rect);
-// int hDC = gc.handle;
-// int hImage = image.handle;
-// int fuFlags = OS.DSS_DISABLED;
-// switch (image.type) {
-// case SWT.BITMAP: fuFlags |= OS.DST_BITMAP; break;
-// case SWT.ICON: fuFlags |= OS.DST_ICON; break;
-// }
-// OS.DrawState (hDC, 0, 0, hImage, 0, 0, 0, rect.width, rect.height, fuFlags);
-// gc.dispose ();
-// return disabled;
-}
-
void destroyWidget () {
parent.destroyItem (this);
releaseHandle ();
@@ -889,8 +858,7 @@ void updateImages (boolean enabled) {
disabledImage2 = null;
disabled = image;
if (!enabled) {
- Color color = parent.getBackground ();
- disabled = disabledImage2 = createDisabledImage (image, color);
+ disabled = disabledImage2 = new Image (display, image, SWT.IMAGE_DISABLE);
}
}
/*
@@ -920,8 +888,7 @@ void updateImages (boolean enabled) {
if (disabledImage == null) {
disabled = image;
if (!enabled) {
- Color color = parent.getBackground ();
- disabled = disabledImage2 = createDisabledImage (image, color);
+ disabled = disabledImage2 = new Image (display, image, SWT.IMAGE_DISABLE);
}
}
}