1 // Copyright (C) 2007 Ole Laursen
2 // Copyright (C) 2007, 2008, 2009 Ben Asselstine
4 // This program is free software; you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation; either version 3 of the License, or
7 // (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Library General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23 #include <sigc++/trackable.h>
27 #include "heroesmap.h"
33 #include "decorated.h"
35 // dialog for showing info about a hero, esp. about the hero's items
36 class HeroDialog: public Decorated
39 HeroDialog(Hero *hero, Vector<int> pos);
42 void set_parent_window(Gtk::Window &parent);
53 Gtk::Image *map_image;
54 Gtk::TreeView *heroes_treeview;
55 Gtk::TreeView *item_treeview;
56 Gtk::TreeView *events_treeview;
57 Gtk::Button *drop_button;
58 Gtk::Button *pickup_button;
59 Gtk::Label *info_label1;
60 Gtk::Label *info_label2;
61 Gtk::Button *next_button;
62 Gtk::Button *prev_button;
64 class HeroesColumns: public Gtk::TreeModelColumnRecord {
67 { add(hero); add(name); }
69 Gtk::TreeModelColumn<Hero *> hero;
70 Gtk::TreeModelColumn<Glib::ustring> name;
72 const HeroesColumns heroes_columns;
73 Glib::RefPtr<Gtk::ListStore> heroes_list;
75 class ItemColumns: public Gtk::TreeModelColumnRecord {
78 { add(image); add(name); add(attributes); add(status); add(item); }
80 Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixmap> > image;
81 Gtk::TreeModelColumn<Glib::ustring> name;
82 Gtk::TreeModelColumn<Glib::ustring> attributes;
83 Gtk::TreeModelColumn<Glib::ustring> status;
84 Gtk::TreeModelColumn<Item *> item;
86 const ItemColumns item_columns;
87 Glib::RefPtr<Gtk::ListStore> item_list;
89 class EventsColumns: public Gtk::TreeModelColumnRecord {
92 { add(desc); add(history); }
94 Gtk::TreeModelColumn<Glib::ustring> desc;
95 Gtk::TreeModelColumn<History *> history;
97 const EventsColumns events_columns;
98 Glib::RefPtr<Gtk::ListStore> events_list;
100 void on_hero_changed();
101 void on_item_selection_changed();
102 void on_drop_clicked();
103 void on_pickup_clicked();
104 void on_next_clicked();
105 void on_prev_clicked();
107 void add_item(Item *item, bool in_backpack);
108 void add_hero(Hero *hero);
109 void addHistoryEvent(History *event);
110 void fill_in_info_labels();
112 void on_map_changed(Glib::RefPtr<Gdk::Pixmap> map);
113 bool on_map_mouse_button_event(GdkEventButton *e);
115 void update_buttons();
116 bool inhibit_hero_changed;
117 void update_hero_list();