示例#1
0
        public void selected(bool bSelected, bool notify = true)
        {
            if (mSelected == bSelected)
            {
                return;
            }
            mSelected = bSelected;
            if (mSelected)
            {
                mButtonState |= (int)ControlFlag.UISTATE_SELECTED;
            }
            else
            {
                mButtonState &= ~(int)ControlFlag.UISTATE_SELECTED;
            }

            if (mManager != null)
            {
                if (mGroupName != "")
                {
                    if (mSelected)
                    {
                        List <ControlUI> aOptionGroup = mManager.getOptionGroup(mGroupName);
                        for (int i = 0; i < aOptionGroup.Count; i++)
                        {
                            OptionUI pControl = (OptionUI)(aOptionGroup[i]);
                            if (pControl != this)
                            {
                                pControl.selected(false);
                            }
                        }
                        if (notify)
                        {
                            mManager.sendNotify(this, "selectchanged");
                        }
                    }
                }
                else
                {
                    if (notify)
                    {
                        mManager.sendNotify(this, "selectchanged");
                    }
                }
            }
            invalidate();
        }
示例#2
0
        public static ControlUI getControl(string typeName)
        {
            ControlUI newControl = null;
            int       len        = typeName.Length;

            switch (len)
            {
            case 4:
            {
                if (typeName == "Edit")
                {
                    newControl = new EditUI();
                }
                else if (typeName == "List")
                {
                    newControl = new ListUI();
                }
                else if (typeName == "Text")
                {
                    newControl = new TextUI();
                }

                break;
            }

            case 5:
            {
                if (typeName == "Combo")
                {
                    newControl = new ComboUI();
                }
                else if (typeName == "Label")
                {
                    newControl = new LabelUI();
                }
                break;
            }

            case 6:
            {
                if (typeName == "Button")
                {
                    newControl = new ButtonUI();
                }
                else if (typeName == "Option")
                {
                    newControl = new OptionUI();
                }
                else if (typeName == "Slider")
                {
                    newControl = new SliderUI();
                }

                break;
            }

            case 7:
            {
                if (typeName == "Control")
                {
                    newControl = new ControlUI();
                }
                else if (typeName == "ActiveX")
                {
                    newControl = new ActiveXUI();
                }
                break;
            }

            case 8:
            {
                if (typeName == "Progress")
                {
                    newControl = new ProgressUI();
                }
                break;
            }

            case 9:
            {
                if (typeName == "Container")
                {
                    newControl = new ContainerUI();
                }
                else if (typeName == "TabLayout")
                {
                    newControl = new TabLayoutUI();
                }

                break;
            }

            case 10:
            {
                if (typeName == "ListHeader")
                {
                    newControl = new ListHeaderUI();
                }
                else if (typeName == "TileLayout")
                {
                    newControl = new TileLayoutUI();
                }

                break;
            }

            case 12:
            {
                if (typeName == "DialogLayout")
                {
                    newControl = new DialogLayoutUI();
                }
                break;
            }

            case 14:
            {
                if (typeName == "VerticalLayout")
                {
                    newControl = new VerticalLayoutUI();
                }
                else if (typeName == "ListHeaderItem")
                {
                    newControl = new ListHeaderItemUI();
                }

                break;
            }

            case 15:
            {
                if (typeName == "ListTextElement")
                {
                    newControl = new ListTextElementUI();
                }
                break;
            }

            case 16:
            {
                if (typeName == "HorizontalLayout")
                {
                    newControl = new HorizontalLayoutUI();
                }
                else if (typeName == "ListLabelElement")
                {
                    newControl = new ListLabelElementUI();
                }

                break;
            }

            case 17:
            {
                if (typeName == "ListExpandElement")
                {
                    newControl = new ListExpandElementUI();
                }
                break;
            }

            case 20:
            {
                if (typeName == "ListContainerElement")
                {
                    newControl = new ListContainerElementUI();
                }
                break;
            }
            }

            return(newControl);
        }