示例#1
0
 internal virtual IEnumerator <MenuShortcut> Shortcuts()
 {
     lock (this)
     {
         List <MenuShortcut> shortcuts = new List <MenuShortcut>();
         int nitems = ItemCount;
         for (int i = 0; i < nitems; i++)
         {
             MenuItem mi = GetItem(i);
             if (mi is Menu)
             {
                 IEnumerator <MenuShortcut> e = ((Menu)mi).Shortcuts();
                 while (e.MoveNext())
                 {
                     shortcuts.Add(e.Current);
                 }
             }
             else
             {
                 MenuShortcut ms = mi.Shortcut;
                 if (ms != null)
                 {
                     shortcuts.Add(ms);
                 }
             }
         }
         return(shortcuts.elements());
     }
 }
示例#2
0
        internal override void DeleteShortcut(MenuShortcut s)
        {
            int nitems = ItemCount;

            for (int i = 0; i < nitems; i++)
            {
                GetItem(i).DeleteShortcut(s);
            }
        }
示例#3
0
        /// <summary>
        /// Deletes the specified menu shortcut. </summary>
        /// <param name="s"> the menu shortcut to delete.
        /// @since     JDK1.1 </param>
        public virtual void DeleteShortcut(MenuShortcut s)
        {
            int nmenus = MenuCount;

            for (int i = 0; i < nmenus; i++)
            {
                GetMenu(i).DeleteShortcut(s);
            }
        }
示例#4
0
        /// <summary>
        /// Delete any <code>MenuShortcut</code> object associated
        /// with this menu item.
        /// @since      JDK1.1
        /// </summary>
        public virtual void DeleteShortcut()
        {
            Shortcut_Renamed = null;
            MenuItemPeer peer = (MenuItemPeer)this.Peer_Renamed;

            if (peer != null)
            {
                peer.Label = Label_Renamed;
            }
        }
示例#5
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;
         }
     }
 }
示例#6
0
        internal override MenuItem GetShortcutMenuItem(MenuShortcut s)
        {
            int nitems = ItemCount;

            for (int i = 0; i < nitems; i++)
            {
                MenuItem mi = GetItem(i).GetShortcutMenuItem(s);
                if (mi != null)
                {
                    return(mi);
                }
            }
            return(null);
        }
示例#7
0
        /// <summary>
        /// Gets the instance of <code>MenuItem</code> associated
        /// with the specified <code>MenuShortcut</code> object,
        /// or <code>null</code> if none of the menu items being managed
        /// by this menu bar is associated with the specified menu
        /// shortcut. </summary>
        /// <param name="s"> the specified menu shortcut. </param>
        /// <seealso cref=          java.awt.MenuItem </seealso>
        /// <seealso cref=          java.awt.MenuShortcut
        /// @since        JDK1.1 </seealso>
        public virtual MenuItem GetShortcutMenuItem(MenuShortcut s)
        {
            int nmenus = MenuCount;

            for (int i = 0; i < nmenus; i++)
            {
                MenuItem mi = GetMenu(i).GetShortcutMenuItem(s);
                if (mi != null)
                {
                    return(mi);
                }
            }
            return(null);            // MenuShortcut wasn't found
        }
示例#8
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);
        }
示例#9
0
 /// <summary>
 /// Create a menu item with an associated keyboard shortcut.
 /// </summary>
 public MenuItem(string @label, MenuShortcut @s)
 {
 }
示例#10
0
 internal virtual MenuItem GetShortcutMenuItem(MenuShortcut s)
 {
     return((s.Equals(Shortcut_Renamed)) ? this : null);
 }
示例#11
0
 /// <summary>
 /// Gets the instance of <code>MenuItem</code> associated
 /// with the specified <code>MenuShortcut</code> object,
 /// or <code>null</code> if none of the menu items being managed
 /// by this menu bar is associated with the specified menu
 /// shortcut.
 /// </summary>
 public MenuItem getShortcutMenuItem(MenuShortcut @s)
 {
     return(default(MenuItem));
 }
示例#12
0
 /// <summary>
 /// Returns whether this MenuShortcut is the same as another:
 /// equality is defined to mean that both MenuShortcuts use the same key
 /// and both either use or don't use the SHIFT key.
 /// </summary>
 public bool equals(MenuShortcut @s)
 {
     return(default(bool));
 }
		/// <summary>
		/// Returns whether this MenuShortcut is the same as another:
		/// equality is defined to mean that both MenuShortcuts use the same key
		/// and both either use or don't use the SHIFT key.
		/// </summary>
		public bool equals(MenuShortcut @s)
		{
			return default(bool);
		}
示例#14
0
 /// <summary>
 /// Deletes the specified menu shortcut.
 /// </summary>
 public void deleteShortcut(MenuShortcut @s)
 {
 }
示例#15
0
		/// <summary>
		/// Create a menu item with an associated keyboard shortcut.
		/// </summary>
		public MenuItem(string @label, MenuShortcut @s)
		{
		}
示例#16
0
		/// <summary>
		/// Set the <code>MenuShortcut</code> object associated with this
		/// menu item.
		/// </summary>
		public void setShortcut(MenuShortcut @s)
		{
		}
示例#17
0
 /// <summary>
 /// Set the <code>MenuShortcut</code> object associated with this
 /// menu item.
 /// </summary>
 public void setShortcut(MenuShortcut @s)
 {
 }
示例#18
0
		/// <summary>
		/// Deletes the specified menu shortcut.
		/// </summary>
		public void deleteShortcut(MenuShortcut @s)
		{
		}
示例#19
0
        /// <summary>
        /// Create a menu item with an associated keyboard shortcut.
        /// Note that use of "-" in a label is reserved to indicate
        /// a separator between menu items. By default, all menu
        /// items except for separators are enabled. </summary>
        /// <param name="label"> the label for this menu item. </param>
        /// <param name="s"> the instance of <code>MenuShortcut</code>
        ///                       associated with this menu item. </param>
        /// <exception cref="HeadlessException"> if GraphicsEnvironment.isHeadless()
        /// returns true. </exception>
        /// <seealso cref= java.awt.GraphicsEnvironment#isHeadless
        /// @since       JDK1.1 </seealso>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public MenuItem(String label, MenuShortcut s) throws HeadlessException
        public MenuItem(String label, MenuShortcut s)
        {
            this.Label_Renamed    = label;
            this.Shortcut_Renamed = s;
        }
示例#20
0
		/// <summary>
		/// Gets the instance of <code>MenuItem</code> associated
		/// with the specified <code>MenuShortcut</code> object,
		/// or <code>null</code> if none of the menu items being managed
		/// by this menu bar is associated with the specified menu
		/// shortcut.
		/// </summary>
		public MenuItem getShortcutMenuItem(MenuShortcut @s)
		{
			return default(MenuItem);
		}
示例#21
0
 /// <summary>
 /// Returns whether this MenuShortcut is the same as another:
 /// equality is defined to mean that both MenuShortcuts use the same key
 /// and both either use or don't use the SHIFT key. </summary>
 /// <param name="s"> the MenuShortcut to compare with this. </param>
 /// <returns> <code>true</code> if this MenuShortcut is the same as another,
 /// <code>false</code> otherwise.
 /// @since JDK1.1 </returns>
 public virtual bool Equals(MenuShortcut s)
 {
     return(s != null && (s.Key == Key_Renamed) && (s.UsesShiftModifier() == UsesShift));
 }