summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TrayItem.java
diff options
context:
space:
mode:
authorChristophe Cornu <ccornu>2005-01-24 16:16:17 +0000
committerChristophe Cornu <ccornu>2005-01-24 16:16:17 +0000
commit8095451e5a3eb9578042eba89f645dd3fab6c2ed (patch)
treed1cd99a49aa9d0939a36c0decffd73c4b933ecc9 /bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TrayItem.java
parent495d422cee1b91fe40d8a983e5ee012d7256e691 (diff)
downloadeclipse.platform.swt-8095451e5a3eb9578042eba89f645dd3fab6c2ed.tar.gz
eclipse.platform.swt-8095451e5a3eb9578042eba89f645dd3fab6c2ed.tar.xz
eclipse.platform.swt-8095451e5a3eb9578042eba89f645dd3fab6c2ed.zip
83543 alpha
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TrayItem.java')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TrayItem.java13
1 files changed, 11 insertions, 2 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TrayItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TrayItem.java
index f9d7bd1567..f5e53deaec 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TrayItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TrayItem.java
@@ -37,6 +37,7 @@ public class TrayItem extends Item {
String toolTipText;
int /*long*/ imageHandle;
int /*long*/ tooltipsHandle;
+ ImageList imageList;
/**
* Constructs a new instance of this class given its parent
@@ -215,6 +216,10 @@ void releaseWidget () {
super.releaseWidget ();
if (tooltipsHandle != 0) OS.g_object_unref (tooltipsHandle);
imageHandle = tooltipsHandle = 0;
+ if (imageList != null) {
+ imageList.dispose ();
+ imageList = null;
+ }
toolTipText = null;
if (handle != 0) OS.gtk_widget_destroy (handle);
handle = 0;
@@ -265,11 +270,15 @@ public void setImage (Image image) {
if (image != null) {
Rectangle rect = image.getBounds ();
OS.gtk_widget_set_size_request (handle, rect.width, rect.height);
- OS.gtk_image_set_from_pixmap (imageHandle, image.pixmap, image.mask);
+ if (imageList == null) imageList = new ImageList ();
+ int imageIndex = imageList.indexOf (image);
+ if (imageIndex == -1) imageIndex = imageList.add (image);
+ int /*long*/ pixbuf = imageList.getPixbuf (imageIndex);
+ OS.gtk_image_set_from_pixbuf (imageHandle, pixbuf);
OS.gtk_widget_show (imageHandle);
} else {
OS.gtk_widget_set_size_request (handle, 1, 1);
- OS.gtk_image_set_from_pixmap (imageHandle, 0, 0);
+ OS.gtk_image_set_from_pixbuf (imageHandle, 0);
OS.gtk_widget_hide (imageHandle);
}
}