moel@345: using System; moel@345: using System.Collections.Generic; moel@345: using System.Text; moel@345: using System.Drawing; moel@345: moel@345: namespace Aga.Controls.Tree moel@345: { moel@345: internal class FixedRowHeightLayout : IRowLayout moel@345: { moel@345: private TreeViewAdv _treeView; moel@345: moel@345: public FixedRowHeightLayout(TreeViewAdv treeView, int rowHeight) moel@345: { moel@345: _treeView = treeView; moel@345: PreferredRowHeight = rowHeight; moel@345: } moel@345: moel@345: private int _rowHeight; moel@345: public int PreferredRowHeight moel@345: { moel@345: get { return _rowHeight; } moel@345: set { _rowHeight = value; } moel@345: } moel@345: moel@345: public Rectangle GetRowBounds(int rowNo) moel@345: { moel@345: return new Rectangle(0, rowNo * _rowHeight, 0, _rowHeight); moel@345: } moel@345: moel@345: public int PageRowCount moel@345: { moel@345: get moel@345: { moel@345: return Math.Max((_treeView.DisplayRectangle.Height - _treeView.ColumnHeaderHeight) / _rowHeight, 0); moel@345: } moel@345: } moel@345: moel@345: public int CurrentPageSize moel@345: { moel@345: get moel@345: { moel@345: return PageRowCount; moel@345: } moel@345: } moel@345: moel@345: public int GetRowAt(Point point) moel@345: { moel@345: point = new Point(point.X, point.Y + (_treeView.FirstVisibleRow * _rowHeight) - _treeView.ColumnHeaderHeight); moel@345: return point.Y / _rowHeight; moel@345: } moel@345: moel@345: public int GetFirstRow(int lastPageRow) moel@345: { moel@345: return Math.Max(0, lastPageRow - PageRowCount + 1); moel@345: } moel@345: moel@345: public void ClearCache() moel@345: { moel@345: } moel@345: } moel@345: }