protected override WidgetSize OnGetPreferredHeight() { WidgetSize s = new WidgetSize(); if (direction == Orientation.Vertical) { int count = 0; foreach (var cw in Children.Where(b => b.Visible)) { s += cw.Surface.GetPreferredHeight(); count++; } if (count > 0) { s += spacing * (double)(count - 1); } } else { foreach (var cw in Children.Where(b => b.Visible)) { s = s.UnionWith(cw.Surface.GetPreferredHeight()); } } return(s); }
WidgetSize GetPreferredLengthForSize(SizeRequestMode mode, double width) { WidgetSize s = new WidgetSize(); if ((direction == Orientation.Horizontal && mode == SizeRequestMode.HeightForWidth) || (direction == Orientation.Vertical && mode == SizeRequestMode.WidthForHeight)) { CalcDefaultSizes(mode, width, -1); foreach (var bp in children.Where(b => b.Child.Visible)) { s = s.UnionWith(GetPreferredLengthForSize(mode, bp.Child, bp.NextSize)); } } else { int count = 0; foreach (var bp in children.Where(b => b.Child.Visible)) { s += GetPreferredLengthForSize(mode, bp.Child, width); count++; } if (count > 0) { s += spacing * (double)(count - 1); } } return(s); }
protected override WidgetSize OnGetPreferredWidth() { WidgetSize s = new WidgetSize(); if (direction == Orientation.Horizontal) { int count = 0; foreach (IWidgetSurface cw in Children.Where(b => b.Visible)) { s += cw.GetPreferredWidth(); count++; } s += spacing * (double)(count - 1); } else { foreach (IWidgetSurface cw in Children.Where(b => b.Visible)) { s.UnionWith(cw.GetPreferredWidth()); } } return(s); }