/******************************************************************************* * Copyright (c) 2000, 2005 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.swt.widgets; import org.eclipse.swt.internal.gtk.*; import org.eclipse.swt.graphics.*; class ImageList { int /*long*/ [] pixbufs; int width = -1, height = -1; Image [] images; public ImageList() { images = new Image [4]; pixbufs = new int /*long*/ [4]; } public int add (Image image) { int index = 0; while (index < images.length) { if (images [index] != null) { if (images [index].isDisposed ()) { OS.g_object_unref (pixbufs [index]); images [index] = null; pixbufs [index] = 0; } } if (images [index] == null) break; index++; } if (index == images.length) { Image [] newImages = new Image [images.length + 4]; System.arraycopy (images, 0, newImages, 0, images.length); images = newImages; int /*long*/ [] newPixbufs = new int /*long*/ [pixbufs.length + 4]; System.arraycopy (pixbufs, 0, newPixbufs, 0, pixbufs.length); pixbufs = newPixbufs; } set (index, image); return index; } public void dispose () { if (pixbufs == null) return; for (int index=0; index