Example #1
0
        internal static ControlBase XmlElementHandler(Xml.Parser parser, Type type, ControlBase parent)
        {
            MenuItem element = new MenuItem(parent);

            parser.ParseAttributes(element);
            if (parser.MoveToContent())
            {
                ControlBase e = parent;
                while (e != null && e.Component == null)
                {
                    e = e.Parent;
                }

                foreach (string elementName in parser.NextElement())
                {
                    if (elementName == "MenuItem")
                    {
                        element.Menu.AddItem(parser.ParseElement <MenuItem>(element));
                    }
                    else if (elementName == "MenuDivider")
                    {
                        element.Menu.AddDivider();
                    }

                    element.Menu.Component = e != null ? e.Component : null;
                }
            }
            return(element);
        }
Example #2
0
        internal static ControlBase XmlElementHandler(Xml.Parser parser, Type type, ControlBase parent)
        {
            ListBoxRow element = new ListBoxRow(parent);

            parser.ParseAttributes(element);
            if (parser.MoveToContent())
            {
                int colIndex = 1;
                foreach (string elementName in parser.NextElement())
                {
                    if (elementName == "Column")
                    {
                        if (parser.MoveToContent())
                        {
                            ControlBase column = parser.ParseElement(element);
                            element.SetCellContents(colIndex++, column, true);
                        }
                        else
                        {
                            string colText = parser.GetAttribute("Text");
                            element.SetCellText(colIndex++, colText != null ? colText : String.Empty);
                        }
                    }
                }
            }
            return(element);
        }
Example #3
0
        internal static ControlBase XmlElementHandler(Xml.Parser parser, Type type, ControlBase parent)
        {
            ListBox element = new ListBox(parent);

            parser.ParseAttributes(element);
            if (parser.MoveToContent())
            {
                foreach (string elementName in parser.NextElement())
                {
                    if (elementName == "Row")
                    {
                        element.AddRow(parser.ParseElement <ListBoxRow>(element));
                    }
                }
            }
            return(element);
        }
Example #4
0
        internal static ControlBase XmlElementHandler(Xml.Parser parser, Type type, ControlBase parent)
        {
            EditableComboBox element = new EditableComboBox(parent);

            parser.ParseAttributes(element);
            if (parser.MoveToContent())
            {
                foreach (string elementName in parser.NextElement())
                {
                    if (elementName == "Option")
                    {
                        element.AddItem(parser.ParseElement <MenuItem>(element));
                    }
                }
            }
            return(element);
        }
Example #5
0
        internal static ControlBase XmlElementHandler(Xml.Parser parser, Type type, ControlBase parent)
        {
            TreeControl element = new TreeControl(parent);

            parser.ParseAttributes(element);
            if (parser.MoveToContent())
            {
                foreach (string elementName in parser.NextElement())
                {
                    if (elementName == "TreeNode")
                    {
                        parser.ParseElement <TreeNode>(element);
                    }
                }
            }
            return(element);
        }
Example #6
0
        internal static ControlBase XmlElementHandler(Xml.Parser parser, Type type, ControlBase parent)
        {
            RadioButtonGroup element = new RadioButtonGroup(parent);

            parser.ParseAttributes(element);
            if (parser.MoveToContent())
            {
                foreach (string elementName in parser.NextElement())
                {
                    if (elementName == "Option")
                    {
                        element.AddOption(parser.ParseElement <LabeledRadioButton>(element));
                    }
                }
            }
            return(element);
        }
Example #7
0
        internal static ControlBase XmlElementHandler(Xml.Parser parser, Type type, ControlBase parent)
        {
            ListBoxRow element = new ListBoxRow(parent);
            ListBox    listBox = parent as ListBox;

            if (listBox != null)
            {
                element.ColumnCount = listBox.ColumnCount;
            }
            else
            {
                throw new System.Xml.XmlException("Unknown parent for ListBox Row.");
            }
            parser.ParseAttributes(element);
            if (parser.MoveToContent())
            {
                int colIndex = 1;
                foreach (string elementName in parser.NextElement())
                {
                    if (elementName == "Column")
                    {
                        if (parser.MoveToContent())
                        {
                            ControlBase column = parser.ParseElement(element);
                            element.SetCellContents(colIndex++, column);
                        }
                        else
                        {
                            string colText = parser.GetAttribute("Text");
                            element.SetCellText(colIndex++, colText != null ? colText : String.Empty);
                        }
                    }
                }
            }
            return(element);
        }