/*  $Id: messagebox.cpp,v 1.19 2003/09/18 17:53:29 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 <string>
#include "API/GUI/messagebox.h"
#include "API/GUI/stylemanager.h"
#include "API/GUI/gui_manager.h"
#include "API/Core/XML/dom_element.h"
#include "messagebox_generic.h"

/////////////////////////////////////////////////////////////////////////////
// Construction:

CL_MessageBox::CL_MessageBox(
	const std::string &title,
	const std::string &text,
	const std::string &button1,
	const std::string &button2,
	const std::string &button3,
	CL_Component *parent,
	CL_StyleManager *style)
: CL_Window(parent, style), impl(0)
{
	impl = new CL_MessageBox_Generic(this, title, text, button1, button2, button3);
}

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

int CL_MessageBox::info(
	const std::string &text,
	CL_Component *parent,
	CL_StyleManager *style)
{
	CL_MessageBox message("Information", text, "Ok", "", "", parent, style);
	message.run();
	return message.get_result_button();
}

int CL_MessageBox::info(
	const std::string &title,
	const std::string &text,
	CL_Component *parent,
	CL_StyleManager *style)
{
	CL_MessageBox message(title, text, "Ok", "", "", parent, style);
	message.run();
	return message.get_result_button();
}

int CL_MessageBox::info(
	const std::string &title,
	const std::string &text,
	const std::string &button1,
	const std::string &button2,
	const std::string &button3,
	CL_Component *parent,
	CL_StyleManager *style)
{
	CL_MessageBox message(title, text, button1, button2, button3, parent, style);
	message.run();
	return message.get_result_button();
}

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

int CL_MessageBox::get_result_button() const
{
	return impl->result_button;
}
