Package org.eclipse.gef.ui.rulers
Class RulerComposite
java.lang.Object
org.eclipse.swt.widgets.Widget
org.eclipse.swt.widgets.Control
org.eclipse.swt.widgets.Scrollable
org.eclipse.swt.widgets.Composite
org.eclipse.gef.ui.rulers.RulerComposite
- All Implemented Interfaces:
Drawable
A RulerComposite is used to show rulers to the north and west of the control
of a given
graphical
viewer. The rulers will be shown based on whether or not
horizontal ruler and
vertical
ruler properties are set on the given viewer, and the value of the
visibility property.- Since:
- 3.0
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic RectanglecalculateEditorTrim(Canvas canvas) Calculates the proper trim.static RectanglecalculateRulerTrim(Canvas canvas) Calculates the proper trim for the ruler.voiddoLayout()Perform the ruler layout.protected FigureCanvasRetrieve the editor figure canvas.protected GraphicalViewergetLeft()Retrieve the left ruler graphical viewer.protected GraphicalViewergetTop()Retrieve the top ruler graphical viewer.voidlayout(boolean change) voidsetGraphicalViewer(ScrollingGraphicalViewer primaryViewer) Creates rulers for the given graphical viewer.Methods inherited from class org.eclipse.swt.widgets.Composite
changed, checkSubclass, computeSize, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, redraw, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList, toStringMethods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar, setScrollbarsModeMethods 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, updateMethods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, addTypedListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, getTypedListeners, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, removeListener, removeTypedListener, reskin, setData, setDataMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.swt.graphics.Drawable
isAutoScalable
-
Constructor Details
-
RulerComposite
Constructor- Parameters:
parent- a widget which will be the parent of the new instance (cannot be null)style- the style of widget to construct- See Also:
-
-
Method Details
-
calculateEditorTrim
Calculates the proper trim. Includes scrollbars' sizes only if they're visible.- Parameters:
canvas- The canvas.- Since:
- 3.6
-
calculateRulerTrim
Calculates the proper trim for the ruler.- Parameters:
canvas- The canvas.- Since:
- 3.6
-
doLayout
public void doLayout()Perform the ruler layout.- Since:
- 3.6
-
layout
public void layout(boolean change) -
setGraphicalViewer
Creates rulers for the given graphical viewer.The primaryViewer or its Control cannot be
null. The primaryViewer's Control should be a FigureCanvas and a child of this Composite. This method should only be invoked once.To create ruler(s), simply add the RulerProvider(s) (with the right key: RulerProvider.PROPERTY_HORIZONTAL_RULER or RulerProvider.PROPERTY_VERTICAL_RULER) as a property on the given viewer. It can be done after this method is invoked. RulerProvider.PROPERTY_RULER_VISIBILITY can be used to show/hide the rulers.
- Parameters:
primaryViewer- The graphical viewer for which the rulers have to be created
-
getLeft
Retrieve the left ruler graphical viewer.- Returns:
- The left ruler graphical viewer.
- Since:
- 3.6
-
getTop
Retrieve the top ruler graphical viewer.- Returns:
- The top ruler graphical viewer.
- Since:
- 3.6
-
getEditor
Retrieve the editor figure canvas.- Returns:
- The editor figure canvas.
- Since:
- 3.6
-