コード例 #1
0
        /// <summary>
        /// Method that handles keyboard events.
        /// </summary>
        /// <param name="key">The current key that was pressed or released.</param>
        /// <param name="pressed">Flagthat indicates if key was pressed or released.</param>
        /// <returns>True if the key was handled and shouldn't be passed on to the underlaying elements.</returns>
        public bool OnKey(Purple.Input.Key key, bool pressed)
        {
            ArrayList cloned = (ArrayList)list.Clone();

            for (int i = cloned.Count - 1; i >= 0; i--)
            {
                IGuiElement element = (cloned[i] as IGuiElement);
                if (element.Enabled && element.OnKey(key, pressed))
                {
                    return(true);
                }
            }
            return(false);
        }