initial commit, lordsawar source, slightly modified
[lordsawar] / src / gui / surrender-refused-dialog.cpp
1 //  Copyright (C) 2008, 2009 Ben Asselstine
2 //
3 //  This program is free software; you can redistribute it and/or modify
4 //  it under the terms of the GNU General Public License as published by
5 //  the Free Software Foundation; either version 3 of the License, or
6 //  (at your option) any later version.
7 //
8 //  This program is distributed in the hope that it will be useful,
9 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
10 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 //  GNU Library General Public License for more details.
12 //
13 //  You should have received a copy of the GNU General Public License
14 //  along with this program; if not, write to the Free Software
15 //  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 
16 //  02110-1301, USA.
17
18 #include <config.h>
19
20 #include <gtkmm.h>
21 #include <sigc++/functors/mem_fun.h>
22
23 #include "surrender-refused-dialog.h"
24
25 #include "glade-helpers.h"
26 #include "image-helpers.h"
27 #include "input-helpers.h"
28 #include "ucompose.hpp"
29 #include "defs.h"
30 #include "File.h"
31
32 SurrenderRefusedDialog::SurrenderRefusedDialog()
33 {
34     Glib::RefPtr<Gtk::Builder> xml
35         = Gtk::Builder::create_from_file(get_glade_path()
36                                     + "/surrender-refused-dialog.ui");
37
38     xml->get_widget("dialog", dialog);
39     decorate(dialog);
40     window_closed.connect(sigc::mem_fun(dialog, &Gtk::Dialog::hide));
41
42     Gtk::Label *label;
43     xml->get_widget("label", label);
44     xml->get_widget("image", image);
45     
46     label->set_text(_("Off with their heads!  I want it ALL!"));
47     image->property_file()
48       = File::getMiscFile("various/parley_refused.png");
49 }
50
51 SurrenderRefusedDialog::~SurrenderRefusedDialog()
52 {
53   delete dialog;
54 }
55
56 void SurrenderRefusedDialog::set_parent_window(Gtk::Window &parent)
57 {
58   dialog->set_transient_for(parent);
59   //dialog->set_position(Gtk::WIN_POS_CENTER_ON_PARENT);
60 }
61
62 void SurrenderRefusedDialog::hide()
63 {
64   dialog->hide();
65 }
66
67 void SurrenderRefusedDialog::run()
68 {
69   dialog->run();
70   return;
71 }