Пример #1
0
        public override bool MouseEvent(MouseEvent me)
        {
            if (!host.handled && !host.HandleGrabView(me, this))
            {
                return(false);
            }
            host.handled = false;
            bool disabled;

            if (me.Flags == MouseFlags.Button1Pressed || me.Flags == MouseFlags.Button1DoubleClicked)
            {
                disabled = false;
                if (me.Y < 1)
                {
                    return(true);
                }
                var meY = me.Y - 1;
                if (meY >= barItems.Children.Length)
                {
                    return(true);
                }
                var item = barItems.Children [meY];
                if (item == null || !item.IsEnabled())
                {
                    disabled = true;
                }
                if (item != null && !disabled)
                {
                    Run(barItems.Children [meY].Action);
                }
                return(true);
            }
            else if (me.Flags == MouseFlags.Button1Pressed || me.Flags == MouseFlags.Button1DoubleClicked ||
                     me.Flags == MouseFlags.ReportMousePosition)
            {
                disabled = false;
                if (me.Y < 1)
                {
                    return(true);
                }
                if (me.Y - 1 >= barItems.Children.Length)
                {
                    return(true);
                }
                var item = barItems.Children [me.Y - 1];
                if (item == null || !item.IsEnabled())
                {
                    disabled = true;
                }
                if (item != null && !disabled)
                {
                    current = me.Y - 1;
                }
                HasFocus = true;
                SetNeedsDisplay();
                CheckSubMenu();
                return(true);
            }
            return(false);
        }