org.eclipse.swt.widgets.Tree.toControl()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(116)

本文整理了Java中org.eclipse.swt.widgets.Tree.toControl()方法的一些代码示例,展示了Tree.toControl()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Tree.toControl()方法的具体详情如下:
包路径:org.eclipse.swt.widgets.Tree
类名称:Tree
方法名:toControl

Tree.toControl介绍

暂无

代码示例

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples

private File getTargetFile(DropTargetEvent event) {
    // Determine the target File for the drop
    TreeItem item = tree.getItem(tree.toControl(new Point(event.x, event.y)));
    File targetFile = null;
    if (item != null) {
      // We are over a particular item in the tree, use the item's file
      targetFile = (File) item.getData(TREEITEMDATA_FILE);
    }
    return targetFile;
  }
});

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples

@Override
  protected void specialPopupMenuItems(Menu menu, Event event) {
    MenuItem item = new MenuItem(menu, SWT.PUSH);
    item.setText("getItem(Point) on mouse coordinates");
    final Tree t = (Tree) event.widget;
    menuMouseCoords = t.toControl(new Point(event.x, event.y));
    item.addSelectionListener(widgetSelectedAdapter(e -> {
      eventConsole.append ("getItem(Point(" + menuMouseCoords + ")) returned: " + t.getItem(menuMouseCoords));
      eventConsole.append ("\n");
    }));
  }
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86

Widget getItem(Tree tree, int x, int y) {
  Point point = new Point(x, y);
  point = tree.toControl(point);
  TreeItem item = tree.getItem(point);
  if (item == null) {
    Rectangle area = tree.getClientArea();
    if (area.contains(point)) {
      int treeBottom = area.y + area.height;
      item = tree.getTopItem();
      while (item != null) {
        Rectangle rect = item.getBounds();
        int itemBottom = rect.y + rect.height;
        if (rect.y <= point.y && point.y < itemBottom) return item;
        if (itemBottom > treeBottom) break;
        item = nextItem(tree, item);
      }
      return null;
    }
  }
  return item;
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc

Widget getItem(Tree tree, int x, int y) {
  Point point = new Point(x, y);
  point = tree.toControl(point);
  TreeItem item = tree.getItem(point);
  if (item == null) {
    Rectangle area = tree.getClientArea();
    if (area.contains(point)) {
      int treeBottom = area.y + area.height;
      item = tree.getTopItem();
      while (item != null) {
        Rectangle rect = item.getBounds();
        int itemBottom = rect.y + rect.height;
        if (rect.y <= point.y && point.y < itemBottom) return item;
        if (itemBottom > treeBottom) break;
        item = nextItem(tree, item);
      }
      return null;
    }
  }
  return item;
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc

Widget getItem(Tree tree, int x, int y) {
  Point point = new Point(x, y);
  point = tree.toControl(point);
  TreeItem item = tree.getItem(point);
  if (item == null) {
    Rectangle area = tree.getClientArea();
    if (area.contains(point)) {
      int treeBottom = area.y + area.height;
      item = tree.getTopItem();
      while (item != null) {
        Rectangle rect = item.getBounds();
        int itemBottom = rect.y + rect.height;
        if (rect.y <= point.y && point.y < itemBottom) return item;
        if (itemBottom > treeBottom) break;
        item = nextItem(tree, item);
      }
      return null;
    }
  }
  return item;
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x

Widget getItem(Tree tree, int x, int y) {
  Point point = new Point(x, y);
  point = tree.toControl(point);
  TreeItem item = tree.getItem(point);
  if (item == null) {
    Rectangle area = tree.getClientArea();
    if (area.contains(point)) {
      int treeBottom = area.y + area.height;
      item = tree.getTopItem();
      while (item != null) {
        Rectangle rect = item.getBounds();
        int itemBottom = rect.y + rect.height;
        if (rect.y <= point.y && point.y < itemBottom) return item;
        if (itemBottom > treeBottom) break;
        item = nextItem(tree, item);
      }
      return null;
    }
  }
  return item;
}

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt

Widget getItem(Tree tree, int x, int y) {
  Point point = new Point(x, y);
  point = tree.toControl(point);
  TreeItem item = tree.getItem(point);
  if (item == null) {
    Rectangle area = tree.getClientArea();
    if (area.contains(point)) {
      int treeBottom = area.y + area.height;
      item = tree.getTopItem();
      while (item != null) {
        Rectangle rect = item.getBounds();
        int itemBottom = rect.y + rect.height;
        if (rect.y <= point.y && point.y < itemBottom) return item;
        if (itemBottom > treeBottom) break;
        item = nextItem(tree, item);
      }
      return null;
    }
  }
  return item;
}

代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64

Widget getItem(Tree tree, int x, int y) {
  Point point = new Point(x, y);
  point = tree.toControl(point);
  TreeItem item = tree.getItem(point);
  if (item == null) {
    Rectangle area = tree.getClientArea();
    if (area.contains(point)) {
      int treeBottom = area.y + area.height;
      item = tree.getTopItem();
      while (item != null) {
        Rectangle rect = item.getBounds();
        int itemBottom = rect.y + rect.height;
        if (rect.y <= point.y && point.y < itemBottom) return item;
        if (itemBottom > treeBottom) break;
        item = nextItem(tree, item);
      }
      return null;
    }
  }
  return item;
}

代码示例来源:origin: BiglySoftware/BiglyBT

@Override
  public void menuShown(MenuEvent e) {
    Utils.disposeSWTObjects(menuTree.getItems());
    bShown = true;
    Point ptMouse = tree.toControl(e.display.getCursorLocation());
    int indent = END_INDENT ? tree.getClientArea().width - 1 : 0;
    TreeItem treeItem = tree.getItem(new Point(indent, ptMouse.y));
    if (treeItem == null) {
      return;
    }
    SideBarEntrySWT entry = (SideBarEntrySWT) treeItem.getData("MdiEntry");
    fillMenu(menuTree, entry, "sidebar");
    if (menuTree.getItemCount() == 0) {
      Utils.execSWTThreadLater(0, new AERunnable() {
        @Override
        public void runSupport() {
          menuTree.setVisible(false);
        }
      });
    }
  }
});

代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.workbench

clientArea), tree.toControl(cursorLocation));
if (result != null) {
  result.x = result.x + getAvarageCharWith(tree) * CHAR_INDENT;

代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui

tree.toControl(cursorLocation));
if (result != null)
  result.x= result.x + getAvarageCharWith(tree) * CHAR_INDENT;

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x

