using System;
using System.Collections;
using DevComponents.UI.ContentManager;
using System.Drawing;
namespace DevComponents.DotNetBar
{
	/// 
	/// Represents IBlock layout manager implementation
	/// 
	public class ItemBlockLayoutManager:BlockLayoutManager
	{
		/// 
		/// Resizes the content block and sets it's Bounds property to reflect new size.
		/// 
		/// Content block to resize.
        public override void Layout(IBlock block, Size availableSize)
		{
			if(block is BaseItem)
			{
				BaseItem item=block as BaseItem;
                if (item is ItemContainer || item.IsContainer)
                {
                    item.SuspendLayout = true;
                    item.WidthInternal = availableSize.Width;
                    item.HeightInternal = availableSize.Height;
                    item.SuspendLayout = false;
                }
                item.RecalcSize();
				item.Displayed=item.Visible;
			}
		}
        public override Rectangle FinalizeLayout(Rectangle containerBounds, Rectangle blocksBounds, ArrayList lines)
        {
            return (blocksBounds);
        }
	}
}