1 // Copyright (C) 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
18 #ifndef NETWORK_GAME_SELECTOR_DIALOG_H
19 #define NETWORK_GAME_SELECTOR_DIALOG_H
23 #include <sigc++/trackable.h>
26 class RecentlyPlayedNetworkedGame;
27 #include "decorated.h"
28 // dialog for joining remote games
29 class NetworkGameSelectorDialog: public Decorated
32 NetworkGameSelectorDialog();
33 ~NetworkGameSelectorDialog();
35 sigc::signal<void, std::string /*ip*/, unsigned short /*port*/> game_selected;
37 void set_parent_window(Gtk::Window &parent);
44 Gtk::Entry *hostname_entry;
45 Gtk::SpinButton *port_spinbutton;
46 Gtk::Button *connect_button;
47 Gtk::Button *clear_button;
49 void on_hostname_changed();
51 Gtk::TreeView *recent_treeview;
53 class RecentlyJoinedGamesColumns: public Gtk::TreeModelColumnRecord {
55 RecentlyJoinedGamesColumns()
56 { add(name); add(turn);
57 add(number_of_players); add(number_of_cities); add(host); add(port);}
59 Gtk::TreeModelColumn<Glib::ustring> name;
60 Gtk::TreeModelColumn<unsigned int> turn;
61 Gtk::TreeModelColumn<unsigned int> number_of_players;
62 Gtk::TreeModelColumn<unsigned int> number_of_cities;
63 Gtk::TreeModelColumn<Glib::ustring> host;
64 Gtk::TreeModelColumn<unsigned int> port;
66 const RecentlyJoinedGamesColumns recently_joined_games_columns;
67 Glib::RefPtr<Gtk::ListStore> recently_joined_games_list;
68 void addRecentlyJoinedGame(RecentlyPlayedNetworkedGame*);
70 void on_recent_game_selected();
71 void on_clear_clicked();