/*  $Id: window.cpp,v 1.27 2004/01/02 11:27:01 sphair 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/window.h"
#include "API/GUI/stylemanager.h"
#include "API/GUI/gui_manager.h"
#include "API/Core/XML/dom_element.h"
#include "window_generic.h"

/////////////////////////////////////////////////////////////////////////////
// Construction

CL_Window::CL_Window(
	CL_Component *parent,
	CL_StyleManager *style)
: CL_Component(parent, style), impl(0)
{
	impl = new CL_Window_Generic(this, std::string());
	get_style_manager()->connect_styles("window", this);
	find_preferred_size();
}

CL_Window::CL_Window(
	const CL_Rect &pos,
	const std::string &title,
	CL_Component *parent,
	CL_StyleManager *style)
: CL_Component(pos, parent, style), impl(0)
{
	impl = new CL_Window_Generic(this, title);
	get_style_manager()->connect_styles("window", this);
}

CL_Window::CL_Window(
	const CL_Rect &pos,
	CL_Component *parent,
	CL_StyleManager *style)
: CL_Component(pos, parent, style), impl(0)
{
	impl = new CL_Window_Generic(this, std::string());
	get_style_manager()->connect_styles("window", this);
}

CL_Window::CL_Window(
	const std::string &title,
	CL_Component *parent,
	CL_StyleManager *style)
: CL_Component(parent, style), impl(0)
{
	impl = new CL_Window_Generic(this, title);
	get_style_manager()->connect_styles("window", this);
	find_preferred_size();
}

CL_Window::~CL_Window()
{
	delete impl;
}

/////////////////////////////////////////////////////////////////////////////
// Attributes:

const std::string &CL_Window::get_title() const
{
	return impl->title;
}

/////////////////////////////////////////////////////////////////////////////
// Operations:

void CL_Window::set_title(const std::string &text)
{
	impl->title = text;
}

/////////////////////////////////////////////////////////////////////////////
// Signals:
