Пример #1
0
        public override void OnControlMsg(Element2D the_control, ControlMsg msg, float xparam, float yparam)
        {
            if (the_control.GetElementType() == ElementType.ListBoxWidget && msg == ControlMsg.SELECTCHANGED)
            {
                var index = (int)xparam;
                if (index < 0 || index >= listboxwidget.Items.Count)
                {
                    return;
                }

                editboxwidget.Text = listboxwidget.Items[index].ToString();
                ShowDropDown       = false;
            }
            else if (the_control.GetElementType() == ElementType.EditBoxWidget && msg == ControlMsg.TEXT_CHANGED)
            {
                if (TextChangedCallback == null)
                {
                    return;
                }

                TextChangedCallback(this);
            }
            else
            {
                base.OnControlMsg(the_control, msg, xparam, yparam);
            }
        }
Пример #2
0
        public override void OnControlMsg(Element2D the_control, ControlMsg msg, float xparam, float yparam)
        {
            if (msg == ControlMsg.MSG_HIT)
            {
                if (the_control.ID == 2)
                {
                    SetTrackPosition(m_track_position - m_pushbuttonstep);
                }
                else if (the_control.ID == 1)
                {
                    SetTrackPosition(m_track_position + m_pushbuttonstep);
                }
            }
            if (the_control.GetElementType() == ElementType.ButtonWidget && msg == ControlMsg.MSG_MOVE && the_control.ID == 0)
            {
                var fPosition = xparam / yparam * m_range + m_range_start;
                if (rounding_place >= 0)
                {
                    fPosition = (float)Math.Round(fPosition, rounding_place, MidpointRounding.AwayFromZero);
                }

                SetTrackPosition(fPosition);
            }
            if (the_control != null)
            {
                return;
            }

            SetTrackPosition(xparam / yparam * m_range + m_range_start);
        }
Пример #3
0
        public override void InitChildren(Element2D parent, GUIHost host, ButtonCallback MyButtonCallback)
        {
            if (!parent.IsComboBoxElement() && !parent.IsListBoxElement() && (u0 == 0.0 && v0 == 0.0) && (u1 == 0.0 && v1 == 0.0))
            {
                SetToDefaultOptions(type_template);
            }

            base.InitChildren(parent, host, MyButtonCallback);
            if (parent.GetElementType() != ElementType.ComboBoxWidget)
            {
                SetCallback(MyButtonCallback);
            }

            SetGrowableWidth(16, 16, 48);
        }
Пример #4
0
        public Frame GetScrollFrame()
        {
            if (GetElementType() == ElementType.ScrollFrame)
            {
                return((Frame)this);
            }

            for (Element2D parent = Parent; parent != null; parent = parent.Parent)
            {
                if (parent.GetElementType() == ElementType.ScrollFrame)
                {
                    return((Frame)parent);
                }
            }
            return(null);
        }
Пример #5
0
        public bool IsScrollFrame()
        {
            if (GetElementType() == ElementType.ScrollFrame)
            {
                return(true);
            }

            for (Element2D parent = Parent; parent != null; parent = parent.Parent)
            {
                if (parent.GetElementType() == ElementType.ScrollFrame)
                {
                    return(true);
                }
            }
            return(false);
        }
Пример #6
0
        public ListBoxWidget GetListBoxElement()
        {
            if (GetElementType() == ElementType.ListBoxWidget)
            {
                return((ListBoxWidget)this);
            }

            for (Element2D parent = Parent; parent != null; parent = parent.Parent)
            {
                if (parent.GetElementType() == ElementType.ListBoxWidget)
                {
                    return((ListBoxWidget)parent);
                }
            }
            return(null);
        }
Пример #7
0
        public bool IsListBoxElement()
        {
            if (GetElementType() == ElementType.ListBoxWidget)
            {
                return(true);
            }

            for (Element2D parent = Parent; parent != null; parent = parent.Parent)
            {
                if (parent.GetElementType() == ElementType.ListBoxWidget)
                {
                    return(true);
                }
            }
            return(false);
        }
Пример #8
0
 public override void InitChildren(Element2D parent, GUIHost host, ButtonCallback MyButtonCallback)
 {
     Parent = parent;
     if (parent.GetElementType() != ElementType.ComboBoxWidget)
     {
         Init(host, "guicontrols", u0, v0, u1, v1);
         SetGrowableWidth(3, 3, 32);
         SetTextWindowBorders(4, 4, 4, 4);
     }
     else
     {
         HexColor       = ((ComboBoxWidget)parent).HexColor;
         Size           = ((ComboBoxWidget)parent).Size;
         ToolTipMessage = parent.ToolTipMessage;
     }
     lock (ChildList)
     {
         foreach (Element2D child in ChildList)
         {
             child.InitChildren(this, host, MyButtonCallback);
         }
     }
 }