private static Control getContentControl( Widget widget ) { return ( ( ScrolledComposite )widget ).getContent(); }
private static void restoreContentSize( ScrolledComposite composite ) { Control content = composite.getContent(); if( content != null ) { restoreContentSize( content ); } }
static void scroll(ScrolledComposite scomp, int xoffset, int yoffset) { Point origin = scomp.getOrigin(); Point contentSize = scomp.getContent().getSize(); int xorigin = origin.x + xoffset; int yorigin = origin.y + yoffset; xorigin = Math.max(xorigin, 0); xorigin = Math.min(xorigin, contentSize.x - 1); yorigin = Math.max(yorigin, 0); yorigin = Math.min(yorigin, contentSize.y - 1); scomp.setOrigin(xorigin, yorigin); }
static void scroll(ScrolledComposite scomp, int xoffset, int yoffset) { Point origin = scomp.getOrigin(); Point contentSize = scomp.getContent().getSize(); int xorigin = origin.x + xoffset; int yorigin = origin.y + yoffset; xorigin = Math.max(xorigin, 0); xorigin = Math.min(xorigin, contentSize.x - 1); yorigin = Math.max(yorigin, 0); yorigin = Math.min(yorigin, contentSize.y - 1); scomp.setOrigin(xorigin, yorigin); }
private static void bufferContentSize( ScrolledComposite composite ) { Control content = composite.getContent(); if( content != null ) { Point size = content.getSize(); content.setData( TextSizeRecalculation.KEY_SCROLLED_COMPOSITE_CONTENT_SIZE, size ); } }
public static Point getControlLocation(ScrolledComposite scomp, Control control) { int x = 0; int y = 0; Control content = scomp.getContent(); Control currentControl = control; for (;;) { if (currentControl == content) break; Point location = currentControl.getLocation(); // if (location.x > 0) // x += location.x; // if (location.y > 0) // y += location.y; x += location.x; y += location.y; currentControl = currentControl.getParent(); } return new Point(x, y); }
public static Point getControlLocation(ScrolledComposite scomp, Control control) { int x = 0; int y = 0; Control content = scomp.getContent(); Control currentControl = control; for (;;) { if (currentControl == content) break; Point location = currentControl.getLocation(); // if (location.x > 0) // x += location.x; // if (location.y > 0) // y += location.y; x += location.x; y += location.y; currentControl = currentControl.getParent(); } return new Point(x, y); }
public void propertyChange(PropertyChangeEvent event) { for (Iterator iterator = fBannerLabels.iterator(); iterator.hasNext();) { Label label = (Label) iterator.next(); label.setFont(JFaceResources.getBannerFont()); } for (Iterator iterator = fHeaderLabels.iterator(); iterator.hasNext();) { Label label = (Label) iterator.next(); label.setFont(JFaceResources.getHeaderFont()); } Control control= fScrolledComposite.getContent(); fScrolledComposite.setMinSize(control.computeSize(SWT.DEFAULT, SWT.DEFAULT)); fScrolledComposite.setContent(control); fScrolledComposite.layout(true); fScrolledComposite.redraw(); }
public static void updateScrolledComposite(ScrolledComposite sc) { Control content = sc.getContent(); if (content != null && !content.isDisposed()) { Rectangle r = sc.getClientArea(); sc.setMinSize(content.computeSize(r.width, SWT.DEFAULT )); } }
int sc1_x = sc1.getContent().getSize().x; int sc2_x = sc2.getContent().getSize().x;
@Override public void preserveValues( ScrolledComposite composite ) { preserveProperty( composite, PROP_ORIGIN, getOrigin( composite ) ); preserveProperty( composite, PROP_CONTENT, composite.getContent() ); preserveProperty( composite, PROP_SHOW_FOCUSED_CONTROL, composite.getShowFocusedControl() ); }
private void ensureSectionBuilt(TreeItem treeSection, boolean recreateIfAlreadyThere) { ScrolledComposite item = (ScrolledComposite)treeSection.getData("Panel"); if (item == null) { return; } ConfigSection configSection = (ConfigSection)treeSection.getData("ConfigSectionSWT"); if (configSection != null) { Control previous = item.getContent(); if (previous instanceof Composite) { if (!recreateIfAlreadyThere) { return; } configSection.configSectionDelete(); sectionsCreated.remove(configSection); Utils.disposeComposite((Composite)previous,true); } Composite c = ((UISWTConfigSection)configSection).configSectionCreate(item); // we need to do this here as, on GTK at least, leaving it until later causes check/radio-boxes not // to layout correctly after their font is changed if (filterText != null && filterText.length() > 0) { hilightText(c, filterText); } sectionsCreated.add(configSection); item.setContent(c); } }
/** * Handles one of the expandable composites being expanded */ private void handleExpand(ScrolledComposite composite) { if (composite == null) { return; } try { composite.setRedraw(false); Composite c = (Composite) composite.getContent(); if (c == null) { return; } Point newSize = c.computeSize(SWT.DEFAULT, SWT.DEFAULT); composite.setMinSize(newSize); c.layout(true); } finally { composite.setRedraw(true); } }
/** * Handles one of the expandable composites being expanded */ void handleExpand(ScrolledComposite composite) { if (composite == null) { return; } try { composite.setRedraw(false); Composite c = (Composite) composite.getContent(); if (c == null) { return; } Point newSize = c.computeSize(SWT.DEFAULT, SWT.DEFAULT); composite.setMinSize(newSize); c.layout(true); } finally { composite.setRedraw(true); } }
/** * Handles one of the expandable composites being expanded */ void handleExpand(ScrolledComposite composite) { if(composite == null) { return; } try { composite.setRedraw(false); Composite c = (Composite) composite.getContent(); if (c == null) { return; } Point newSize = c.computeSize(SWT.DEFAULT, SWT.DEFAULT); composite.setMinSize(newSize); c.layout(true); } finally { composite.setRedraw(true); } }
@Override public void renderChanges( ScrolledComposite composite ) throws IOException { ControlLCAUtil.renderChanges( composite ); WidgetLCAUtil.renderCustomVariant( composite ); renderProperty( composite, PROP_CONTENT, composite.getContent(), null ); renderProperty( composite, PROP_ORIGIN, getOrigin( composite ), DEFAULT_ORIGIN ); renderProperty( composite, PROP_SHOW_FOCUSED_CONTROL, composite.getShowFocusedControl(), false ); }
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); } }
protected void handlePropertyChange(PropertyChangeEvent event) { if (fHeader != null) fHeader.setFont(JFaceResources.getHeaderFont()); if (fBanner != null) fBanner.setFont(JFaceResources.getBannerFont()); Control control= fScrolledComposite.getContent(); fScrolledComposite.setMinSize(control.computeSize(SWT.DEFAULT, SWT.DEFAULT)); fScrolledComposite.setContent(control); fScrolledComposite.layout(true); fScrolledComposite.redraw(); }
/** * Handles the property change. * * @param event the property change event object describing which property changed and how */ protected void handlePropertyChange(PropertyChangeEvent event) { if (fHeader != null) fHeader.setFont(JFaceResources.getHeaderFont()); if (fBanner != null) fBanner.setFont(JFaceResources.getBannerFont()); Control control= fScrolledComposite.getContent(); fScrolledComposite.setMinSize(control.computeSize(SWT.DEFAULT, SWT.DEFAULT)); fScrolledComposite.setContent(control); fScrolledComposite.layout(true); fScrolledComposite.redraw(); }
/** * Handles the property change. * * @param event the property change event object describing which property changed and how */ protected void handlePropertyChange(PropertyChangeEvent event) { if (fHeader != null) fHeader.setFont(JFaceResources.getHeaderFont()); if (fBanner != null) fBanner.setFont(JFaceResources.getBannerFont()); Control control= fScrolledComposite.getContent(); fScrolledComposite.setMinSize(control.computeSize(SWT.DEFAULT, SWT.DEFAULT)); fScrolledComposite.setContent(control); fScrolledComposite.layout(true); fScrolledComposite.redraw(); }