1 //  Copyright (C) 2010, 2012, 2014 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 #pragma once
19 #ifndef USE_ITEM_ON_PLAYER_DIALOG_H
20 #define USE_ITEM_ON_PLAYER_DIALOG_H
21 
22 #include <memory>
23 #include <vector>
24 #include <gtkmm.h>
25 
26 #include "citymap.h"
27 #include "lw-dialog.h"
28 
29 class Player;
30 
31 // dialog for targetting a player when using an item.
32 class UseItemOnPlayerDialog: public LwDialog
33 {
34  public:
35     UseItemOnPlayerDialog(Gtk::Window &parent);
~UseItemOnPlayerDialog()36     ~UseItemOnPlayerDialog() {delete citymap;};
37 
hide()38     void hide() {dialog->hide();};
39     Player *run();
40 
41  private:
42     CityMap* citymap;
43 
44     Gtk::TreeView *player_treeview;
45 
46     class PlayersColumns: public Gtk::TreeModelColumnRecord {
47     public:
PlayersColumns()48 	PlayersColumns()
49         { add(image); add(name); add(player);}
50 
51 	Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf> > image;
52 	Gtk::TreeModelColumn<Glib::ustring> name;
53         Gtk::TreeModelColumn<Player*> player;
54     };
55     const PlayersColumns players_columns;
56     Glib::RefPtr<Gtk::ListStore> players_list;
57 
58     Gtk::Image *map_image;
59     Gtk::Button *continue_button;
60 
61     void on_map_changed(Cairo::RefPtr<Cairo::Surface> map);
62     void addPlayer(Player *player);
63     Player *grabSelectedPlayer();
64 
65     void on_player_selected();
66 };
67 
68 #endif
69