coordinates = DPIUtil.autoScaleUp(tree.toControl(coordinates));
long /*int*/ [] path = new long /*int*/ [1];
OS.gtk_tree_view_get_path_at_pos (handle, coordinates.x, coordinates.y, path, null, null, null);

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc

coordinates = DPIUtil.autoScaleUp(tree.toControl(coordinates));
int /*long*/ [] path = new int /*long*/ [1];
OS.gtk_tree_view_get_path_at_pos (handle, coordinates.x, coordinates.y, path, null, null, null);

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc

coordinates = DPIUtil.autoScaleUp(tree.toControl(coordinates));
int /*long*/ [] path = new int /*long*/ [1];
OS.gtk_tree_view_get_path_at_pos (handle, coordinates.x, coordinates.y, path, null, null, null);

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86

int /*long*/ handle = tree.handle;
Point coordinates = new Point(event.x, event.y);
coordinates = DPIUtil.autoScaleUp(tree.toControl(coordinates)); // To Pixels
TVHITTESTINFO lpht = new TVHITTESTINFO ();
lpht.x = coordinates.x;

代码示例来源:origin: org.eclipse/org.eclipse.wst.common.ui

Point point = tree.toControl(new Point(event.x, event.y));
Rectangle bounds = tree.getClientArea();

代码示例来源:origin: BiglySoftware/BiglyBT

Point cursorLocation = tree.toControl(event.display.getCursorLocation());
if (lastCloseAreaClicked != null && lastCloseAreaClicked.contains(cursorLocation.x, cursorLocation.y)) {
  return;

相关文章

Tree类方法