External/Aga.Controls/Tree/FixedRowHeightLayout.cs
author moel.mich
Mon, 02 Jul 2012 21:14:40 +0000
changeset 357 fb8dc26f65a4
permissions -rw-r--r--
Added mainboard specific configurations for the following Gigabyte mainboards: EX58-UD3R, G41M-Combo, G41MT-S2, G41MT-S2P, GA-MA770T-UD3P, GA-MA785GM-US2H, GA-MA78LM-S2H, GA-MA790X-UD3P, H55-USB3, H55N-USB3, H61M-DS2 REV 1.2, H61M-USB3-B3 REV 2.0, H67A-USB3-B3, P55A-UD3, P67A-UD3-B3, P67A-UD3R-B3, Z68A-D3H-B3, Z68AP-D3, Z68X-UD3H-B3.
     1 using System;
     2 using System.Collections.Generic;
     3 using System.Text;
     4 using System.Drawing;
     5 
     6 namespace Aga.Controls.Tree
     7 {
     8 	internal class FixedRowHeightLayout : IRowLayout
     9 	{
    10 		private TreeViewAdv _treeView;
    11 
    12 		public FixedRowHeightLayout(TreeViewAdv treeView, int rowHeight)
    13 		{
    14 			_treeView = treeView;
    15 			PreferredRowHeight = rowHeight;
    16 		}
    17 
    18 		private int _rowHeight;
    19 		public int PreferredRowHeight
    20 		{
    21 			get { return _rowHeight; }
    22 			set { _rowHeight = value; }
    23 		}
    24 
    25 		public Rectangle GetRowBounds(int rowNo)
    26 		{
    27 			return new Rectangle(0, rowNo * _rowHeight, 0, _rowHeight);
    28 		}
    29 
    30 		public int PageRowCount
    31 		{
    32 			get
    33 			{
    34 				return Math.Max((_treeView.DisplayRectangle.Height - _treeView.ColumnHeaderHeight) / _rowHeight, 0);
    35 			}
    36 		}
    37 
    38 		public int CurrentPageSize
    39 		{
    40 			get
    41 			{
    42 				return PageRowCount;
    43 			}
    44 		}
    45 
    46 		public int GetRowAt(Point point)
    47 		{
    48 			point = new Point(point.X, point.Y + (_treeView.FirstVisibleRow * _rowHeight) - _treeView.ColumnHeaderHeight);
    49 			return point.Y / _rowHeight;
    50 		}
    51 
    52 		public int GetFirstRow(int lastPageRow)
    53 		{
    54 			return Math.Max(0, lastPageRow - PageRowCount + 1);
    55 		}
    56 
    57 		public void ClearCache()
    58 		{
    59 		}
    60 	}
    61 }