author | moel.mich |
Sun, 27 May 2012 16:50:01 +0000 | |
changeset 347 | d043dac9f34e |
permissions | -rw-r--r-- |
moel@345 | 1 |
using System; |
moel@345 | 2 |
using System.Collections.Generic; |
moel@345 | 3 |
using System.Text; |
moel@345 | 4 |
using System.Drawing; |
moel@345 | 5 |
|
moel@345 | 6 |
namespace Aga.Controls.Tree |
moel@345 | 7 |
{ |
moel@345 | 8 |
internal class FixedRowHeightLayout : IRowLayout |
moel@345 | 9 |
{ |
moel@345 | 10 |
private TreeViewAdv _treeView; |
moel@345 | 11 |
|
moel@345 | 12 |
public FixedRowHeightLayout(TreeViewAdv treeView, int rowHeight) |
moel@345 | 13 |
{ |
moel@345 | 14 |
_treeView = treeView; |
moel@345 | 15 |
PreferredRowHeight = rowHeight; |
moel@345 | 16 |
} |
moel@345 | 17 |
|
moel@345 | 18 |
private int _rowHeight; |
moel@345 | 19 |
public int PreferredRowHeight |
moel@345 | 20 |
{ |
moel@345 | 21 |
get { return _rowHeight; } |
moel@345 | 22 |
set { _rowHeight = value; } |
moel@345 | 23 |
} |
moel@345 | 24 |
|
moel@345 | 25 |
public Rectangle GetRowBounds(int rowNo) |
moel@345 | 26 |
{ |
moel@345 | 27 |
return new Rectangle(0, rowNo * _rowHeight, 0, _rowHeight); |
moel@345 | 28 |
} |
moel@345 | 29 |
|
moel@345 | 30 |
public int PageRowCount |
moel@345 | 31 |
{ |
moel@345 | 32 |
get |
moel@345 | 33 |
{ |
moel@345 | 34 |
return Math.Max((_treeView.DisplayRectangle.Height - _treeView.ColumnHeaderHeight) / _rowHeight, 0); |
moel@345 | 35 |
} |
moel@345 | 36 |
} |
moel@345 | 37 |
|
moel@345 | 38 |
public int CurrentPageSize |
moel@345 | 39 |
{ |
moel@345 | 40 |
get |
moel@345 | 41 |
{ |
moel@345 | 42 |
return PageRowCount; |
moel@345 | 43 |
} |
moel@345 | 44 |
} |
moel@345 | 45 |
|
moel@345 | 46 |
public int GetRowAt(Point point) |
moel@345 | 47 |
{ |
moel@345 | 48 |
point = new Point(point.X, point.Y + (_treeView.FirstVisibleRow * _rowHeight) - _treeView.ColumnHeaderHeight); |
moel@345 | 49 |
return point.Y / _rowHeight; |
moel@345 | 50 |
} |
moel@345 | 51 |
|
moel@345 | 52 |
public int GetFirstRow(int lastPageRow) |
moel@345 | 53 |
{ |
moel@345 | 54 |
return Math.Max(0, lastPageRow - PageRowCount + 1); |
moel@345 | 55 |
} |
moel@345 | 56 |
|
moel@345 | 57 |
public void ClearCache() |
moel@345 | 58 |
{ |
moel@345 | 59 |
} |
moel@345 | 60 |
} |
moel@345 | 61 |
} |