/*  $Id: layout_item.cpp,v 1.4 2004/02/01 20:53:15 mbn Exp $
**
**  ClanLib Game SDK
**  Copyright (C) 2003  The ClanLib Team
**  For a total list of contributers see the file CREDITS.
**
**  This library is free software; you can redistribute it and/or
**  modify it under the terms of the GNU Lesser General Public
**  License as published by the Free Software Foundation; either
**  version 2.1 of the License, or (at your option) any later version.
**
**  This library is distributed in the hope that it will be useful,
**  but WITHOUT ANY WARRANTY; without even the implied warranty of
**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
**  Lesser General Public License for more details.
**
**  You should have received a copy of the GNU Lesser General Public
**  License along with this library; if not, write to the Free Software
**  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
**
*/

#include "precomp.h"
#include "layout_item.h"
#include "layout_generic.h"

/////////////////////////////////////////////////////////////////////////////
// CL_LayoutItem Construction:

CL_LayoutItem::CL_LayoutItem(CL_Component *component) : component(component)
{
}

CL_LayoutItem::CL_LayoutItem(CL_SharedPtr<CL_Layout_Generic> layout) : component(0), layout(layout)
{
}

CL_LayoutItem::~CL_LayoutItem()
{
}

/////////////////////////////////////////////////////////////////////////////
// CL_LayoutItem Attributes:

CL_Size CL_LayoutItem::get_preferred_size() const
{
	if (component) return component->get_preferred_size();
	return layout->get_preferred_size();
}

CL_Size CL_LayoutItem::get_minimum_size() const
{
	if (component) return component->get_minimum_size();
	return layout->get_minimum_size();
}

CL_Size CL_LayoutItem::get_maximum_size() const
{
	if (component) return component->get_maximum_size();
	return layout->get_maximum_size();
}

CL_LayoutPolicy CL_LayoutItem::get_vertical_policy() const
{
	if (component) return component->get_vertical_policy();
	return layout->get_vertical_policy();
}

CL_LayoutPolicy CL_LayoutItem::get_horizontal_policy() const
{
	if (component) return component->get_horizontal_policy();
	return layout->get_horizontal_policy();
}

/////////////////////////////////////////////////////////////////////////////
// CL_LayoutItem Operations:

void CL_LayoutItem::set_position(const CL_Rect &pos)
{
	if (component) component->set_position(pos);
	else layout->set_position(pos);
}

/////////////////////////////////////////////////////////////////////////////
// CL_LayoutItem Implementation:
