コード例 #1
0
  void setParent(ControllerGroup<?> theParent) {
    if (_myParent != null && _myParent != this) {
      _myParent.remove(this);
    }

    _myParent = theParent;

    if (_myParent != this) {
      _myParent.add(this);
    }
    absolutePosition = new PVector(position.x, position.y);

    absolutePosition.add(_myParent.absolutePosition);

    positionBuffer = new PVector(position.x, position.y);

    _myControlWindow = _myParent.getWindow();

    for (int i = 0; i < controllers.size(); i++) {
      if (controllers.get(i) instanceof Controller<?>) {
        ((Controller<?>) controllers.get(i))._myControlWindow = _myControlWindow;
      } else {
        ((ControllerGroup<?>) controllers.get(i))._myControlWindow = _myControlWindow;
      }
    }
    if (_myControlWindow != null) {
      setMouseOver(false);
    }
  }
コード例 #2
0
  /** removes the group from controlP5. */
  public void remove() {
    _myControlWindow.removeMouseOverFor(this);
    if (_myParent != null) {
      _myParent.remove(this);
    }
    if (cp5 != null) {
      cp5.remove(this);
    }

    for (int i = controllers.size() - 1; i >= 0; i--) {
      controllers.get(i).remove();
    }
    controllers.clear();
    controllers.clearDrawable();
    controllers = new ControllerList();
    if (this instanceof Tab) {
      _myControlWindow.removeTab((Tab) this);
    }
  }