private static void bufferSize( ScrolledComposite composite ) { Point size = composite.getSize(); composite.setData( TextSizeRecalculation.KEY_SCROLLED_COMPOSITE_SIZE, size ); }
/** * Fits the width of the main composite to the same width scrolled composite was given. */ private void fitSizeOfScrolledContent() { Point p = scrollComposite.getSize(); main.setSize(main.computeSize(p.x, SWT.DEFAULT)); }
public void focusGained(FocusEvent e) { int currentPosition= scrolledComposite.getOrigin().y; int hight= scrolledComposite.getSize().y; int linkPosition= link.getLocation().y; if (linkPosition < currentPosition) { if (linkPosition < 10) linkPosition= 0; scrolledComposite.setOrigin(0, linkPosition); } else if (linkPosition + 20 > currentPosition + hight) { scrolledComposite.setOrigin(0, linkPosition - hight + link.getSize().y); } }
@Override public void focusGained(FocusEvent e) { int currentPosition= scrolledComposite.getOrigin().y; int hight= scrolledComposite.getSize().y; int linkPosition= link.getLocation().y; if (linkPosition < currentPosition) { if (linkPosition < 10) linkPosition= 0; scrolledComposite.setOrigin(0, linkPosition); } else if (linkPosition + 20 > currentPosition + hight) { scrolledComposite.setOrigin(0, linkPosition - hight + link.getSize().y); } }
@Override public void focusGained(FocusEvent e) { int currentPosition= scrolledComposite.getOrigin().y; int hight= scrolledComposite.getSize().y; int linkPosition= link.getLocation().y; if (linkPosition < currentPosition) { if (linkPosition < 10) linkPosition= 0; scrolledComposite.setOrigin(0, linkPosition); } else if (linkPosition + 20 > currentPosition + hight) { scrolledComposite.setOrigin(0, linkPosition - hight + link.getSize().y); } }
scrolledComp.setOrigin(0, scrolledComp.getSize().y);
@Override public void handleEvent(Event arg0) { Point size = composite.getSize(); int width = 0; int height = 0; for(Control control : composite.getChildren()){ Point controlSize = control.computeSize(SWT.DEFAULT , SWT.DEFAULT); control.setSize(controlSize); if(control instanceof Composite){ //((Composite) control).layout(); } if(controlSize.x > width){ width = controlSize.x; } height += controlSize.y; } composite.setMinWidth(width); composite.setMinHeight(height); composite.layout(); }
private void setupSC(ScrolledComposite sc) { if (sc == null) { return; } Composite c = (Composite) sc.getContent(); if (c != null) { Point size1 = c.computeSize(sc.getClientArea().width, SWT.DEFAULT); Point size = c.computeSize(SWT.DEFAULT, size1.y); sc.setMinSize(size); } ScrollBar verticalBar = sc.getVerticalBar(); if (verticalBar != null) { verticalBar.setPageIncrement(sc.getSize().y); } }
break; case SWT.END: sc.setOrigin(0, sc.getSize().y); break; default: