Java Code Examples for org.eclipse.swt.SWT#HIGH

The following examples show how to use org.eclipse.swt.SWT#HIGH . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RangeSlider.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public int getStyle() {
	return super.getStyle() | orientation | (isSmooth ? SWT.SMOOTH : SWT.NONE) | //
			(isOn ? SWT.ON : SWT.NONE) | //
			(isFullSelection ? SWT.CONTROL : SWT.NONE) | //
			(isHighQuality ? SWT.HIGH : SWT.NONE);
}
 
Example 2
Source File: RangeSlider.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * Constructs a new instance of this class given its parent and a style value
 * describing its behavior and appearance.
 * <p>
 * The style value is either one of the style constants defined in class
 * <code>SWT</code> which is applicable to instances of this class, or must be
 * built by <em>bitwise OR</em>'ing together (that is, using the
 * <code>int</code> "|" operator) two or more of those <code>SWT</code> style
 * constants. The class description lists the style constants that are
 * applicable to the class. Style bits are also inherited from superclasses.
 * </p>
 *
 * @param parent a composite control which will be the parent of the new
 *            instance (cannot be null)
 * @param style the style of control to construct. Default style is HORIZONTAL
 *
 * @exception IllegalArgumentException
 *                <ul>
 *                <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
 *                </ul>
 * @exception SWTException
 *                <ul>
 *                <li>ERROR_THREAD_INVALID_ACCESS - if not called from the
 *                thread that created the parent</li>
 *                </ul>
 * @see SWT#HORIZONTAL
 * @see SWT#VERTICAL
 * @see Widget#getStyle
 *
 */
public RangeSlider(final Composite parent, final int style) {
	super(parent, SWT.DOUBLE_BUFFERED | ((style & SWT.BORDER) == SWT.BORDER ? SWT.BORDER : SWT.NONE));
	minimum = lowerValue = 0;
	maximum = upperValue = 100;
	listeners = new ArrayList<SelectionListener>();
	increment = 1;
	pageIncrement = 10;
	slider = SWTGraphicUtil.createImageFromFile("images/slider-normal.png");
	sliderHover = SWTGraphicUtil.createImageFromFile("images/slider-hover.png");
	sliderDrag = SWTGraphicUtil.createImageFromFile("images/slider-drag.png");
	sliderSelected = SWTGraphicUtil.createImageFromFile("images/slider-selected.png");

	vSlider = SWTGraphicUtil.createImageFromFile("images/h-slider-normal.png");
	vSliderHover = SWTGraphicUtil.createImageFromFile("images/h-slider-hover.png");
	vSliderDrag = SWTGraphicUtil.createImageFromFile("images/h-slider-drag.png");
	vSliderSelected = SWTGraphicUtil.createImageFromFile("images/h-slider-selected.png");

	if ((style & SWT.VERTICAL) == SWT.VERTICAL) {
		orientation = SWT.VERTICAL;
	} else {
		orientation = SWT.HORIZONTAL;
	}
	isSmooth = (style & SWT.SMOOTH) == SWT.SMOOTH;
	isFullSelection = (style & SWT.CONTROL) == SWT.CONTROL;
	isHighQuality = (style & SWT.HIGH) == SWT.HIGH;
	isOn = (style & SWT.ON) == SWT.ON;
	selectedElement = isFullSelection ? BOTH : LOWER;

	addListener(SWT.Dispose, event -> {
		SWTGraphicUtil.safeDispose(slider);
		SWTGraphicUtil.safeDispose(sliderHover);
		SWTGraphicUtil.safeDispose(sliderDrag);
		SWTGraphicUtil.safeDispose(sliderSelected);

		SWTGraphicUtil.safeDispose(vSlider);
		SWTGraphicUtil.safeDispose(vSliderHover);
		SWTGraphicUtil.safeDispose(vSliderDrag);
		SWTGraphicUtil.safeDispose(vSliderSelected);
	});
	addMouseListeners();
	addListener(SWT.Resize, event -> {
		if (isHighQuality) {
			setTickFactors();
		} else {
			tickFactor = ((orientation == SWT.HORIZONTAL ? getClientArea().width : getClientArea().height) - 20f) / tickDivisions;
		}
	});
	addListener(SWT.FocusIn, e -> {
		hasFocus = true;
		redraw();
	});
	addListener(SWT.FocusOut, e -> {
		hasFocus = false;
		redraw();
	});
	addListener(SWT.KeyDown, event -> {
		handleKeyDown(event);
	});
	addPaintListener(event -> {
		drawWidget(event);
	});
}