summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java
diff options
context:
space:
mode:
authorFelipe Heidrich <fheidric>2005-04-29 21:10:25 +0000
committerFelipe Heidrich <fheidric>2005-04-29 21:10:25 +0000
commit5236a124cc38f3baca05186b49e2911dfbd4ad27 (patch)
treee7f0c67552f57f3d1579a0fbe17d93a618868d40 /bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java
parent93fc2f9583c0679730fc2c5e8b77194a0019d64d (diff)
downloadeclipse.platform.swt-5236a124cc38f3baca05186b49e2911dfbd4ad27.tar.gz
eclipse.platform.swt-5236a124cc38f3baca05186b49e2911dfbd4ad27.tar.xz
eclipse.platform.swt-5236a124cc38f3baca05186b49e2911dfbd4ad27.zip
35040
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java
index c50ed1f7e4..d0005a6016 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java
@@ -40,6 +40,7 @@ import org.eclipse.swt.graphics.*;
*/
public class Label extends Control {
int /*long*/ frameHandle, labelHandle, imageHandle;
+ ImageList imageList;
Image image;
String text;
@@ -313,6 +314,8 @@ void releaseHandle () {
void releaseWidget () {
super.releaseWidget ();
+ if (imageList != null) imageList.dispose ();
+ imageList = null;
image = null;
text = null;
}
@@ -450,11 +453,15 @@ public void setImage (Image image) {
if ((style & SWT.SEPARATOR) != 0) return;
this.image = image;
if (image != null) {
- OS.gtk_image_set_from_pixmap (imageHandle, image.pixmap, image.mask);
+ if (imageList == null) imageList = 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_hide (labelHandle);
OS.gtk_widget_show (imageHandle);
} else {
- OS.gtk_image_set_from_pixmap (imageHandle, 0, 0);
+ OS.gtk_image_set_from_pixbuf (imageHandle, 0);
OS.gtk_widget_show (labelHandle);
OS.gtk_widget_hide (imageHandle);
}