Package org.eclipse.swt.widgets

Examples of org.eclipse.swt.widgets.ScrollBar


  }

  public static int getTableAdjustHorizontallyBy(Table t) {
    if (!bFixGTKBug || t == null || t.isDisposed())
      return 0;
    ScrollBar sb = t.getHorizontalBar();
    if (sb == null)
      return 0;
    return sb.getSelection();
  }
View Full Code Here


  private void onTreeResize() {
    int totalWidth = fTree.getParent().getClientArea().width;
    totalWidth -= fTree.getBorderWidth() * 2;

    ScrollBar verticalBar = fTree.getVerticalBar();
    if (verticalBar != null)
      totalWidth -= fTree.getVerticalBar().getSize().x;

    /* Bug on Mac: Width is too big */
    if (Application.IS_MAC)
View Full Code Here

  private void onTableResize() {
    int totalWidth = fTable.getParent().getClientArea().width;
    totalWidth -= fTable.getBorderWidth() * 2;

    ScrollBar verticalBar = fTable.getVerticalBar();
    if (verticalBar != null)
      totalWidth -= fTable.getVerticalBar().getSize().x;

    /* Bug on Mac: Width is too big */
    if (Application.IS_MAC)
View Full Code Here

  private void onTreeResize() {
    int totalWidth = fTree.getParent().getClientArea().width;
    totalWidth -= fTree.getBorderWidth() * 2;

    ScrollBar verticalBar = fTree.getVerticalBar();
    if (verticalBar != null)
      totalWidth -= fTree.getVerticalBar().getSize().x;

    /* Bug on Mac: Width is too big */
    if (Application.IS_MAC)
View Full Code Here

  }
 
  private void propagateScrollBarVisiblity(){
    setScrollbars();
    for(Dimension d : HOR_VER){
      ScrollBar bar = scrollBars.get(d);
      boolean shouldBeVisible =  scrollBarsVisible.get(d);
      if(bar != null && bar.isVisible() != shouldBeVisible){
        bar.setVisible(shouldBeVisible);
      }
    }
  }
View Full Code Here

  }
 
  private void updateScrollBars(){
    setScrollbars();
    for(Dimension d : HOR_VER){
      ScrollBar bar = scrollBars.get(d);
      if(bar == null) {
        continue;
      }
      double diff = figure.size.get(d) - viewPortSize.get(d);
      viewPortLocation.setMinMax(d, 0, diff);
      bar.setMinimum(0);
      bar.setMaximum(FigureMath.ceil( figure.size.get(d)));
      bar.setIncrement(50);
      int selSize = FigureMath.floor(viewPortSize.get(d));
      bar.setPageIncrement(selSize);
      bar.setThumb(selSize);
      bar.setSelection((int)viewPortLocation.get(d));
    }
  }
View Full Code Here

  @Override
  public void widgetSelected(SelectionEvent e) {
    setScrollbars();
    for(Dimension d : HOR_VER){
     
      ScrollBar bar = scrollBars.get(d);
     
      if(bar != null){
        viewPortLocation.set(d,bar.getSelection());
        Rectangle part = getViewPortRectangle();
        adjustOverlaps(part);
      } else {
      }
    }
View Full Code Here

        int maxWidth = 0;
        for (final TokenHighlight item : fColors) {
            maxWidth = Math.max(maxWidth, convertWidthInCharsToPixels(item.getName()
                    .length()));
        }
        final 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);
View Full Code Here

        }
    }

    /* Initalize the scrollbar and register listeners. */
    private void initScrollBars() {
        final ScrollBar horizontal = getHorizontalBar();
        horizontal.setEnabled(false);
        horizontal.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(final SelectionEvent event) {
                scrollHorizontally((ScrollBar) event.widget);
            }
        });
        final ScrollBar vertical = getVerticalBar();
        vertical.setEnabled(false);
        vertical.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(final SelectionEvent event) {
                scrollVertically((ScrollBar) event.widget);
            }
        });
View Full Code Here

        }
        if (ty > 0) {
            ty = 0;
        }

        final ScrollBar horizontal = getHorizontalBar();
        horizontal.setIncrement(getClientArea().width / 100);
        horizontal.setPageIncrement(getClientArea().width);
        final Rectangle imageBound = sourceImage.getBounds();
        final int cw = getClientArea().width, ch = getClientArea().height;
        if (imageBound.width * sx > cw) { /* image is wider than client area */
            horizontal.setMaximum((int) (imageBound.width * sx));
            horizontal.setEnabled(true);
            if ((int) -tx > horizontal.getMaximum() - cw) {
                tx = -horizontal.getMaximum() + cw;
            }
        } else { /* image is narrower than client area */
            horizontal.setEnabled(false);
            tx = (cw - imageBound.width * sx) / 2; // center if too small.
        }
        horizontal.setSelection((int) -tx);
        horizontal.setThumb(getClientArea().width);

        final ScrollBar vertical = getVerticalBar();
        vertical.setIncrement(getClientArea().height / 100);
        vertical.setPageIncrement(getClientArea().height);
        if (imageBound.height * sy > ch) { /* image is higher than client area */
            vertical.setMaximum((int) (imageBound.height * sy));
            vertical.setEnabled(true);
            if ((int) -ty > vertical.getMaximum() - ch) {
                ty = -vertical.getMaximum() + ch;
            }
        } else { /* image is less higher than client area */
            vertical.setEnabled(false);
            ty = (ch - imageBound.height * sy) / 2; // center if too small.
        }
        vertical.setSelection((int) -ty);
        vertical.setThumb(getClientArea().height);

        /* update transform. */
        af = AffineTransform.getScaleInstance(sx, sy);
        af.preConcatenate(AffineTransform.getTranslateInstance(tx, ty));
        transform = af;
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.