Ejemplo n.º 1
0
        public override Element2D GetSelfOrDependantAtPoint(int x, int y)
        {
            Element2D element2D1 = ChildList.Last();
            var       element2D2 = (Element2D)null;

            if (element2D1 != null)
            {
                element2D2 = element2D1.GetSelfOrDependantAtPoint(x, y);
            }

            if (element2D2 == null)
            {
                element2D2 = (this);
            }

            return(element2D2);
        }
Ejemplo n.º 2
0
        public bool OnMouseCommand(MouseEvent mouseevent)
        {
            var flag = false;

            if (mouseevent.type == MouseEventType.Leave)
            {
                m_oframeRootMasterElement.OnMouseLeave();
                return(false);
            }
            tooltipFrame.Hide();
            m_oeMouseOverElement = m_oframeRootControlElement.GetSelfOrDependantAtPoint(mouseevent.pos.x, mouseevent.pos.y);
            if (m_oeMouseOverElement == null)
            {
                if (m_oeFocusElement != null && m_oeFocusElement.Visible && m_oeFocusElement.Enabled)
                {
                    m_oeMouseOverElement = m_oeFocusElement.GetSelfOrDependantAtPoint(mouseevent.pos.x, mouseevent.pos.y);
                }

                if (m_oeMouseOverElement == null)
                {
                    m_oeMouseOverElement = m_oframeRootMasterElement.GetSelfOrDependantAtPoint(mouseevent.pos.x, mouseevent.pos.y);
                }
            }
            if (m_oeSelectedElement != null && m_oeSelectedElement != m_oeMouseOverElement)
            {
                flag = m_oeSelectedElement.OnMouseCommand(mouseevent);
                m_oeSelectedElement = null;
            }
            Element2D mouseOverElement = m_oeMouseOverElement;

            if (mouseOverElement != null)
            {
                m_oeSelectedElement = mouseOverElement;
                flag = mouseOverElement.OnMouseCommand(mouseevent);
                if (mouseOverElement.GetElementType() != ElementType.Frame && mouseOverElement.GetElementType() != ElementType.ScrollFrame)
                {
                    if (mouseevent.type == MouseEventType.Down)
                    {
                        if (m_oeSelectedElement.IsComboBoxElement())
                        {
                            if (m_ocbComboboxSelected != null && m_ocbComboboxSelected != m_oeSelectedElement.GetComboBoxElement())
                            {
                                m_ocbComboboxSelected.ShowDropDown = false;
                                m_ocbComboboxSelected.HasFocus     = false;
                            }
                            m_ocbComboboxSelected = m_oeSelectedElement.GetComboBoxElement();
                        }
                        else if (m_ocbComboboxSelected != null)
                        {
                            m_ocbComboboxSelected.ShowDropDown = false;
                            m_ocbComboboxSelected = null;
                        }
                        if (m_oeFocusElement != null && m_oeFocusElement != mouseOverElement && m_oeFocusElement != m_ocbComboboxSelected)
                        {
                            m_oeFocusElement.HasFocus = false;
                        }

                        m_oeFocusElement          = mouseOverElement;
                        m_oeFocusElement.HasFocus = true;
                        if (m_ocbComboboxSelected != null)
                        {
                            m_ocbComboboxSelected.HasFocus = true;
                        }
                    }
                    else if (mouseevent.type == MouseEventType.Up && mouseevent.button == MouseButton.Right)
                    {
                        var elementType = (int)m_oeMouseOverElement.GetElementType();
                    }
                }
                if (mouseevent.type == MouseEventType.MouseWheel)
                {
                    if (m_oeSelectedElement.IsListBoxElement())
                    {
                        ListBoxWidget listBoxElement = m_oeSelectedElement.GetListBoxElement();
                        if (listBoxElement != null)
                        {
                            if (mouseevent.delta > 0)
                            {
                                listBoxElement.ScrollBar.MoveSlider(-1f);
                            }
                            else
                            {
                                listBoxElement.ScrollBar.MoveSlider(1f);
                            }
                        }
                    }
                    else if (m_oeSelectedElement.IsScrollFrame())
                    {
                        m_oeSelectedElement.GetScrollFrame()?.OnMouseCommand(mouseevent);
                    }
                }
            }
            else if (GlobalChildDialog.Count > 0 && mouseevent.type == MouseEventType.Down)
            {
                Element2D element2D = GlobalChildDialog.Last();
                if (element2D is Frame)
                {
                    ((Frame)element2D).Close();
                }
            }
            if (mouseevent.type == MouseEventType.Up)
            {
                m_oframeRootMasterElement.OnMouseLeave();
                if (m_ocbComboboxSelected != null && m_oeSelectedElement == null)
                {
                    m_ocbComboboxSelected.ShowDropDown = false;
                }
            }
            m_oframeRootMasterElement.OnMouseMove(mouseevent.pos.x, mouseevent.pos.y);
            m_smePrevMouseEvent = mouseevent;
            return(flag);
        }