initial commit, lordsawar source, slightly modified
[lordsawar] / src / gui / load-scenario-dialog.h
1 //  Copyright (C) 2007 Ole Laursen
2 //  Copyright (C) 2007, 2008, 2009 Ben Asselstine
3 //
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.
8 //
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.
13 //
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 
17 //  02110-1301, USA.
18
19 #ifndef LOAD_SCENARIOS_DIALOG_H
20 #define LOAD_SCENARIOS_DIALOG_H
21
22 #include <memory>
23 #include <string>
24 #include <sigc++/trackable.h>
25 #include <sigc++/signal.h>
26 #include <gtkmm.h>
27
28 #include "decorated.h"
29 // dialog for choosing a scenario
30 class LoadScenarioDialog: public Decorated
31 {
32  public:
33     LoadScenarioDialog();
34     ~LoadScenarioDialog();
35
36     void set_parent_window(Gtk::Window &parent);
37
38     void run();
39     void hide();
40
41     std::string get_scenario_filename();
42
43  private:
44     Gtk::Dialog* dialog;
45     Gtk::Button *load_button;
46     Gtk::TextView *description_textview;
47     Gtk::Label *num_players_label;
48     Gtk::Label *num_cities_label;
49     Gtk::TreeView *scenarios_treeview;
50     Gtk::Button *add_scenario_button;
51     Gtk::Button *remove_scenario_button;
52
53     class ScenariosColumns: public Gtk::TreeModelColumnRecord {
54     public:
55         ScenariosColumns() 
56         { add(name); add(filename); }
57         
58         Gtk::TreeModelColumn<Glib::ustring> name;
59         Gtk::TreeModelColumn<std::string> filename;
60     };
61     const ScenariosColumns scenarios_columns;
62     Glib::RefPtr<Gtk::ListStore> scenarios_list;
63     
64     std::string selected_filename;
65     
66     void on_selection_changed();
67     void add_scenario(std::string filename);
68     void on_add_scenario_clicked();
69     void on_remove_scenario_clicked();
70     int copy_file (Glib::ustring from, Glib::ustring to);
71 };
72
73 #endif