org.eclipse.swt.widgets.Scrollable源码实例Demo

类org.eclipse.swt.widgets.Scrollable源码实例Demo

下面列出了org.eclipse.swt.widgets.Scrollable 类实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: tracecompass   文件: ScrollView.java
/**
 * Convert overview coordinates to global coordinates.
 *
 * @param loc
 *            the control reference
 * @param x
 *            The x coordinate to convert
 * @param y
 *            The y coordinate to convert
 * @return The new converted Point
 */
protected Point toGlobalCoordinates(Control loc, int x, int y) {
    Point p = new Point(x, y);
    for (Control c = loc; c != null; c = c.getParent()) {
        // control might have client area with 'decorations'
        int trimX = 0, trimY = 0;
        // other kind of widget with trimming ??
        if (c instanceof Scrollable) {
            Scrollable s = (Scrollable) c;
            Rectangle rr = s.getClientArea();
            Rectangle tr = s.computeTrim(rr.x, rr.y, rr.width, rr.height);
            trimX = rr.x - tr.x;
            trimY = rr.y - tr.y;
        }
        p.x += c.getLocation().x + trimX;
        p.y += c.getLocation().y + trimY;
    }
    return p;
}
 
源代码2 项目: nebula   文件: GridColumnLayout.java
/**
 * {@inheritDoc}
 */
protected void setColumnWidths(Scrollable tableTree, int[] widths) {
	GridColumn[] columns = ((Grid) tableTree).getColumns();
	for (int i = 0; i < widths.length; i++) {
		columns[i].setWidth(widths[i]);
	}
}
 
源代码3 项目: nebula   文件: ScrollingSmoother.java
/**
 * @param c2
 * @param movement
 */
public ScrollingSmoother(final Scrollable c2, IMovement movement) {
	this.component = c2;
	verticalScrollBar = c2.getVerticalBar();
	horizontalScrollBar = c2.getHorizontalBar();
	this.movement = movement;
}
 
源代码4 项目: birt   文件: AbstractPageFlowLayout.java
protected Result getReportBounds( Rectangle reportSize )
{
	Result revValue = new Result( );
	revValue.reportSize.y = MINTOPSPACE;
	revValue.reportSize.width = reportSize.width;
	revValue.reportSize.height = reportSize.height;

	EditPartViewer viewer = owner.getViewer( );
	Scrollable control = viewer == null ? null : (Scrollable)viewer.getControl( );
	Rectangle containerSize = control == null ? new Rectangle( )
			: new Rectangle( control.getClientArea( ) );

	PrecisionDimension dim = new PrecisionDimension( containerSize.width,
			containerSize.height );

	double scale = getZoomManager( ).getZoom( );
	dim.performScale( 1 / scale );
	if ( dim.width > reportSize.width + MINLEFTSPACE + MINRIGHTSPACE )
	{
		revValue.reportSize.x = ( dim.width - reportSize.width ) / 2;
		revValue.rightSpace = ( dim.width - reportSize.width ) / 2;
	}
	else
	{
		revValue.reportSize.x = MINLEFTSPACE;
		revValue.rightSpace = MINRIGHTSPACE;
	}

	if ( dim.height > reportSize.height + MINTOPSPACE + MINBOTTOMSPACE )
	{
		revValue.bottomSpace = dim.height - reportSize.height
				- revValue.reportSize.y;
	}
	else
	{
		revValue.bottomSpace = MINBOTTOMSPACE;
	}

	return revValue;
}
 
源代码5 项目: nebula   文件: GridColumnLayout.java
/**
 * {@inheritDoc}
 */
protected int getColumnCount(Scrollable tableTree) {
	return ((Grid) tableTree).getColumnCount();
}
 
源代码6 项目: nebula   文件: GridColumnLayout.java
/**
 * {@inheritDoc}
 */
protected ColumnLayoutData getLayoutData(Scrollable tableTree,
		int columnIndex) {
	GridColumn column = ((Grid) tableTree).getColumn(columnIndex);
	return (ColumnLayoutData) column.getData(LAYOUT_DATA);
}
 
