Package com.iizigo.image
Class SingleImageControl
java.lang.Object
org.eclipse.swt.widgets.Widget
org.eclipse.swt.widgets.Control
org.eclipse.swt.widgets.Scrollable
org.eclipse.swt.widgets.Composite
com.iizigo.image.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
Field Summary
Constructor Summary
ConstructorDescriptionSingleImageControl
(Composite parent, int style, int zoom, AssetReference ref, ILayoutListener layout) Creates the image control with a zoom level.SingleImageControl
(Composite parent, int style, int zoom, AssetReference ref, ILayoutListener layout, Rectangle rect) Creates the image control with a zoom level.SingleImageControl
(Composite parent, int style, ImageInfo imageInfo, Rectangle rect) Creates the image control from a file with zoom 1.SingleImageControl
(Composite parent, int style, IFile file, Rectangle rect) Creates the image control from a file with zoom 1.Method Summary
Modifier and TypeMethodDescriptioncomputeSize
(int wHint, int hHint, boolean changed) Computes the size.void
Called to inform that new data is available in the instance of ImageInfo.void
Paints the canvas foreground.void
scaleToMax
(int mcx, int mcy) Scales down the image to a maximum size.void
setZoom
(double zoom) Sets the zoom level (1-10).void
Widget is disposed.Methods inherited from class org.eclipse.swt.widgets.Composite
changed, checkSubclass, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, redraw, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList, toString
Methods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar
Methods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getRegion, getShell, getSize, getTextDirection, getToolTipText, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, requestLayout, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setToolTipText, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.eclipse.swt.graphics.Drawable
isAutoScalable
Constructor Details
SingleImageControl
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
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
Called to inform that new data is available in the instance of ImageInfo.- Specified by:
onChanged
in interfaceIImageInfoChanged
setZoom
public void setZoom(double zoom) Sets the zoom level (1-10).- Specified by:
setZoom
in interfaceIZoomCapable
scaleToMax
public void scaleToMax(int mcx, int mcy) Scales down the image to a maximum size. An appropriate zoom factor is calculated.widgetDisposed
Widget is disposed.- Specified by:
widgetDisposed
in interfaceDisposeListener
computeSize
Computes the size.- Overrides:
computeSize
in classComposite
paintControl
Paints the canvas foreground.- Specified by:
paintControl
in interfacePaintListener