/*  $Id: layout.cpp,v 1.8 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 "API/GUI/layout.h"
#include "layout_generic.h"

/////////////////////////////////////////////////////////////////////////////
// CL_Layout construction:

CL_Layout::CL_Layout()
{
}

CL_Layout::CL_Layout(const CL_Layout &copy) : impl(copy.impl)
{
}

CL_Layout::CL_Layout(CL_LayoutType type)
{
	impl = new CL_Layout_Generic(type);
}

CL_Layout::~CL_Layout()
{
}

/////////////////////////////////////////////////////////////////////////////
// CL_Layout operations:

void CL_Layout::set_grid_columns(int columns)
{
	if (impl) impl->grid_columns = columns;
}

void CL_Layout::set_margin(int margin)
{
	if (impl) impl->margin = margin;
}

void CL_Layout::set_spacing(int spacing)
{
	if (impl) impl->spacing = spacing;
}

void CL_Layout::add_component(CL_Component *component)
{
	impl->elements.push_back(new CL_LayoutItem(component));
}

void CL_Layout::add_component(int index, CL_Component *component)
{
	impl->elements.push_back(new CL_LayoutItem(component));
}

void CL_Layout::add_component(int col, int row, CL_Component *component, int span)
{
	impl->elements.push_back(new CL_LayoutItem(component));
}

void CL_Layout::add_layout(const CL_Layout &layout)
{
	impl->elements.push_back(new CL_LayoutItem(layout.impl));
}

void CL_Layout::add_layout(int index, const CL_Layout &layout)
{
	impl->elements.push_back(new CL_LayoutItem(layout.impl));
}

void CL_Layout::add_layout(int col, int row, const CL_Layout &layout, int span)
{
	impl->elements.push_back(new CL_LayoutItem(layout.impl));
}

void CL_Layout::remove_component(CL_Component *component)
{
}

void CL_Layout::remove_layout(CL_Layout *layout)
{
}

void CL_Layout::set_position(const CL_Rect &pos)
{
	if (impl == 0) return;
	impl->set_position(pos);
}

/////////////////////////////////////////////////////////////////////////////
// CL_Layout implementation:
