Package org.eclipse.swt.widgets

Examples of org.eclipse.swt.widgets.ScrollBar


   */
  public void currentPersonChanged(CurrentPersonChangeEvent event) {
    if (canvasImage != null && event.person != null) {
      int imageCount = event.person.getImageList().size();
      int fullSize = imageCount * (128 + 5) - 5;
      ScrollBar vBar = canvasImage.getVerticalBar();
      int areaHeight = canvasImage.getClientArea().height;
      if (fullSize <= areaHeight) {
        vBar.setEnabled(false);
      }
      else {
        vBar.setValues(0, 0, fullSize, areaHeight, 10, areaHeight);
        vBar.setEnabled(true);
      }
      canvasImage.redraw();
    }
  }
View Full Code Here


                }

                /*
                 * Consider the scroll bars
                 */
                ScrollBar hBar = getHorizontalBar();
                if (hBar != null && hBar.isVisible())
                    y -= hBar.getSize().y / 2;

                e.gc.drawImage(image, x, y);
            }
        });
    }
View Full Code Here

        }
      };

      tree.addMouseListener(theMouseAdapter);
      tree.addKeyListener(keyListener);
      ScrollBar hBar = tree.getHorizontalBar();
      if (hBar != null) {
        hBar.addSelectionListener(selectionListener);
      }
      ScrollBar vBar = tree.getVerticalBar();
      if (vBar != null) {
        vBar.addSelectionListener(selectionListener);
      }
    }
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

    ScrolledComposite sc = ((ScrolledComposite)composite);
   
    if (sc.content == null) return;
    Rectangle contentRect = sc.content.getBounds();
   
    ScrollBar hBar = sc.getHorizontalBar();
    ScrollBar vBar = sc.getVerticalBar();   
   
    if (hBar != null && hBar.getSize().y >= sc.getSize().yreturn;
    if (vBar != null && vBar.getSize().x >= sc.getSize().x) return;
   
//    inLayout = true;   
   
    Rectangle hostRect = sc.getClientArea();
    if (sc.expandHorizontal) {
      contentRect.width = Math.max(sc.minWidth, hostRect.width)
    }
    if (sc.expandVertical) {
      contentRect.height = Math.max(sc.minHeight, hostRect.height);
    }  
   
    contentRect = new Rectangle(5, 0, contentRect.width - 10 , contentRect.height);

    if (hBar != null) {
      hBar.setMaximum (contentRect.width);
      int ht = Math.min (contentRect.width, hostRect.width);
      hBar.setThumb(ht);
      int hPage = contentRect.width - hostRect.width;
      if(ht == contentRect.height) hBar.setVisible(false);
      else{
        hBar.setVisible(true);
        int hSelection = hBar.getSelection ();
        if (hSelection >= hPage) {
          if (hPage <= 0) {
            hSelection = 0;
            hBar.setSelection(0);
          }
          contentRect.x = -hSelection;
        }
      }
    }       

    List<OutlookBarItem> items = ((OutlookBarPane)composite.getParent()).getItemList();
    int increate  = items.size() > 1 ? items.size()*110 : items.size()*400;
    if (vBar != null) {
      vBar.setMaximum (contentRect.height);
      int ht = Math.min(contentRect.height , hostRect.height + increate);
      if(ht == contentRect.height) {
        vBar.setVisible(false);     
      } else{
        vBar.setVisible(true);
        vBar.setThumb(ht);
        int vPage = contentRect.height - hostRect.height;
        int vSelection = vBar.getSelection ();
        if (vSelection >= vPage) {
          if (vPage <= 0) {
            vSelection = 0;
            vBar.setSelection(0);
          }
          contentRect.y = -vSelection;
        }
      }
    }
View Full Code Here

   * @see #getStyle()
   */ 
  public ScrolledComposite(Composite parent, int style) {
    super(parent, checkStyle(style));
    super.setLayout(new ScrolledCompositeLayout());
    ScrollBar hBar = getHorizontalBar ();
    if (hBar != null) {
      hBar.setVisible(false);
      hBar.addListener (SWT.Selection, new Listener () {
        @SuppressWarnings("unused")
        public void handleEvent (Event e) {
          hScroll();
        }
      });
    }

    ScrollBar vBar = getVerticalBar ();
    if (vBar != null) {
      vBar.setVisible(false);
      vBar.addListener (SWT.Selection, new Listener () {
        @SuppressWarnings("unused")
        public void handleEvent (Event e) {
          vScroll();
        }
      });
View Full Code Here

  }

  void hScroll() {
    if (content == null) return;
    Point location = content.getLocation ();
    ScrollBar hBar = getHorizontalBar ();
    int hSelection = hBar.getSelection ();
    content.setLocation (-hSelection, location.y);
  }
View Full Code Here

    ScrollBar hBar = getHorizontalBar ();
    int hSelection = hBar.getSelection ();
    content.setLocation (-hSelection, location.y);
  }
  boolean needHScroll(Rectangle contentRect, boolean vVisible) {
    ScrollBar hBar = getHorizontalBar();
    if (hBar == null) return false;

    Rectangle hostRect = getBounds();
    int border = getBorderWidth();
    hostRect.width -= 2*border;
    ScrollBar vBar = getVerticalBar();
    if (vVisible && vBar != null) hostRect.width -= vBar.getSize().x;

    if (!expandHorizontal && contentRect.width > hostRect.width) return true;
    if (expandHorizontal && minWidth > hostRect.width) return true;
    return false;
  }
View Full Code Here

    if (expandHorizontal && minWidth > hostRect.width) return true;
    return false;
  }

  boolean needVScroll(Rectangle contentRect, boolean hVisible) {
    ScrollBar vBar = getVerticalBar();
    if (vBar == null) return false;

    Rectangle hostRect = getBounds();
    int border = getBorderWidth();
    hostRect.height -= 2*border;
    ScrollBar hBar = getHorizontalBar();
    if (hVisible && hBar != null) hostRect.height -= hBar.getSize().y;
    if (!expandVertical && contentRect.height > hostRect.height) return true;
    if (expandVertical && minHeight > hostRect.height) return true;
    return false;
  }
View Full Code Here

   * @since 2.0
   */
  public void setOrigin(int x, int y) {
    checkWidget();
    if (content == null) return;
    ScrollBar hBar = getHorizontalBar ();
    if (hBar != null) {
      hBar.setSelection(x);
      x = -hBar.getSelection ();
    } else {
      x = 0;
    }
    ScrollBar vBar = getVerticalBar ();
    if (vBar != null) {
      vBar.setSelection(y);
      y = -vBar.getSelection ();
    } else {
      y = 0;
    }
    content.setLocation(x, y);
  }
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.