// My_About_Dialog.h
// Creates a standard "About" dialog.
//
// Copyright (C) 2000 Bradley D. LaRonde <brad@ltc.com>
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program 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 General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#include <stdio.h>
#include <flpda/Widget_Factory.h>

#define RESTRICTED_LICENSE

class My_About_Dialog {
private:
static void done_cb(Fl_Widget* w, void* data) {
	Fl_Window* window = reinterpret_cast<Fl_Window*>(data);
	// window->hide();
	delete window;
}

public:
My_About_Dialog(const char* application, const char* version)
{
	Fl_App_Window* window = Widget_Factory::new_window("About");
	window->set_modal();

	Fl_Browser* b = Widget_Factory::new_select_browser(0, 0,
		Fl_Group::current()->w(), Fl_Group::current()->h());
	Fl_Group::current()->resizable(b);
	b->callback(done_cb, window);
	b->add("");
	char msg[256];
	sprintf(msg, "@c@b%s %s", application, version);
	b->add(msg);
	b->add("");

	b->add("@cCopyright (C) 2001");
	b->add("@cKent Dahl");
	b->add("@c<MenThal@bigfoot.com>");

	b->add("");
	b->add("@cLicensed under the");
	b->add("@cGNU General Public License.");
	b->add("@cThis is free software, and you");
	b->add("@care welcome to redistribute it");
	b->add("@cunder certain conditions.");

	b->add("");
	sprintf(msg, "@c%s comes with", application);
	b->add(msg);
	b->add("@cABSOLUTELY NO WARRANTY.");

	window->end();

	Fl_Dockable_Window* toolbar = Widget_Factory::new_toolbar();
	Widget_Factory::new_button("Done", done_cb, window);
	toolbar->end();

	window->add_dockable(toolbar, 1);

	window->show();
}
};

