+/* $Id$
+
+This file is part of the MSP Märklin suite
+Copyright © 2009 Mikkosoft Productions, Mikko Rasa
+Distributed under the GPL
+*/
+
+#include "dialog.h"
+
+using namespace Msp;
+
+Dialog::Dialog(const GLtk::Resources &r):
+ GLtk::Widget(r),
+ GLtk::Panel(r),
+ stale(false)
+{
+ add(*(btn_ok=new GLtk::Button(res, "OK")));
+ btn_ok->set_style("green");
+ btn_ok->set_geometry(GLtk::Geometry(geom.w-40, 10, 30, 25));
+ btn_ok->signal_clicked.connect(sigc::mem_fun(this, &Dialog::on_ok_clicked));
+ btn_ok->signal_clicked.connect(signal_ok);
+ btn_ok->signal_clicked.connect(sigc::mem_fun(this, &Dialog::dismiss));
+
+ add(*(btn_cancel=new GLtk::Button(res, "Cncl")));
+ btn_cancel->set_style("red");
+ btn_cancel->set_geometry(GLtk::Geometry(geom.w-80, 10, 30, 25));
+ btn_cancel->signal_clicked.connect(signal_cancel);
+ btn_cancel->signal_clicked.connect(sigc::mem_fun(this, &Dialog::dismiss));
+}
+
+void Dialog::button_release(int x, int y, unsigned btn)
+{
+ Panel::button_release(x, y, btn);
+ if(stale)
+ delete this;
+}
+
+void Dialog::on_geometry_change()
+{
+ btn_ok->set_geometry(GLtk::Geometry(geom.w-40, 10, 30, 25));
+ btn_cancel->set_geometry(GLtk::Geometry(geom.w-80, 10, 30, 25));
+}
+
+void Dialog::dismiss()
+{
+ stale = true;
+}