public static void ensureVisible(ScrolledComposite scomp, Control control) { // if the control is a FormText we do not need to scroll since it will // ensure visibility of its segments as necessary if (control instanceof FormText) return; Point controlSize = control.getSize(); Point controlOrigin = getControlLocation(scomp, control); ensureVisible(scomp, controlOrigin, controlSize); }
public static void ensureVisible(ScrolledComposite scomp, Control control) { // if the control is a FormText we do not need to scroll since it will // ensure visibility of its segments as necessary if (control instanceof FormText) return; Point controlSize = control.getSize(); Point controlOrigin = getControlLocation(scomp, control); ensureVisible(scomp, controlOrigin, controlSize); }
private void ensureVisible(IFocusSelectable segment) { if (mouseFocus) { mouseFocus = false; return; } if (segment == null) return; Rectangle bounds = segment.getBounds(); ScrolledComposite scomp = FormUtil.getScrolledComposite(this); if (scomp == null) return; Point origin = FormUtil.getControlLocation(scomp, this); origin.x += bounds.x; origin.y += bounds.y; FormUtil.ensureVisible(scomp, origin, new Point(bounds.width, bounds.height)); }
/** * 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); }
private void ensureVisible(IFocusSelectable segment) { if (mouseFocus) { mouseFocus = false; return; } if (segment == null) return; Rectangle bounds = segment.getBounds(); ScrolledComposite scomp = FormUtil.getScrolledComposite(this); if (scomp == null) return; Point origin = FormUtil.getControlLocation(scomp, this); origin.x += bounds.x; origin.y += bounds.y; FormUtil.ensureVisible(scomp, origin, new Point(bounds.width, bounds.height)); }
/** * 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); }
public static void ensureVisible(Control control) { ScrolledComposite form = FormUtil.getScrolledComposite(control); if (form != null) { if (control instanceof StyledText) { // bug 299392: ensure that the caret is visible for styled text but avoid scrolling form if only a portion of the control is visible Point origin = FormUtil.getControlLocation(form, control); Point caretLocation = ((StyledText) control).getCaret().getLocation(); origin.x += caretLocation.x; origin.y += caretLocation.y; FormUtil.ensureVisible(form, origin, new Point(20, 20)); } else { FormUtil.ensureVisible(form, control); } } }
public static void ensureVisible(ScrolledComposite scomp, Control control, MouseEvent e) { Point controlOrigin = getControlLocation(scomp, control); int rX = controlOrigin.x + e.x; int rY = controlOrigin.y + e.y;
public static void ensureVisible(ScrolledComposite scomp, Control control, MouseEvent e) { Point controlOrigin = getControlLocation(scomp, control); int rX = controlOrigin.x + e.x; int rY = controlOrigin.y + e.y;