public override void Setup_BeforeAdd(XML xml) { base.Setup_BeforeAdd(xml); string str; str = xml.GetAttribute("layout"); if (str != null) _layout = FieldTypes.ParseListLayoutType(str); else _layout = ListLayoutType.SingleColumn; str = xml.GetAttribute("selectionMode"); if (str != null) selectionMode = FieldTypes.ParseListSelectionMode(str); else selectionMode = ListSelectionMode.Single; OverflowType overflow; str = xml.GetAttribute("overflow"); if (str != null) overflow = FieldTypes.ParseOverflowType(str); else overflow = OverflowType.Visible; ScrollType scroll; str = xml.GetAttribute("scroll"); if (str != null) scroll = FieldTypes.ParseScrollType(str); else scroll = ScrollType.Vertical; ScrollBarDisplayType scrollBarDisplay; str = xml.GetAttribute("scrollBar"); if (str != null) scrollBarDisplay = FieldTypes.ParseScrollBarDisplayType(str); else scrollBarDisplay = ScrollBarDisplayType.Default; int scrollBarFlags = xml.GetAttributeInt("scrollBarFlags"); Margin scrollBarMargin = new Margin(); str = xml.GetAttribute("scrollBarMargin"); if (str != null) scrollBarMargin.Parse(str); str = xml.GetAttribute("margin"); if (str != null) _margin.Parse(str); SetupOverflowAndScroll(overflow, scrollBarMargin, scroll, scrollBarDisplay, scrollBarFlags); string[] arr = xml.GetAttributeArray("clipSoftness"); if (arr != null) this.clipSoftness = new Vector2(int.Parse(arr[0]), int.Parse(arr[1])); _lineGap = xml.GetAttributeInt("lineGap"); _columnGap = xml.GetAttributeInt("colGap"); defaultItem = xml.GetAttribute("defaultItem"); autoResizeItem = xml.GetAttributeBool("autoItemSize", true); XMLList col = xml.Elements("item"); foreach (XML ix in col) { string url = ix.GetAttribute("url"); if (string.IsNullOrEmpty(url)) url = defaultItem; if (string.IsNullOrEmpty(url)) continue; GObject obj = AddItemFromPool(url); if (obj is GButton) { ((GButton)obj).title = ix.GetAttribute("title"); ((GButton)obj).icon = ix.GetAttribute("icon"); } else if (obj is GLabel) { ((GLabel)obj).title = ix.GetAttribute("title"); ((GLabel)obj).icon = ix.GetAttribute("icon"); } } }
public override void Setup_BeforeAdd(XML xml) { base.Setup_BeforeAdd(xml); string str; string[] arr; str = xml.GetAttribute("layout"); if (str != null) _layout = FieldTypes.ParseListLayoutType(str); else _layout = ListLayoutType.SingleColumn; str = xml.GetAttribute("selectionMode"); if (str != null) selectionMode = FieldTypes.ParseListSelectionMode(str); else selectionMode = ListSelectionMode.Single; OverflowType overflow; str = xml.GetAttribute("overflow"); if (str != null) overflow = FieldTypes.ParseOverflowType(str); else overflow = OverflowType.Visible; str = xml.GetAttribute("margin"); if (str != null) _margin.Parse(str); str = xml.GetAttribute("align"); if (str != null) _align = FieldTypes.ParseAlign(str); str = xml.GetAttribute("vAlign"); if (str != null) _verticalAlign = FieldTypes.ParseVerticalAlign(str); if (overflow == OverflowType.Scroll) { ScrollType scroll; str = xml.GetAttribute("scroll"); if (str != null) scroll = FieldTypes.ParseScrollType(str); else scroll = ScrollType.Vertical; ScrollBarDisplayType scrollBarDisplay; str = xml.GetAttribute("scrollBar"); if (str != null) scrollBarDisplay = FieldTypes.ParseScrollBarDisplayType(str); else scrollBarDisplay = ScrollBarDisplayType.Default; int scrollBarFlags = xml.GetAttributeInt("scrollBarFlags"); Margin scrollBarMargin = new Margin(); str = xml.GetAttribute("scrollBarMargin"); if (str != null) scrollBarMargin.Parse(str); string vtScrollBarRes = null; string hzScrollBarRes = null; arr = xml.GetAttributeArray("scrollBarRes"); if (arr != null) { vtScrollBarRes = arr[0]; hzScrollBarRes = arr[1]; } SetupScroll(scrollBarMargin, scroll, scrollBarDisplay, scrollBarFlags, vtScrollBarRes, hzScrollBarRes); } else { SetupOverflow(overflow); } arr = xml.GetAttributeArray("clipSoftness"); if (arr != null) this.clipSoftness = new Vector2(int.Parse(arr[0]), int.Parse(arr[1])); _lineGap = xml.GetAttributeInt("lineGap"); _columnGap = xml.GetAttributeInt("colGap"); _lineItemCount = xml.GetAttributeInt("lineItemCount"); defaultItem = xml.GetAttribute("defaultItem"); autoResizeItem = xml.GetAttributeBool("autoItemSize", true); XMLList.Enumerator et = xml.GetEnumerator("item"); while (et.MoveNext()) { XML ix = et.Current; string url = ix.GetAttribute("url"); if (string.IsNullOrEmpty(url)) { url = defaultItem; if (string.IsNullOrEmpty(url)) continue; } GObject obj = GetFromPool(url); if (obj != null) { AddChild(obj); str = ix.GetAttribute("title"); if (str != null) obj.text = str; str = ix.GetAttribute("icon"); if (str != null) obj.icon = str; str = ix.GetAttribute("name"); if (str != null) obj.name = str; } } }
override public void Setup_BeforeAdd(XML xml) { base.Setup_BeforeAdd(xml); string str; str = xml.GetAttribute("layout"); if (str != null) { _layout = FieldTypes.ParseListLayoutType(str); } else { _layout = ListLayoutType.SingleColumn; } str = xml.GetAttribute("selectionMode"); if (str != null) { selectionMode = FieldTypes.ParseListSelectionMode(str); } else { selectionMode = ListSelectionMode.Single; } OverflowType overflow; str = xml.GetAttribute("overflow"); if (str != null) { overflow = FieldTypes.ParseOverflowType(str); } else { overflow = OverflowType.Visible; } ScrollType scroll; str = xml.GetAttribute("scroll"); if (str != null) { scroll = FieldTypes.ParseScrollType(str); } else { scroll = ScrollType.Vertical; } ScrollBarDisplayType scrollBarDisplay; str = xml.GetAttribute("scrollBar"); if (str != null) { scrollBarDisplay = FieldTypes.ParseScrollBarDisplayType(str); } else { scrollBarDisplay = ScrollBarDisplayType.Default; } int scrollBarFlags = xml.GetAttributeInt("scrollBarFlags"); Margin scrollBarMargin = new Margin(); str = xml.GetAttribute("scrollBarMargin"); if (str != null) { scrollBarMargin.Parse(str); } str = xml.GetAttribute("margin"); if (str != null) { _margin.Parse(str); } SetupOverflowAndScroll(overflow, scrollBarMargin, scroll, scrollBarDisplay, scrollBarFlags); string[] arr = xml.GetAttributeArray("clipSoftness"); if (arr != null) { this.clipSoftness = new Vector2(int.Parse(arr[0]), int.Parse(arr[1])); } _lineGap = xml.GetAttributeInt("lineGap"); _columnGap = xml.GetAttributeInt("colGap"); defaultItem = xml.GetAttribute("defaultItem"); autoResizeItem = xml.GetAttributeBool("autoItemSize", true); XMLList col = xml.Elements("item"); foreach (XML ix in col) { string url = ix.GetAttribute("url"); if (string.IsNullOrEmpty(url)) { url = defaultItem; } if (string.IsNullOrEmpty(url)) { continue; } GObject obj = AddItemFromPool(url); if (obj is GButton) { ((GButton)obj).title = ix.GetAttribute("title"); ((GButton)obj).icon = ix.GetAttribute("icon"); } else if (obj is GLabel) { ((GLabel)obj).title = ix.GetAttribute("title"); ((GLabel)obj).icon = ix.GetAttribute("icon"); } } }