Class AbstractScrollableControl

  • All Implemented Interfaces:
    ILightControl
    Direct Known Subclasses:
    LightList

    public abstract class AbstractScrollableControl
    extends AbstractLightControl
    Instance of this class represents scrollable control. If control content can not fit in given bounds, scroll bars will appear. By moving scroll bars user could see all contol content. Scrollable control can be scrolled vertically and horizontally.
    • Constructor Detail

      • AbstractScrollableControl

        public AbstractScrollableControl()
        Constructor. Constructs control with vertical and horizontal scroll bars.
      • AbstractScrollableControl

        public AbstractScrollableControl​(int style)
        Constuctor.
        Parameters:
        style - - scrolls style. Can be SWT.VERTICAL and SWT.HORIZONTAL, one of them or SWT.NONE.
        See Also:
        SWT.VERTICAL, SWT.HORIZONTAL, SWT.NONE
    • Method Detail

      • getScrollPosition

        public org.eclipse.swt.graphics.Point getScrollPosition()
        Returns scroll position.
        Returns:
        scroll position. Cannot return null.
      • scrollBy

        public void scrollBy​(int horizontalDelta,
                             int verticalDelta)
        Scroll horizontally and vertically by given amount.
        Parameters:
        horizontalDelta - - horizontal scroll amount.
        verticalDelta - - vertical scroll amount.
      • scrollHorizontallyBy

        public void scrollHorizontallyBy​(int delta)
        Scroll horizontally by given amount.
        Parameters:
        delta - - scroll amount.
      • scrollVerticallyBy

        public void scrollVerticallyBy​(int delta)
        Scroll vertically by given amount.
        Parameters:
        delta - - scroll amount.
      • scrollTo

        public void scrollTo​(int x,
                             int y)
        Scrolls control to given coordinates.
        Parameters:
        x - - x coordinate to scroll to.
        y - - y coordinate to scroll to.
      • scrollHorizontallyTo

        public void scrollHorizontallyTo​(int x)
        Scrolls horizontally to given coordinate
        Parameters:
        x - - x coordinate to scroll to.
      • scrollVerticallyTo

        public void scrollVerticallyTo​(int y)
        Scrolls vertically to given coordinate
        Parameters:
        y - - y coordinate to scroll to.
      • paint

        public void paint​(org.eclipse.swt.graphics.GC gc,
                          org.eclipse.swt.graphics.Rectangle rectangle)
        Description copied from interface: ILightControl
        Paints the given rectangle of this control.
        Parameters:
        gc - the GC to paint on.
        rectangle - the rectangle to paint.
      • getScrollsStyle

        protected int getScrollsStyle()
        Returns scrolls style.
        Returns:
        scrolls style.
        See Also:
        SWT.VERTICAL, SWT.HORIZONTAL, SWT.NONE
      • setScrollRange

        protected void setScrollRange​(org.eclipse.swt.graphics.Point scrollRange)
        Sets scroll range. Should be set after control/content size change.
        Parameters:
        scrollRange - - new scroll range.
      • getScrollRange

        protected org.eclipse.swt.graphics.Point getScrollRange()
        Returns scroll range.
        Returns:
        scroll range. Cannot be null.
      • getViewportBounds

        protected org.eclipse.swt.graphics.Rectangle getViewportBounds()
        Returns viewport bounds. Viewport bounds - part of control which is visible right now.
         ---------------
         |             |
         |   ----      |
         |   |vb|      |
         |   ----      |
         |             |
         ---------------
         vb - viewport bounds.
         
        Returns:
        viewport bounds. Cannot return null.
      • getClientArea

        protected org.eclipse.swt.graphics.Rectangle getClientArea()
        Returns control bounds without scroll bars.
        Returns:
        control bounds without scroll bars. Cannot return null.
      • handleTranslatedEvent

        protected abstract void handleTranslatedEvent​(org.eclipse.swt.widgets.Event event)
        Process event with translated coordinates.
        Parameters:
        event - - event to process. Cannot be null.
      • getContentSize

        protected abstract org.eclipse.swt.graphics.Point getContentSize()
        Returns size of control content.
        Returns:
        size of control content. Cannot return null.
      • recalculateScrollRange

        protected void recalculateScrollRange()
        Recalculates scroll range.