diff options
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.java | 11 |
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); } |