Esempio n. 1
0
 public boolean type(char key, KeyEvent ev) {
   if (canactivate) {
     if (key == 10) {
       wdgmsg("activate");
       return (true);
     }
   }
   if (cancancel) {
     if (key == 27) {
       wdgmsg("cancel");
       return (true);
     }
   }
   if (focusctl) {
     if (focused != null) {
       if (focused.type(key, ev)) return (true);
       if (focustab) {
         if (key == '\t' && !Config.agroclosest) {
           Widget f = focused;
           while (true) {
             if ((ev.getModifiers() & InputEvent.SHIFT_MASK) == 0) {
               Widget n = f.rnext();
               f = ((n == null) || !n.hasparent(this)) ? child : n;
             } else {
               Widget p = f.rprev();
               f = ((p == null) || !p.hasparent(this)) ? lchild : p;
             }
             if (f.canfocus) break;
           }
           setfocus(f);
           return (true);
         } else {
           return (false);
         }
       } else {
         return (false);
       }
     } else {
       return (false);
     }
   } else {
     for (Widget wdg = child; wdg != null; wdg = wdg.next) {
       if (wdg.visible) {
         if (wdg.type(key, ev)) return (true);
       }
     }
     return (false);
   }
 }
 public void type(KeyEvent ev) {
   setmods(ev);
   if (keygrab == null) {
     if (!root.type(ev.getKeyChar(), ev)) root.globtype(ev.getKeyChar(), ev);
   } else {
     keygrab.type(ev.getKeyChar(), ev);
   }
 }