Exemplo n.º 1
0
        public override void OnMouseDown(MouseButtonEventArgs e)
        {
            if (!Visible || !Enabled)
            {
                return;
            }

            HideTooltip();

            Widget c = this.HitTest(e.X, e.Y);

            if (c == null || !Overlays.Contains(c))
            {
                int overlayCount = Overlays.Count;
                if (!Overlays.OfType <IOverlayWidget> ().Any(ov => ov.OverlayMode == OverlayModes.Modal))
                {
                    Overlays.OfType <IOverlayWidget> ().ToList().ForEach(ov => ov.OnClose());
                    if (Overlays.Count != overlayCount)
                    {
                        if (FocusedWidget != null && FocusedWidget.IsOverlay)
                        {
                            FocusedWidget = null;
                        }
                        Invalidate();
                        return;
                    }
                }
            }

            if (!c.IsDisposed && c != m_LastMouseDownWidget)
            {
                m_LastMouseDownWidget = c;
                if (c != null)
                {
                    if (c != FocusedWidget)
                    {
                        c.Focus();
                    }
                    c.InvokeMouseDown(e);
                }
            }
        }