Exemple #1
0
 public void onActivate(boolean activate_or_deactivate) {
   if (!canDeliverEvents()) return;
   Dispatch2 owner = mOwner.get();
   if (owner != null) {
     // re-check the window activate state
     if (getWindowActive() == activate_or_deactivate) {
       if (activate_or_deactivate)
         TVP.EventManager.postEvent(
             owner, owner, "onActivate", 0, EventManager.EPT_IMMEDIATE, TJS.NULL_ARG);
       else
         TVP.EventManager.postEvent(
             owner, owner, "onDeactivate", 0, EventManager.EPT_IMMEDIATE, TJS.NULL_ARG);
     }
   }
 }
Exemple #2
0
 public void fireOnActivate(boolean activate_or_deactivate) {
   // fire Window.onActivate or Window.onDeactivate event
   TVP.EventManager.postInputEvent(
       new WindowEvents.OnWindowActivateEvent(this, activate_or_deactivate),
       EventManager.EPT_REMOVE_POST);
   // to discard redundant events
 }
Exemple #3
0
 public void onOrientationChanged() {
   if (!canDeliverEvents()) return;
   Dispatch2 owner = mOwner.get();
   if (owner != null) {
     TVP.EventManager.postEvent(
         owner, owner, "onOrientationChanged", 0, EventManager.EPT_IMMEDIATE, TJS.NULL_ARG);
   }
 }
Exemple #4
0
 public void onFileDrop(final Variant array) {
   if (!canDeliverEvents()) return;
   Dispatch2 owner = mOwner.get();
   if (owner != null) {
     Variant[] arg = new Variant[1];
     arg[0] = array;
     TVP.EventManager.postEvent(owner, owner, "onFileDrop", 0, EventManager.EPT_IMMEDIATE, arg);
   }
 }
Exemple #5
0
 public void onClose() {
   if (!canDeliverEvents()) return;
   Dispatch2 owner = mOwner.get();
   if (owner != null) {
     Variant[] arg = new Variant[1];
     arg[0] = new Variant(1); // true
     TVP.EventManager.postEvent(owner, owner, "onCloseQuery", 0, EventManager.EPT_IMMEDIATE, arg);
   }
 }
Exemple #6
0
  public void onKeyPress(char key) {
    if (!canDeliverEvents()) return;
    Dispatch2 owner = mOwner.get();
    if (owner != null) {
      Variant[] arg = new Variant[1];
      arg[0] = new Variant(String.valueOf(key));
      TVP.EventManager.postEvent(owner, owner, "onKeyPress", 0, EventManager.EPT_IMMEDIATE, arg);
    }

    LayerManager manager = getLayerManagerAt(mPrimaryLayerManagerIndex);
    if (manager == null) return;
    manager.notifyKeyPress(key);
  }
Exemple #7
0
  public void onKeyUp(int key, int shift) {
    if (!canDeliverEvents()) return;
    Dispatch2 owner = mOwner.get();
    if (owner != null) {
      Variant[] arg = new Variant[2];
      arg[0] = new Variant(key);
      arg[1] = new Variant(shift);
      TVP.EventManager.postEvent(owner, owner, "onKeyUp", 0, EventManager.EPT_IMMEDIATE, arg);
    }

    LayerManager manager = getLayerManagerAt(mPrimaryLayerManagerIndex);
    if (manager == null) return;
    manager.notifyKeyUp(key, shift);
  }
Exemple #8
0
  public void onDoubleClick(int x, int y) throws TJSException {
    if (!canDeliverEvents()) return;
    Dispatch2 owner = mOwner.get();
    if (owner != null) {
      Variant[] arg = new Variant[2];
      arg[0] = new Variant(x);
      arg[1] = new Variant(y);
      TVP.EventManager.postEvent(owner, owner, "onDoubleClick", 0, EventManager.EPT_IMMEDIATE, arg);
    }

    Point pos = new Point(x, y);
    if (!transformToPrimaryLayerManager(pos)) return;
    LayerManager manager = getLayerManagerAt(mPrimaryLayerManagerIndex);
    if (manager == null) return;
    manager.notifyDoubleClick(pos.x, pos.y);
  }
