/** * Scrolls the content so that the specified point in the content is in the top * left corner. If no content has been set, nothing will occur. * * Negative values will be ignored. Values greater than the maximum scroll * distance will result in scrolling to the end of the scrollbar. * * @param origin the point on the content to appear in the top left corner * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * <li>ERROR_INVALID_ARGUMENT - value of origin is outside of content * </ul> */ public void setOrigin( Point origin ) { setOrigin( origin.x, origin.y ); }
/** * Scrolls the content so that the specified point in the content is in the top * left corner. If no content has been set, nothing will occur. * * Negative values will be ignored. Values greater than the maximum scroll * distance will result in scrolling to the end of the scrollbar. * * @param origin the point on the content to appear in the top left corner * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * <li>ERROR_INVALID_ARGUMENT - value of origin is outside of content * </ul> * @since 2.0 */ public void setOrigin(Point origin) { setOrigin(origin.x, origin.y); } /**
/** * Scrolls the content so that the specified point in the content is in the top * left corner. If no content has been set, nothing will occur. * * Negative values will be ignored. Values greater than the maximum scroll * distance will result in scrolling to the end of the scrollbar. * * @param origin the point on the content to appear in the top left corner * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * <li>ERROR_INVALID_ARGUMENT - value of origin is outside of content * </ul> * @since 2.0 */ public void setOrigin(Point origin) { setOrigin(origin.x, origin.y); } /**
/** * Scrolls the content so that the specified point in the content is in the top * left corner. If no content has been set, nothing will occur. * * Negative values will be ignored. Values greater than the maximum scroll * distance will result in scrolling to the end of the scrollbar. * * @param origin the point on the content to appear in the top left corner * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * <li>ERROR_INVALID_ARGUMENT - value of origin is outside of content * </ul> * @since 2.0 */ public void setOrigin(Point origin) { setOrigin(origin.x, origin.y); } /**
/** * Scrolls the content so that the specified point in the content is in the top * left corner. If no content has been set, nothing will occur. * * Negative values will be ignored. Values greater than the maximum scroll * distance will result in scrolling to the end of the scrollbar. * * @param origin the point on the content to appear in the top left corner * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * <li>ERROR_INVALID_ARGUMENT - value of origin is outside of content * </ul> * @since 2.0 */ public void setOrigin(Point origin) { setOrigin(origin.x, origin.y); } /**
/** * Scrolls the content so that the specified point in the content is in the top * left corner. If no content has been set, nothing will occur. * * Negative values will be ignored. Values greater than the maximum scroll * distance will result in scrolling to the end of the scrollbar. * * @param origin the point on the content to appear in the top left corner * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * <li>ERROR_INVALID_ARGUMENT - value of origin is outside of content * </ul> * @since 2.0 */ public void setOrigin(Point origin) { setOrigin(origin.x, origin.y); } /**
protected void refreshInfoCanvas() { int pos = refreshInfoCanvasSupport(); if ( scrollPending && pos != -1 ){ scrollPending = false; sc.setOrigin( 0, pos ); } }
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); }
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); } }
private static void restoreOrigin( ScrolledComposite composite ) { Point oldOrigin = getBufferedOrigin( composite ); if( oldOrigin != null ) { composite.setOrigin( oldOrigin ); composite.setData( TextSizeRecalculation.KEY_SCROLLED_COMPOSITE_ORIGIN, null ); } }
@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); } }
/** * A utility method that ensures that the control is visible in the scrolled * composite. The prerequisite for this method is that the control has a * class that extends ScrolledComposite somewhere in the parent chain. If * the control is partially or fully clipped, the composite is scrolled to * set by setting the origin to the control origin. * * @param c * the control to make visible * @param verticalOnly * if <code>true</code>, the scrolled composite will be * scrolled only vertically if needed. Otherwise, the scrolled * composite origin will be set to the control origin. * @since 3.1 */ public static void setControlVisible(Control c, boolean verticalOnly) { ScrolledComposite scomp = FormUtil.getScrolledComposite(c); if (scomp == null) return; Point location = FormUtil.getControlLocation(scomp, c); scomp.setOrigin(location); }
/** * A utility method that ensures that the control is visible in the scrolled * composite. The prerequisite for this method is that the control has a * class that extends ScrolledComposite somewhere in the parent chain. If * the control is partially or fully clipped, the composite is scrolled to * set by setting the origin to the control origin. * * @param c * the control to make visible * @param verticalOnly * if <code>true</code>, the scrolled composite will be * scrolled only vertically if needed. Otherwise, the scrolled * composite origin will be set to the control origin. * @since 3.1 */ public static void setControlVisible(Control c, boolean verticalOnly) { ScrolledComposite scomp = FormUtil.getScrolledComposite(c); if (scomp == null) return; Point location = FormUtil.getControlLocation(scomp, c); scomp.setOrigin(location); }
/** * Update the welcome page to start at the * beginning of the text. */ private void focusOn(StyledText newText, int caretOffset) { if (newText == null) { return; } newText.setFocus(); newText.setCaretOffset(caretOffset); scrolledComposite.setOrigin(0, newText.getLocation().y); }
public void run() { Rectangle itemRect = item.getDisplay().map( hit.getParent(), item, hit.getBounds()); Point origin = item.getOrigin(); origin.y = itemRect.y; item.setOrigin(origin); } });
public void handleSetOrigin( ScrolledComposite composite, JsonObject properties ) { Point origin = composite.getOrigin(); JsonValue hSelection = properties.get( PARAM_H_BAR_SELECTION ); if( hSelection != null && composite.getHorizontalBar() != null ) { origin.x = hSelection.asInt(); } JsonValue vSelection = properties.get( PARAM_V_BAR_SELECTION ); if( vSelection != null && composite.getVerticalBar() != null ) { origin.y = vSelection.asInt(); } composite.setOrigin( origin ); }
public void readData( final Widget widget ) { ScrolledComposite composite = ( ScrolledComposite )widget; Point origin = composite.getOrigin(); String value = WidgetLCAUtil.readPropertyValue( widget, PARAM_H_BAR_SELECTION ); ScrollBar hScroll = composite.getHorizontalBar(); if( value != null && hScroll != null ) { origin.x = NumberFormatUtil.parseInt( value ); processSelection( hScroll ); } value = WidgetLCAUtil.readPropertyValue( widget, PARAM_V_BAR_SELECTION ); ScrollBar vScroll = composite.getVerticalBar(); if( value != null && vScroll != null ) { origin.y = NumberFormatUtil.parseInt( value ); processSelection( vScroll ); } composite.setOrigin( origin ); ControlLCAUtil.processMouseEvents( composite ); ControlLCAUtil.processKeyEvents( composite ); ControlLCAUtil.processMenuDetect( composite ); WidgetLCAUtil.processHelp( composite ); }