public class FigureCanvas extends Canvas
Figures
viewed through a
Viewport
. Call setContents(IFigure)
to specify the root of
the tree of Figures to be viewed through the Viewport.
Normal procedure for using a FigureCanvas:
setContents(IFigure)
. This
Figure will be the top-level Figure of the Draw2d application.
Note: Only one of the styles RIGHT_TO_LEFT, LEFT_TO_RIGHT may be specified.
Modifier and Type | Field and Description |
---|---|
static int |
ALWAYS
Always show scrollbar
|
static int |
AUTOMATIC
Automatically show scrollbar when needed
|
static int |
NEVER
Never show scrollbar
|
Constructor and Description |
---|
FigureCanvas(Composite parent)
Creates a new FigureCanvas with the given parent and the
DEFAULT_STYLES . |
FigureCanvas(Composite parent,
int style)
Constructor which applies the default styles plus any optional styles
indicated.
|
FigureCanvas(Composite parent,
int style,
LightweightSystem lws)
Constructor
|
FigureCanvas(Composite parent,
LightweightSystem lws)
Constructs a new FigureCanvas with the given parent and
LightweightSystem, using the
DEFAULT_STYLES . |
FigureCanvas(int style,
Composite parent)
Constructor which uses the given styles verbatim.
|
FigureCanvas(int style,
Composite parent,
LightweightSystem lws)
Constructor taking a lightweight system and SWT style, which is used
verbatim.
|
Modifier and Type | Method and Description |
---|---|
Point |
computeSize(int wHint,
int hHint,
boolean changed) |
IFigure |
getContents() |
Font |
getFont() |
int |
getHorizontalScrollBarVisibility() |
LightweightSystem |
getLightweightSystem() |
int |
getVerticalScrollBarVisibility() |
Viewport |
getViewport()
Returns the Viewport.
|
void |
scrollSmoothTo(int x,
int y)
Scrolls in an animated way to the new x and y location.
|
void |
scrollTo(int x,
int y)
Scrolls the contents to the new x and y location.
|
void |
scrollToX(int hOffset)
Scrolls the contents horizontally so that they are offset by
hOffset . |
void |
scrollToY(int vOffset)
Scrolls the contents vertically so that they are offset by
vOffset . |
void |
setBorder(Border border)
Sets the given border on the LightweightSystem's root figure.
|
void |
setContents(IFigure figure)
Sets the contents of the
Viewport . |
void |
setFont(Font font) |
void |
setHorizontalScrollBarVisibility(int v)
Sets the horizontal scrollbar visibility.
|
void |
setScrollBarVisibility(int both)
Sets both the horizontal and vertical scrollbar visibility to the given
value.
|
void |
setVerticalScrollBarVisibility(int v)
Sets the vertical scrollbar visibility.
|
void |
setViewport(Viewport vp)
Sets the Viewport.
|
drawBackground, getCaret, getIME, scroll, setCaret, setIME
changed, checkSubclass, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList
computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar
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, 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, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setForeground, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setToolTipText, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData, toString
public static int NEVER
public static int AUTOMATIC
public static int ALWAYS
public FigureCanvas(Composite parent)
DEFAULT_STYLES
.parent
- the parentpublic FigureCanvas(Composite parent, int style)
parent
- the parent compositestyle
- see the class javadoc for optional stylespublic FigureCanvas(int style, Composite parent)
style
- see the class javadoc for required and optional stylesparent
- the parent compositepublic FigureCanvas(Composite parent, LightweightSystem lws)
DEFAULT_STYLES
.parent
- the parentlws
- the LightweightSystempublic FigureCanvas(int style, Composite parent, LightweightSystem lws)
style
- see the class javadoc for required and optional stylesparent
- the parent compositelws
- the LightweightSystempublic FigureCanvas(Composite parent, int style, LightweightSystem lws)
parent
- the parent compositestyle
- look at class javadoc for valid styleslws
- the lightweight systempublic Point computeSize(int wHint, int hHint, boolean changed)
computeSize
in class Composite
Composite.computeSize(int, int, boolean)
public Font getFont()
getFont
in class Control
Control.getFont()
public int getHorizontalScrollBarVisibility()
public LightweightSystem getLightweightSystem()
public int getVerticalScrollBarVisibility()
public Viewport getViewport()
null
, a new one is created.public void scrollSmoothTo(int x, int y)
x
- the x coordinate to scroll toy
- the y coordinate to scroll topublic void scrollTo(int x, int y)
scrollToY(int)
or scrollToX(int)
,
respectively, to increase performance.x
- the x coordinate to scroll toy
- the y coordinate to scroll topublic void scrollToX(int hOffset)
hOffset
.hOffset
- the new horizontal offsetpublic void scrollToY(int vOffset)
vOffset
.vOffset
- the new vertical offsetpublic void setBorder(Border border)
border
- The new borderpublic void setContents(IFigure figure)
Viewport
.figure
- the new contentspublic void setFont(Font font)
setFont
in class Canvas
Control.setFont(org.eclipse.swt.graphics.Font)
public void setHorizontalScrollBarVisibility(int v)
v
- the new visibilitypublic void setScrollBarVisibility(int both)
AUTOMATIC
, ALWAYS
, and
NEVER
.both
- the new visibilitypublic void setVerticalScrollBarVisibility(int v)
v
- the new visibilitypublic void setViewport(Viewport vp)
new Viewport(true)
.vp
- the new viewportCopyright (c) IBM Corp. and others 2000, 2011. All Rights Reserved.