Exemple #9
0
  public void onMouseWheel(int shift, int delta, int x, int y) {
    if (!canDeliverEvents()) return;
    Dispatch2 owner = mOwner.get();
    if (owner != null) {
      Variant[] arg = new Variant[4];
      arg[0] = new Variant(shift);
      arg[1] = new Variant(delta);
      arg[2] = new Variant(x);
      arg[3] = new Variant(y);
      TVP.EventManager.postEvent(owner, owner, "onMouseWheel", 0, EventManager.EPT_IMMEDIATE, arg);
    }

    Point pos = new Point(x, y);
    if (!transformToPrimaryLayerManager(pos)) return;
    LayerManager manager = getLayerManagerAt(mPrimaryLayerManagerIndex);
    if (manager == null) return;
    manager.notifyMouseWheel(shift, delta, pos.x, pos.y);
  }
Exemple #10
0
  public void requestUpdate() {
    // is called from primary layer

    // post update event to self
    TVP.EventManager.postWindowUpdate((WindowNI) this);
  }
Exemple #11
0
 public void postReleaseCaptureEvent() {
   TVP.EventManager.postInputEvent(new WindowEvents.OnReleaseCaptureInputEvent(this), 0);
 }
Exemple #12
0
 public void clearInputEvents() {
   TVP.EventManager.cancelInputEvents(this);
 }
Exemple #13
0
 /** 画面の向きが変更された時、イベントを発行する */
 public void fireOnOrientationChanged() {
   // fire Window.onOrientationChanged
   TVP.EventManager.postInputEvent(
       new WindowEvents.OnOrientationChangedEvent(this), EventManager.EPT_REMOVE_POST);
 }
Exemple #14
0
  public void invalidate() throws VariantException, TJSException {
    // remove from list
    TVP.WindowList.unregisterWindowToList((WindowNI) this);

    // remove all events
    TVP.EventManager.cancelSourceEvents(mOwner.get());
    TVP.EventManager.cancelInputEvents(this);

    // clear all window update events
    TVP.EventManager.removeWindowUpdate(this);

    // free DrawBuffer
    // if( mDrawBuffer != null ) mDrawBuffer = null;

    // disconnect all VideoOverlay objects
    try {
      mVideoOverlay.safeLock();
      int count = mVideoOverlay.getSafeLockedObjectCount();
      for (int i = 0; i < count; i++) {
        VideoOverlayNI item = mVideoOverlay.getSafeLockedObjectAt(i);
        if (item == null) continue;
        item.disconnect();
      }
    } finally {
      mVideoOverlay.safeUnlock();
    }

    // invalidate all registered objects
    mObjectVectorLocked = true;
    final int count = mObjectVector.size();
    for (int i = 0; i < count; i++) {
      // invalidate each --
      // objects may throw an exception while invalidating,
      // but here we cannot care for them.
      VariantClosure clo = mObjectVector.get(i);
      try {
        clo.invalidate(0, null, null);
        clo = null;
      } catch (TJSException e) {
        DebugClass.addLog(e.getMessage()); // just in case, log the error
      }
    }

    // invalidate menu object
    if (mMenuItemObject != null) {
      mMenuItemObject.invalidate(0, null, mMenuItemObject);
      mMenuItemObject = null;
    }

    // remove all events (again)
    // TVPCancelSourceEvents( mOwner );
    // TVPCancelInputEvents( this );

    // clear all window update events (again)
    // TVPRemoveWindowUpdate( this );

    // release draw device
    // setDrawDeviceObject( new Variant() );

    super.invalidate();
    /* NOTE: at this point, Owner is still non-null.
    Caller must ensure that the Owner being null at the end of the
    invalidate chain. */

    if (mForm != null) {
      mForm.invalidateClose();
      mForm = null;
    }

    // remove all events
    TVP.EventManager.cancelSourceEvents(mOwner.get());
    TVP.EventManager.cancelInputEvents(this);

    // Set Owner null
    mOwner.clear();
  }