1 //  Copyright (C) 2007, 2008, 2009, 2014, 2020 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 "surrender-dialog.h"
22 #include "defs.h"
23 #include "File.h"
24 #include "ImageCache.h"
25 #include "font-size.h"
26 
SurrenderDialog(Gtk::Window & parent,int numEnemies)27 SurrenderDialog::SurrenderDialog(Gtk::Window &parent, int numEnemies)
28  : LwDialog (parent, "surrender-dialog.ui")
29 {
30   Gtk::Label *label;
31   xml->get_widget("label", label);
32   xml->get_widget("image", image);
33 
34   Glib::ustring s = ngettext("Your enemy grudgingly surrenders!\n",
35                              "Your enemies respectfully surrender!\n",
36                              numEnemies);
37   s += _("Do you accept?");
38   label->set_text(s);
39   image->property_pixbuf() =
40     ImageCache::getInstance()->getDialogPic
41     (ImageCache::DIALOG_PARLEY_OFFERED,
42      FontSize::getInstance ()->get_height ())->to_pixbuf();
43 }
44