Package org.eclipse.swt.widgets

Examples of org.eclipse.swt.widgets.ScrollBar


        handleResize();
      }
    });

    /* Set up the paint canvas scroll bars */
    ScrollBar horizontal = paintCanvas.getHorizontalBar();
    horizontal.setVisible(true);
    horizontal.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent event) {
        scrollHorizontally((ScrollBar) event.widget);
      }
    });
    ScrollBar vertical = paintCanvas.getVerticalBar();
    vertical.setVisible(true);
    vertical.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent event) {
        scrollVertically((ScrollBar) event.widget);
      }
    });
    handleResize();
View Full Code Here


                Tree treeWidget = viewer.getTree();
                if (isDisposed()) {
                    return;
                }

                ScrollBar bar = treeWidget.getVerticalBar();
                int barPosition = 0;
                if (bar != null) {
                    barPosition = bar.getSelection();
                }
                if (items == null) {
                    if (isDisposed()) {
                        return;
                    }
                    viewer.refresh();

                } else {
                    if (isDisposed()) {
                        return;
                    }
                    for (int i = 0; i < items.length; i++) {
                        viewer.refresh(items[i]);
                    }
                }

                if (barPosition != 0) {
                    bar.setSelection(Math.min(bar.getMaximum(), barPosition));
                }
            }
        } catch (Throwable e) {
            //things may be disposed...
            Log.log(e);
View Full Code Here

        int maxWidth= 0;
        for (Iterator<HighlightingColorListItem> it= fListModel.iterator(); it.hasNext();) {
            HighlightingColorListItem item=  it.next();
            maxWidth= Math.max(maxWidth, convertWidthInCharsToPixels(item.getDisplayName().length()));
        }
        ScrollBar vBar= ((Scrollable) fListViewer.getControl()).getVerticalBar();
        if (vBar != null)
            maxWidth += vBar.getSize().x * 3; // scrollbars and tree indentation guess
        gd.widthHint= maxWidth;
       
        fListViewer.getControl().setLayoutData(gd);
                       
        Composite stylesComposite= new Composite(editorComposite, SWT.NONE);
View Full Code Here

        yorigin = Math.min(yorigin, contentSize.y - 1);
        scomp.setOrigin(xorigin, yorigin);
    }

    public static void updatePageIncrement(ScrolledComposite scomp) {
        ScrollBar vbar = scomp.getVerticalBar();
        if (vbar != null) {
            Rectangle clientArea = scomp.getClientArea();
            int increment = clientArea.height - 5;
            vbar.setPageIncrement(increment);
        }
        ScrollBar hbar = scomp.getHorizontalBar();
        if (hbar != null) {
            Rectangle clientArea = scomp.getClientArea();
            int increment = clientArea.width - 5;
            hbar.setPageIncrement(increment);
        }
    }
View Full Code Here

    } else
      reflow(flushCache);
  }

  private void initializeScrollBars() {
    ScrollBar hbar = getHorizontalBar();
    if (hbar != null) {
      hbar.setIncrement(H_SCROLL_INCREMENT);
    }
    ScrollBar vbar = getVerticalBar();
    if (vbar != null) {
      vbar.setIncrement(V_SCROLL_INCREMENT);
    }
    FormUtil.updatePageIncrement(this);
  }
View Full Code Here

    yorigin = Math.min(yorigin, contentSize.y - 1);
    scomp.setOrigin(xorigin, yorigin);
  }

  public static void updatePageIncrement(ScrolledComposite scomp) {
    ScrollBar vbar = scomp.getVerticalBar();
    if (vbar != null) {
      Rectangle clientArea = scomp.getClientArea();
      int increment = clientArea.height - 5;
      vbar.setPageIncrement(increment);
    }
  }
View Full Code Here

    public WidgetInfos(StyledText textWidget, Canvas canvas) {
      maxLines= textWidget.getLineCount();
      bounds= canvas.getBounds();
      writable= JFaceTextUtil.computeLineHeight(textWidget, 0, maxLines, maxLines);
     
      ScrollBar verticalBar= textWidget.getVerticalBar();
      thumbHeight= verticalBar != null ? Math.max(Math.min(bounds.height, verticalBar.getThumbBounds().height), 0) : 0;
     
          int partialTopIndex= JFaceTextUtil.getPartialTopIndex(textWidget);
          int topLineHeight= textWidget.getLineHeight(textWidget.getOffsetAtLine(partialTopIndex));
          int topLinePixel= textWidget.getLinePixel(partialTopIndex);
          double topIndex= partialTopIndex - (double) topLinePixel / topLineHeight;
View Full Code Here

  public OverviewRulerHoverManager(IOverviewRuler ruler, ISourceViewer sourceViewer, IAnnotationHover annotationHover, IInformationControlCreator creator) {
    super(ruler, sourceViewer, annotationHover, creator);
    setAnchor(ANCHOR_LEFT);
    StyledText textWidget= sourceViewer.getTextWidget();
    if (textWidget != null) {
      ScrollBar verticalBar= textWidget.getVerticalBar();
      if (verticalBar != null)
        setMargins(verticalBar.getSize().x, 5);
    }
  }
View Full Code Here

     * @return an array containing {topArrowHeight, bottomArrowHeight}
     *
     * @since 3.6
     */
    private int[] getVerticalScrollArrowHeights(StyledText textWidget, int bottomOffset) {
      ScrollBar verticalBar= textWidget.getVerticalBar();
      if (verticalBar == null)
        return new int[] { 0, 0 };
     
      int[] arrowHeights= computeScrollArrowHeights(textWidget, bottomOffset);
      if (arrowHeights[0] > 0 || arrowHeights[1] > 0) {
        fScrollArrowHeights= arrowHeights;
      } else if (fScrollArrowHeights != null) {
        return fScrollArrowHeights;
      } else {
        // No arrow heights available. Enlarge textWidget and tweak scroll bar to get reasonable values.
        Point originalSize= textWidget.getSize();
        try {
          int fakeHeight= 1000;
          bottomOffset= bottomOffset - originalSize.y + fakeHeight;
          textWidget.setSize(originalSize.x, fakeHeight);
          verticalBar.setValues(0, 0, 1 << 30, 1, 10, 10);
          arrowHeights= computeScrollArrowHeights(textWidget, bottomOffset);
          fScrollArrowHeights= arrowHeights;
        } finally {
          textWidget.setSize(originalSize); // also resets scroll bar values
        }
View Full Code Here

     * @return an array containing {topArrowHeight, bottomArrowHeight}
     *
     * @since 3.6
     */
    private int[] computeScrollArrowHeights(StyledText textWidget, int bottomOffset) {
      ScrollBar verticalBar= textWidget.getVerticalBar();
      Rectangle thumbTrackBounds= verticalBar.getThumbTrackBounds();
      if (thumbTrackBounds.height == 0) // SWT returns bogus values on Cocoa in this case, see https://bugs.eclipse.org/352990
        return new int[] { 0, 0 };
     
      int topArrowHeight= thumbTrackBounds.y;
      int bottomArrowHeight= bottomOffset - (thumbTrackBounds.y + thumbTrackBounds.height);
View Full Code Here

TOP

Related Classes of org.eclipse.swt.widgets.ScrollBar

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.