Class SingleImageControl

All Implemented Interfaces:
IImageInfoChanged, IZoomCapable, EventListener, DisposeListener, PaintListener, Drawable, SWTEventListener

public class SingleImageControl extends Composite implements DisposeListener, IImageInfoChanged, PaintListener, IZoomCapable
The image control that can show the zoom level.
Author:
Christopher Mindus
  • Constructor Details

    • SingleImageControl

      public SingleImageControl(Composite parent, int style, IFile file, Rectangle rect)
      Creates the image control from a file with zoom 1.
      Parameters:
      parent - Parent composite.
      style - The control style SWT.*.
      file - File.
      rect - Partial rectangle when not null.
    • SingleImageControl

      public SingleImageControl(Composite parent, int style, ImageInfo imageInfo, Rectangle rect)
      Creates the image control from a file with zoom 1.
      Parameters:
      parent - Parent composite.
      style - The control style SWT.*.
      imageInfo - ImageInfo for image, will be released when control is disposed of.
      rect - Partial rectangle when not null.
    • SingleImageControl

      public SingleImageControl(Composite parent, int style, int zoom, AssetReference ref, ILayoutListener layout)
      Creates the image control with a zoom level.
    • SingleImageControl

      public SingleImageControl(Composite parent, int style, int zoom, AssetReference ref, ILayoutListener layout, Rectangle rect)
      Creates the image control with a zoom level.
  • Method Details

    • onChanged

      public void onChanged(ImageInfo info)
      Called to inform that new data is available in the instance of ImageInfo.
      Specified by:
      onChanged in interface IImageInfoChanged
    • setZoom

      public void setZoom(double zoom)
      Sets the zoom level (1-10).
      Specified by:
      setZoom in interface IZoomCapable
    • scaleToMax

      public void scaleToMax(int mcx, int mcy)
      Scales down the image to a maximum size. An appropriate zoom factor is calculated.
    • widgetDisposed

      public void widgetDisposed(DisposeEvent e)
      Widget is disposed.
      Specified by:
      widgetDisposed in interface DisposeListener
    • computeSize

      public Point computeSize(int wHint, int hHint, boolean changed)
      Computes the size.
      Overrides:
      computeSize in class Composite
    • paintControl

      public void paintControl(PaintEvent e)
      Paints the canvas foreground.
      Specified by:
      paintControl in interface PaintListener