Пример #1
0
 /*
  * Delete a matching MenuShortcut associated with this MenuItem.
  * Used when iterating Menus.
  */
 internal virtual void DeleteShortcut(MenuShortcut s)
 {
     if (s.Equals(Shortcut_Renamed))
     {
         Shortcut_Renamed = null;
         MenuItemPeer peer = (MenuItemPeer)this.Peer_Renamed;
         if (peer != null)
         {
             peer.Label = Label_Renamed;
         }
     }
 }
Пример #2
0
        /*
         * Post an ActionEvent to the target (on
         * keydown) and the item is enabled.
         * Returns true if there is an associated shortcut.
         */
        internal virtual bool HandleShortcut(KeyEvent e)
        {
            MenuShortcut s  = new MenuShortcut(e.KeyCode, (e.Modifiers & InputEvent.SHIFT_MASK) > 0);
            MenuShortcut sE = new MenuShortcut(e.ExtendedKeyCode, (e.Modifiers & InputEvent.SHIFT_MASK) > 0);

            // Fix For 6185151: Menu shortcuts of all menuitems within a menu
            // should be disabled when the menu itself is disabled
            if ((s.Equals(Shortcut_Renamed) || sE.Equals(Shortcut_Renamed)) && ItemEnabled)
            {
                // MenuShortcut match -- issue an event on keydown.
                if (e.ID == KeyEvent.KEY_PRESSED)
                {
                    DoMenuEvent(e.When, e.Modifiers);
                }
                else
                {
                    // silently eat key release.
                }
                return(true);
            }
            return(false);
        }
Пример #3
0
 internal virtual MenuItem GetShortcutMenuItem(MenuShortcut s)
 {
     return((s.Equals(Shortcut_Renamed)) ? this : null);
 }