示例#1
0
 public void onBackKeyPressEvent()
 {
     if (!(keyEvent != null))
     {
         keyEvent = new cave.KeyEvent();
     }
     keyEvent.clear();
     keyEvent.setAction(cave.KeyEvent.ACTION_DOWN);
     keyEvent.setKeyCode(cave.KeyEvent.KEY_BACK);
     deliverKeyEventToWidget(keyEvent, getWidget());
 }
 public virtual void onKeyEvent(cave.KeyEvent @event)
 {
     if (@event.isKeyPress(cave.KeyEvent.KEY_BACK))
     {
         if (widgetStack != null && widgetStack.getSize() > 1)
         {
             if (popWidget() != null)
             {
                 @event.consume();
             }
         }
     }
 }
 public override void onKeyEvent(cave.KeyEvent @event)
 {
     if (keyListeners != null)
     {
         var n = 0;
         var m = keyListeners.Count;
         for (n = 0; n < m; n++)
         {
             var keyListener = keyListeners[n];
             if (keyListener != null)
             {
                 keyListener.onKeyEvent(@event);
                 if (@event.isConsumed)
                 {
                     break;
                 }
             }
         }
     }
 }
示例#4
0
        public void deliverKeyEventToWidget(cave.KeyEvent @event, Windows.UI.Xaml.UIElement widget)
        {
            if (!(widget != null))
            {
                return;
            }
            var array = cave.ui.Widget.getChildren(widget);

            if (array != null)
            {
                var n = 0;
                var m = array.Count;
                for (n = 0; n < m; n++)
                {
                    var child = array[n];
                    if (child != null)
                    {
                        deliverKeyEventToWidget(@event, child);
                        if (@event.isConsumed)
                        {
                            return;
                        }
                    }
                }
            }
            var kl = widget as cave.KeyListener;

            if (kl != null)
            {
                kl.onKeyEvent(@event);
                if (@event.isConsumed)
                {
                    return;
                }
            }
        }
示例#5
0
 public virtual void onKeyEvent(cave.KeyEvent @event)
 {
 }