31 lines
1.3 KiB
C#
31 lines
1.3 KiB
C#
using System;
|
|
using System.Windows;
|
|
using System.Windows.Media;
|
|
|
|
namespace mbts.ui.controls {
|
|
// Column types are nested inside the DIYGrid
|
|
partial class DIYGrid {
|
|
public struct ColumnGeometry {
|
|
public ColumnBase column;
|
|
public DIYGridSuperHeader super_column;
|
|
public double unclipped_left; /* If the column was unclipped */
|
|
public double left;
|
|
public double width { get { return column.ActualWidth; } }
|
|
public double right { get { return unclipped_left + width; } }
|
|
public bool is_partially_obscured { get { return unclipped_left < left; } }
|
|
public double visible_width => width - left + unclipped_left;
|
|
public override string ToString() {
|
|
return "{3} {0:0.0},{1:0.0} w{2:0.0}".fmt(left, right, width, column.Header);
|
|
}
|
|
public string group { get { return super_column == null ? "" : super_column.FullHeader; } }
|
|
|
|
public RectangleGeometry get_clip(double row_height) =>
|
|
new RectangleGeometry(new Rect(left, 0, width - left + unclipped_left, row_height));
|
|
|
|
public IDisposable clip_draw(DrawingContext dc, double row_height) {
|
|
dc.PushClip(get_clip(row_height));
|
|
return Disposable.Create(dc.Pop);
|
|
}
|
|
}
|
|
}
|
|
} |