protected void Load(XmlElement elem) { if (elem.HasAttribute("cname")) { cname = elem.GetAttribute("cname"); } else if (cname == null) { cname = elem.GetAttribute("type"); } label = elem.GetAttribute("label"); if (label == "") { label = WrappedTypeName; int i = label.LastIndexOf('.'); if (i != -1) { label = label.Substring(i + 1); } } if (elem.HasAttribute("allow-children")) { allowChildren = elem.GetAttribute("allow-children") == "yes" || elem.GetAttribute("allow-children") == "true"; } category = elem.GetAttribute("palette-category"); if (elem.HasAttribute("deprecated")) { deprecated = true; } if (elem.HasAttribute("hexpandable")) { hexpandable = true; } if (elem.HasAttribute("vexpandable")) { vexpandable = true; } if (elem.GetAttribute("internal") == "true") { isInternal = true; } contextMenu = ItemGroup.Empty; baseType = elem.GetAttribute("base-type"); if (baseType.Length > 0) { ClassDescriptor basec = Registry.LookupClassByName(baseType); if (basec == null) { throw new InvalidOperationException("Base type '" + baseType + "' not found."); } foreach (ItemGroup group in basec.ItemGroups) { groups.Add(group); } foreach (ItemGroup group in basec.SignalGroups) { signals.Add(group); } contextMenu = basec.ContextMenu; } else { baseType = null; } XmlElement groupsElem = elem["itemgroups"]; if (groupsElem != null) { foreach (XmlElement groupElem in groupsElem.SelectNodes("itemgroup")) { ItemGroup itemgroup; if (groupElem.HasAttribute("ref")) { string refname = groupElem.GetAttribute("ref"); itemgroup = Registry.LookupItemGroup(refname); } else { itemgroup = new ItemGroup(groupElem, this); } groups.Add(itemgroup); if (groupElem.HasAttribute("important")) { if (groupElem.GetAttribute("important") == "true") { importantGroups++; } } else if (groups.Count == 1) { importantGroups++; } } } XmlElement signalsElem = elem["signals"]; if (signalsElem != null) { foreach (XmlElement groupElem in signalsElem.SelectNodes("itemgroup")) { ItemGroup itemgroup; if (groupElem.HasAttribute("ref")) { string refname = groupElem.GetAttribute("ref"); itemgroup = Registry.LookupSignalGroup(refname); } else { itemgroup = new ItemGroup(groupElem, this); } signals.Add(itemgroup); } } XmlElement contextElem = elem["contextmenu"]; if (contextElem != null) { if (contextElem.HasAttribute("ref")) { string refname = contextElem.GetAttribute("ref"); contextMenu = Registry.LookupContextMenu(refname); } else { contextMenu = new ItemGroup(contextElem, this); } } XmlElement ichildElem = elem["internal-children"]; if (ichildElem != null) { internalChildren = new ItemGroup(ichildElem, this); } else { internalChildren = ItemGroup.Empty; } string initProps = elem.GetAttribute("init-properties"); if (initProps.Length > 0) { string[] props = initProps.Split(' '); ArrayList list = new ArrayList(); foreach (string prop in props) { PropertyDescriptor idesc = this [prop] as PropertyDescriptor; if (idesc == null) { throw new InvalidOperationException("Initialization property not found: " + prop); } list.Add(idesc); } initializationProperties = (PropertyDescriptor[])list.ToArray(typeof(PropertyDescriptor)); } else { initializationProperties = emptyPropArray; } targetGtkVersion = elem.GetAttribute("gtk-version"); if (targetGtkVersion.Length == 0) { targetGtkVersion = null; } }