protected override void InvalidateVirtualSize () { double model_rows = Model == null ? 0 : Model.Count; VirtualSize = new Size ( ChildSize.Width * Math.Max (Columns, 1), ChildSize.Height * Math.Ceiling (model_rows / Math.Max (Columns, 1))); }
public Rect (Point location, Size size) : this () { X = location.X; Y = location.Y; Width = size.Width; Height = size.Height; }
public override Size Measure (Size available) { Size result = new Size (0, 0); foreach (var child in Children) { if (child.Visible) { Size size = child.Measure (available); result.Width = Math.Max (result.Width, size.Width); result.Height = Math.Max (result.Height, size.Height); } } if (!Double.IsNaN (Width)) { result.Width = Width; } if (!Double.IsNaN (Height)) { result.Height = Height; } if (!available.IsEmpty) { result.Width = Math.Min (result.Width, available.Width); result.Height = Math.Min (result.Height, available.Height); } return DesiredSize = result; }
public override Size Measure (Size available) { if (!EnsureLayout ()) { return new Size (0, 0); } available = base.Measure (available); int text_w, text_h; // Update layout UpdateLayout (GetText (), available.Width - Margin.X, null, false); layout.GetPixelSize (out text_w, out text_h); double width = text_w; if (!available.IsEmpty && available.Width > 0) { width = available.Width; } //DesiredSize = new Size (width, text_h); var size = DesiredSize = new Size (width, text_h); // Hack, as this prevents the TextBlock from // being flexible in a Vertical StackPanel Height = size.Height; if (ForceSize) { Width = DesiredSize.Width; } return size; }
public override Size Measure (Size available) { Size result = new Size (0, 0); int visible_children = 0; foreach (var child in Children) { if (!child.Visible) { continue; } Size size = child.Measure (available); if (Orientation == Orientation.Vertical) { result.Height += size.Height; result.Width = Math.Max (result.Width, size.Width); } else { result.Width += size.Width; result.Height = Math.Max (result.Height, size.Height); } visible_children++; } if (!Double.IsNaN (Width)) { result.Width = Width; } if (!Double.IsNaN (Height)) { result.Height = Height; } result.Width += Margin.X; result.Height += Margin.Y; if (!available.IsEmpty) { result.Width = Math.Min (result.Width, available.Width); result.Height = Math.Min (result.Height, available.Height); } if (Orientation == Orientation.Vertical) { result.Height += Spacing * (visible_children - 1); } else { result.Width += Spacing * (visible_children - 1); } return DesiredSize = result; }
public bool Equals (Size value) { return value.width == width && value.height == height; }
public override Size Measure(Size available) { Width = Height = ImageSize; return DesiredSize = new Size (Width + Margin.X, Height + Margin.Y); }
public override Size Measure (Size available) { Height = BarSize; return DesiredSize = new Size (base.Measure (available).Width, Height + Margin.Top + Margin.Bottom); }
public override Size Measure (Size available) { Width = Size + 2 * Xpad; Height = Size + 2 * Ypad; return DesiredSize = new Size (Width + Margin.X, Height + Margin.Y); }
public override Size Measure (Size available) { var layout = ParentLayout as PhotoGridViewLayout; caption_allocation.Height = layout.CaptionRender.MeasureHeight (ParentLayout.View); double width = ThumbnailWidth + Padding.X; double height = ThumbnailHeight + CaptionSpacing + caption_allocation.Height + Padding.Y; return new Size (Math.Round (width), Math.Round (height)); }
public abstract Size Measure (Size available);
public override Size Measure (Size available) { Width = renderer.Width; Height = renderer.Height; return DesiredSize = new Size (Width + Margin.X, Height + Margin.Y); }
public override Size Measure (Size available) { var widget = ParentLayout.View; var fd = widget.PangoContext.FontDescription; int normal_size = fd.Size; fd.Size = (int)(fd.Size * Pango.Scale.Small); first_line_allocation.Height = fd.MeasureTextHeight (widget.PangoContext); fd.Weight = Pango.Weight.Normal; fd.Size = (int)(fd.Size * Pango.Scale.Small); second_line_allocation.Height = fd.MeasureTextHeight (widget.PangoContext); fd.Size = normal_size; double width, height; double text_height = first_line_allocation.Height + second_line_allocation.Height; if (IsGridLayout) { width = ImageSize + Padding.X; height = ImageSize + ImageSpacing + TextSpacing + text_height + Padding.Y; } else { double list_text_height = text_height + TextSpacing; width = ImageSize + ImageSpacing + Padding.Y; height = (list_text_height < ImageSize ? ImageSize : list_text_height) + Padding.X; } return new Size (Math.Round (width), Math.Round (height)); }
public override Size Measure(Size available) { if (!EnsureLayout ()) { return new Size (0, 0); } available = base.Measure (available); int text_w, text_h; TextWrap wrap = TextWrap; layout.Width = wrap == TextWrap.None ? -1 : (int)(Pango.Scale.PangoScale * available.Width); layout.Wrap = GetPangoWrapMode (wrap); layout.FontDescription.Weight = GetPangoFontWeight (FontWeight); layout.SetText (Text); layout.GetPixelSize (out text_w, out text_h); double width = text_w; if (!available.IsEmpty && available.Width > 0) { width = available.Width; } DesiredSize = new Size ( width + Margin.Left + Margin.Right, text_h + Margin.Top + Margin.Bottom); // Hack, as this prevents the TextBlock from // being flexible in a Vertical StackPanel Height = DesiredSize.Height; if (ForceSize) { Width = DesiredSize.Width; } return DesiredSize; }
public virtual Size Measure (Size available) { double m_x = Margin.X; double m_y = Margin.Y; double a_w = available.Width - m_x; double a_h = available.Height - m_y; return DesiredSize = new Size ( Math.Max (0, Math.Min (a_w, Double.IsNaN (Width) ? a_w : Width + m_x)), Math.Max (0, Math.Min (a_h, Double.IsNaN (Height) ? a_h : Height + m_y)) ); }