Esempio n. 1
0
        public override bool OnMouseCommand(MouseEvent mouseevent)
        {
            Element2D element2D = ChildList.Last();

            if (element2D != null)
            {
                return(element2D.OnMouseCommand(mouseevent));
            }

            return(false);
        }
Esempio 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);
        }