Beispiel #1
0
 public override void OnControlMsg(Element2D the_control, ControlMsg msg, float xparam, float yparam)
 {
     if (the_control.GetElementType() == ElementType.ButtonWidget && msg == ControlMsg.MSG_MOVE)
     {
         base.OnControlMsg(the_control, msg, yparam - m_trackSubControl.Y, m_trackSubControl.Height - m_buttonSubControl.Height);
     }
     else
     {
         base.OnControlMsg(the_control, msg, xparam, yparam);
     }
 }
Beispiel #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);
        }
Beispiel #3
0
        public void OnKeyboardEvent(KeyboardEvent keyboardevent)
        {
            if (keyboardevent.Tab)
            {
                var tabIndexElements = new List <Element2D>();
                m_oframeRootMasterElement.GetNextTabIndexElement(ref tabIndexElements);
                var num1 = -1;
                foreach (Element2D element2D in tabIndexElements)
                {
                    if (element2D.tabIndex > num1)
                    {
                        num1 = element2D.tabIndex;
                    }
                }
                var num2       = -1;
                var element2D1 = (Element2D)null;
                if (m_oeFocusElement != null)
                {
                    element2D1 = m_oeFocusElement;
                    num2       = m_oeFocusElement.tabIndex;
                }
                var num3 = -1;
                foreach (Element2D element2D2 in tabIndexElements)
                {
                    if (element2D2.tabIndex != num2)
                    {
                        if (element2D2.tabIndex < num2)
                        {
                            if (num1 - num2 + element2D2.tabIndex < num3 || num3 == -1)
                            {
                                m_oeFocusElement = element2D2;
                                num3             = num1 - num2 + element2D2.tabIndex;
                            }
                        }
                        else if (element2D2.tabIndex - num2 < num3 || num3 == -1)
                        {
                            m_oeFocusElement = element2D2;
                            num3             = element2D2.tabIndex - num2;
                        }
                    }
                }
                if (element2D1 != null)
                {
                    element2D1.HasFocus = false;
                }

                if (m_ocbComboboxSelected != null)
                {
                    m_ocbComboboxSelected.ShowDropDown = false;
                }

                m_oeFocusElement.HasFocus = true;
                if (m_oeFocusElement.GetElementType() == ElementType.ComboBoxWidget)
                {
                    m_ocbComboboxSelected = (ComboBoxWidget)m_oeFocusElement;
                }
                else
                {
                    m_ocbComboboxSelected = null;
                }
            }
            else if (keyboardevent.Type == KeyboardEventType.CommandKey && ((CommandKeyEvent)keyboardevent).Key == KeyboardCommandKey.Escape)
            {
                m_oframeRootMasterElement.OnKeyboardEvent(keyboardevent);
            }
            else if (m_oeFocusElement != null)
            {
                if (m_ocbComboboxSelected != null)
                {
                    m_ocbComboboxSelected.OnKeyboardEvent(keyboardevent);
                }
                else if (m_oeFocusElement.IsListBoxElement())
                {
                    ListBoxWidget listBoxElement = m_oeFocusElement.GetListBoxElement();
                    if (listBoxElement == null)
                    {
                        return;
                    }

                    listBoxElement.HasFocus = true;
                    listBoxElement.OnKeyboardEvent(keyboardevent);
                    listBoxElement.HasFocus = false;
                }
                else
                {
                    m_oeFocusElement.OnKeyboardEvent(keyboardevent);
                }
            }
            else
            {
                m_oframeRootMasterElement.OnKeyboardEvent(keyboardevent);
            }
        }
Beispiel #4
0
        public override void OnControlMsg(Element2D the_control, ControlMsg msg, float xparam, float yparam)
        {
            switch (msg)
            {
            case ControlMsg.MSG_MOVE:
                if (currentTab.CanRemoveRecords)
                {
                    var childElement = (ImageWidget)FindChildElement(1008);
                    if (childElement != null)
                    {
                        childElement.Visible = true;
                    }
                }
                if (!currentTab.CanSaveRecords)
                {
                    break;
                }

                var childElement1 = (ImageWidget)FindChildElement(1009);
                if (childElement1 == null)
                {
                    break;
                }

                childElement1.Visible = true;
                break;

            case ControlMsg.ENTERHIT:
                if (the_control.GetElementType() != ElementType.EditBoxWidget)
                {
                    break;
                }

                var editBoxWidget = (EditBoxWidget)the_control;
                if (editBoxWidget.ID != 1001)
                {
                    break;
                }

                search_filter = editBoxWidget.Text;
                RefreshTab();
                break;

            case ControlMsg.MSG_DRAGSTOP:
                var childElement2 = (ImageWidget)FindChildElement(1008);
                var childElement3 = (ImageWidget)FindChildElement(1009);
                if (the_control.GetElementType() == ElementType.ButtonWidget)
                {
                    var buttonWidget = (ButtonWidget)the_control;
                    if (buttonWidget.Data != null && buttonWidget.Data is LibraryRecord)
                    {
                        if (currentTab.CanRemoveRecords && buttonWidget.Overlaps(childElement2, (int)xparam - buttonWidget.X_Abs, (int)yparam - buttonWidget.Y_Abs))
                        {
                            currentTab.RemoveRecord((LibraryRecord)buttonWidget.Data);
                            refresh.Value = true;
                        }
                        else if (currentTab.CanSaveRecords && buttonWidget.Overlaps(childElement3, (int)xparam - buttonWidget.X_Abs, (int)yparam - buttonWidget.Y_Abs))
                        {
                            currentTab.SaveRecord((LibraryRecord)buttonWidget.Data);
                            refresh.Value = true;
                        }
                        else
                        {
                            recorddata_to_load = (LibraryRecord)buttonWidget.Data;
                        }
                    }
                }
                if (childElement2 != null)
                {
                    childElement2.Visible = false;
                }

                if (childElement3 == null)
                {
                    break;
                }

                childElement3.Visible = false;
                break;

            default:
                base.OnControlMsg(the_control, msg, xparam, yparam);
                break;
            }
        }