1 // Copyright (C) 2007, 2008, 2009 Ben Asselstine
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.
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.
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
21 #include <sigc++/functors/mem_fun.h>
23 #include "quest-assigned-dialog.h"
25 #include "glade-helpers.h"
26 #include "image-helpers.h"
27 #include "input-helpers.h"
28 #include "ucompose.hpp"
32 QuestAssignedDialog::QuestAssignedDialog(Hero *h, Quest *q)
37 Glib::RefPtr<Gtk::Builder> xml
38 = Gtk::Builder::create_from_file(get_glade_path()
39 + "/quest-assigned-dialog.ui");
41 xml->get_widget("dialog", dialog);
43 window_closed.connect(sigc::mem_fun(dialog, &Gtk::Dialog::hide));
45 xml->get_widget("map_image", map_image);
47 questmap = new QuestMap(quest);
48 questmap->map_changed.connect(
49 sigc::mem_fun(this, &QuestAssignedDialog::on_map_changed));
51 Gtk::EventBox *map_eventbox;
52 xml->get_widget("map_eventbox", map_eventbox);
54 set_title(String::ucompose(_("Quest for %1"), hero->getName()));
56 xml->get_widget("label", label);
59 s = quest->getDescription();
61 s = _("This hero already has a quest.");
66 QuestAssignedDialog::~QuestAssignedDialog()
71 void QuestAssignedDialog::set_parent_window(Gtk::Window &parent)
73 dialog->set_transient_for(parent);
74 //dialog->set_position(Gtk::WIN_POS_CENTER_ON_PARENT);
77 void QuestAssignedDialog::hide()
82 void QuestAssignedDialog::run()
85 questmap->draw(Playerlist::getActiveplayer());
91 void QuestAssignedDialog::on_map_changed(Glib::RefPtr<Gdk::Pixmap> map)
93 map_image->property_pixmap() = map;