FileDocCategorySizeDatePackage
SWTSkinObjectImageContainer.javaAPI DocAzureus 3.0.3.44217Thu Mar 01 23:47:30 GMT 2007com.aelitis.azureus.ui.swt.skin

SWTSkinObjectImageContainer

public class SWTSkinObjectImageContainer extends SWTSkinObjectContainer
This class does not work. Do not use it
author
TuxPaper
created
Jun 12, 2006

Fields Summary
org.eclipse.swt.widgets.Composite
composite
private static org.eclipse.swt.events.PaintListener
tilePaintListener
Constructors Summary
public SWTSkinObjectImageContainer(SWTSkin skin, SWTSkinProperties skinProperties, String sID, String sConfigID, SWTSkinObject parent)

param
skin

		tilePaintListener = new PaintListener() {
			public void paintControl(PaintEvent e) {
				System.out.println("moo");
				Composite c = (Composite) e.widget;
				Image imgSrc = (Image) c.getData("image");
				if (imgSrc == null) {
					return;
				}
				Rectangle imgSrcBounds = imgSrc.getBounds();
				Point size = c.getSize();

				int x0 = 0;
				int y0 = 0;
				int x1 = size.x;
				int y1 = size.y;

				Image imgRight = (Image) c.getData("image-right");
				if (imgRight != null) {
					int width = imgRight.getBounds().width;

					x1 -= width;
				}

				Image imgLeft = (Image) c.getData("image-left");
				if (imgLeft != null) {
					// TODO: Tile down
					e.gc.drawImage(imgLeft, 0, 0);

					x0 += imgLeft.getBounds().width;
				}

				for (int y = y0; y < y1; y += imgSrcBounds.height) {
					for (int x = x0; x < x1; x += imgSrcBounds.width) {
						e.gc.drawImage(imgSrc, x, y);
					}
				}

				if (imgRight != null) {
					// TODO: Tile down
					e.gc.drawImage(imgRight, x1, 0);
				}
			}
		};
	
		super(skin, skinProperties, sID, sConfigID, parent);

		composite = (Composite) getControl();
		setLabelImage(sConfigID, sConfigID + ".image");
	
Methods Summary
protected org.eclipse.swt.graphics.ImagesetLabelImage(java.lang.String sConfigID)

		return setLabelImage(sConfigID, sConfigID);
	
private org.eclipse.swt.graphics.ImagesetLabelImage(java.lang.String sConfigID, java.lang.String sImageID)

		if (composite == null || composite.isDisposed()) {
			return null;
		}

		ImageLoader imageLoader = skin.getImageLoader(properties);
		Image image = imageLoader.getImage(sImageID);

		Image imageLeft = imageLoader.getImage(sImageID + ".left");
		if (ImageLoader.isRealImage(imageLeft)) {
			composite.setData("image-left", imageLeft);
		}
		Image imageRight = imageLoader.getImage(sImageID + ".right");
		if (ImageLoader.isRealImage(imageRight)) {
			composite.setData("image-right", imageRight);
		}

		String sDrawMode = properties.getStringValue(sImageID + ".drawmode");
		if (sDrawMode == null) {
			sDrawMode = "";
		}

		System.out.println("Hello");
		if (sDrawMode.equalsIgnoreCase("tile")) {
			Rectangle imgBounds = image.getBounds();
			composite.setSize(imgBounds.width, imgBounds.height);
			composite.setData("image", image);

			// XXX Huh? A tile of one? :)
			composite.setLayoutData(new FormData(imgBounds.width, imgBounds.height));

			// remove in case already added
			composite.removePaintListener(tilePaintListener);

			composite.addPaintListener(tilePaintListener);
		} else {
			//composite.setImage(image);
			composite.setData("ImageID", sImageID);
		}

		SWTSkinUtils.addMouseImageChangeListeners(composite);
		return image;