private void moveWidget(int timeDelta) {
    final Point currentPosition = new Point(widget.getPosition());

    if (currentPosition.equals(endPosition)) {
      // end reached remove actor.
      unHook(widget);
    } else {
      // move widget
      // todo: make framerate independent
      // use time as base to calc movement speed. So someone will tell
      // that it
      // should take 1sec from A to B. More space between A and B means
      // faster movement.

      translate(currentPosition, endPosition, movementSpeed);
      widget.setPosition(currentPosition);
    }
  }
  public void hook(IWidget widget) {
    final Display display = widget.getDisplay();

    if (this.display != null && this.display != display) {
      throw new IllegalArgumentException("Widget needs to be on same display");
    } else {
      if (display == null) {
        throw new IllegalArgumentException("Widget needs to be in the widgettree.");
      }

      this.display = display;
      this.widget = widget;
      display.addGlobalEventListener(listener);
    }
  }
Пример #3
0
 public boolean isDndWidget(IWidget w, int x, int y) {
   // If the over widget is title or titleBar it's ok to drag the window
   return w.equals(title) || w.equals(titleBar);
 }