源代码7 项目: tlaplus   文件: ErrorTraceTreeViewer.java
TraceDisplayResizer(final Tree resizingTree) {
	tree = resizingTree;
	treeParentComponent = (Scrollable)tree.getParent();
	columns = new TreeColumn[COLUMN_TEXTS.length];
}
 
源代码8 项目: depan   文件: ScrollbarHandler.java
public ScrollbarHandler(Scrollable view, GLScene scene) {
  this.view = view;
  this.scene = scene;
  this.vertBar = view.getVerticalBar();
  this.horizBar = view.getHorizontalBar();
}
 
源代码9 项目: APICloud-Studio   文件: ControlThemer.java
protected void addSelectionColorOverride()
{
	if (controlIsDisposed())
	{
		return;
	}
	// Override selection color to match what is set in theme
	selectionOverride = new Listener()
	{
		public void handleEvent(Event event)
		{
			if (!invasiveThemesEnabled())
			{
				return;
			}
			GC gc = event.gc;
			Color oldBackground = gc.getBackground();
			if ((event.detail & SWT.SELECTED) != 0)
			{
				Scrollable scrollable = (Scrollable) event.widget;
				Rectangle clientArea = scrollable.getClientArea();

				gc.setBackground(getSelection());
				// The +2 on width is for Linux, since clientArea begins at [-2,-2] and
				// without it we don't properly color full width (see broken coloring when scrolling horizontally)
				gc.fillRectangle(clientArea.x, event.y, clientArea.width + 2, event.height);

				event.detail &= ~SWT.SELECTED;
				event.detail &= ~SWT.BACKGROUND;

				gc.setBackground(oldBackground);
			}
			else
			{
				// Draw normal background color. This seems to only be necessary for some variants of Linux,
				// and is the correct way to force custom painting of background when setBackground() doesn't work
				// properly.
				if (!isWindows && !isMacOSX)
				{
					Color controlBG = control.getBackground();
					if (controlBG.getRGB().equals(oldBackground.getRGB()))
					{
						gc.setBackground(getBackground());
						gc.fillRectangle(event.x, event.y, event.width, event.height);
						event.detail &= ~SWT.BACKGROUND;
						gc.setBackground(oldBackground);
					}
				}
			}

			// force foreground color. Otherwise on dark themes we get black FG (all the time on Win, on
			// non-focus for Mac)
			gc.setForeground(getForeground());
		}
	};
	getControl().addListener(SWT.EraseItem, selectionOverride);
}
 
public ClientAreaResizeCommand(Scrollable scrollable) {
	super();
	this.scrollable = scrollable;
}
 
public Scrollable getScrollable() {
	return scrollable;
}
 
源代码12 项目: tmxeditor8   文件: ClientAreaResizeCommand.java
public ClientAreaResizeCommand(Scrollable scrollable) {
	super();
	this.scrollable = scrollable;
}
 
源代码13 项目: tmxeditor8   文件: ClientAreaResizeCommand.java
public Scrollable getScrollable() {
	return scrollable;
}
 
源代码14 项目: nebula   文件: ScrollingSmoother.java
/**
 * Create a Scrolling Smoother instance over a scrollable widget. This
 * effect can then be activated using
 * {@link ScrollingSmoother#smoothControl(boolean)}.
 * 
 * @see ScrollingSmoother#smoothControl(boolean)
 * 
 * @param c2
 * @param movement
 */
public ScrollingSmoother(final Scrollable c2, IMovement movement) {
	this.component = c2;
	verticalScrollBar = c2.getVerticalBar();
	horizontalScrollBar = c2.getHorizontalBar();
	this.movement = movement;
}
 
源代码15 项目: nebula   文件: ScrollingSmoother.java
/**
 * Create a Scrolling Smoother instance over a scrollable widget. This
 * effect can then be activated using
 * {@link ScrollingSmoother#smoothControl(boolean)}.
 * 
 * @see ScrollingSmoother#smoothControl(boolean)
 * 
 * @param c2
 * @param movement
 * @param duration
 */
public ScrollingSmoother(final Scrollable c2, IMovement movement,
		int duration) {
	this(c2, movement);
	this.duration = duration;
}
 
源代码评论
动弹
沙发等你来抢
 类所在包
 类方法
 同包方法