org.eclipse.swt.widgets.Composite#getLocation ( )源码实例Demo

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

源代码1 项目: hop   文件: HopGuiPipelineGraph.java
public Point getRealPosition( Composite canvas, int x, int y ) {
  Point p = new Point( 0, 0 );
  Composite follow = canvas;
  while ( follow != null ) {
    org.eclipse.swt.graphics.Point loc = follow.getLocation();
    Point xy = new Point( loc.x, loc.y );
    p.x += xy.x;
    p.y += xy.y;
    follow = follow.getParent();
  }

  int offsetX = -16;
  int offsetY = -64;
  if ( Const.isOSX() ) {
    offsetX = -2;
    offsetY = -24;
  }
  p.x = x - p.x + offsetX;
  p.y = y - p.y + offsetY;

  return screen2real( p.x, p.y );
}
 
源代码2 项目: birt   文件: UIHelper.java
/**
 * This is a helper method created to get the location on screen of a
 * composite. It does not take into account multiple monitors.
 * 
 * @param cmpTarget
 *            The composite whose location on screen is required
 * @return The location of the composite on screen.
 */
public static Point getScreenLocation( Composite cmpTarget )
{
	Point ptScreen = new Point( 0, 0 );
	try
	{
		Composite cTmp = cmpTarget;
		while ( !( cTmp instanceof Shell ) )
		{
			ptScreen.x += cTmp.getLocation( ).x;
			ptScreen.y += cTmp.getLocation( ).y;
			cTmp = cTmp.getParent( );
		}
	}
	catch ( Exception e )
	{
		logger.log( e );
	}
	return cmpTarget.getShell( ).toDisplay( ptScreen );
}
 
源代码3 项目: birt   文件: UIHelper.java
/**
 * This is a helper method created to get the location on screen of a
 * composite. It does not take into account multiple monitors.
 * 
 * @param cmpTarget
 *            The composite whose location on screen is required
 * @return The location of the composite on screen.
 */
public static Point getScreenLocation( Composite cmpTarget )
{
	Point ptScreen = new Point( 0, 0 );
	try
	{
		Composite cTmp = cmpTarget;
		while ( !( cTmp instanceof Shell ) )
		{
			ptScreen.x += cTmp.getLocation( ).x;
			ptScreen.y += cTmp.getLocation( ).y;
			cTmp = cTmp.getParent( );
		}
	}
	catch ( Exception e )
	{
		WizardBase.displayException( e );
	}
	return cmpTarget.getShell( ).toDisplay( ptScreen );
}
 
源代码4 项目: pentaho-kettle   文件: TransGraph.java
public Point getRealPosition( Composite canvas, int x, int y ) {
  Point p = new Point( 0, 0 );
  Composite follow = canvas;
  while ( follow != null ) {
    org.eclipse.swt.graphics.Point loc = follow.getLocation();
    Point xy = new Point( loc.x, loc.y );
    p.x += xy.x;
    p.y += xy.y;
    follow = follow.getParent();
  }

  int offsetX = -16;
  int offsetY = -64;
  if ( Const.isOSX() ) {
    offsetX = -2;
    offsetY = -24;
  }
  p.x = x - p.x + offsetX;
  p.y = y - p.y + offsetY;

  return screen2real( p.x, p.y );
}
 
源代码5 项目: hop   文件: HopGuiWorkflowGraph.java
public Point getRealPosition( Composite canvas, int x, int y ) {
  Point p = new Point( 0, 0 );
  Composite follow = canvas;
  while ( follow != null ) {
    Point xy = new Point( follow.getLocation().x, follow.getLocation().y );
    p.x += xy.x;
    p.y += xy.y;
    follow = follow.getParent();
  }

  p.x = x - p.x - 8;
  p.y = y - p.y - 48;

  return screen2real( p.x, p.y );
}
 
源代码6 项目: uima-uimaj   文件: AbstractSection.java
/**
 * Gets the absolute location.
 *
 * @param control the control
 * @param x the x
 * @param y the y
 * @return the absolute location
 */
private Point getAbsoluteLocation(Control control, int x, int y) {
  Point point = new Point(x, y);
  Composite composite = control.getParent();
  while (composite != null) {
    point.x += composite.getLocation().x;
    point.y += composite.getLocation().y;
    composite = composite.getParent();
  }
  return point;
}
 
源代码7 项目: pentaho-kettle   文件: JobGraph.java
public Point getRealPosition( Composite canvas, int x, int y ) {
  Point p = new Point( 0, 0 );
  Composite follow = canvas;
  while ( follow != null ) {
    Point xy = new Point( follow.getLocation().x, follow.getLocation().y );
    p.x += xy.x;
    p.y += xy.y;
    follow = follow.getParent();
  }

  p.x = x - p.x - 8;
  p.y = y - p.y - 48;

  return screen2real( p.x, p.y );
}