1 /*
2  * Copyright (C) 2002-2020 by the Widelands Development Team
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (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 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  02110-1301, USA.
17  *
18  */
19 
20 #include "wui/trainingsitewindow.h"
21 
22 #include "graphic/graphic.h"
23 #include "wui/soldiercapacitycontrol.h"
24 #include "wui/soldierlist.h"
25 
26 static char const* pic_tab_military = "images/wui/buildings/menu_tab_military.png";
27 
28 /**
29  * Create the \ref TrainingSite specific soldier list tab.
30  */
TrainingSiteWindow(InteractiveGameBase & parent,UI::UniqueWindow::Registry & reg,Widelands::TrainingSite & ts,bool avoid_fastclick,bool workarea_preview_wanted)31 TrainingSiteWindow::TrainingSiteWindow(InteractiveGameBase& parent,
32                                        UI::UniqueWindow::Registry& reg,
33                                        Widelands::TrainingSite& ts,
34                                        bool avoid_fastclick,
35                                        bool workarea_preview_wanted)
36    : ProductionSiteWindow(parent, reg, ts, avoid_fastclick, workarea_preview_wanted),
37      training_site_(&ts) {
38 	init(avoid_fastclick, workarea_preview_wanted);
39 }
40 
init(bool avoid_fastclick,bool workarea_preview_wanted)41 void TrainingSiteWindow::init(bool avoid_fastclick, bool workarea_preview_wanted) {
42 	Widelands::ProductionSite* training_site = training_site_.get(igbase()->egbase());
43 	assert(training_site != nullptr);
44 	ProductionSiteWindow::init(avoid_fastclick, workarea_preview_wanted);
45 	get_tabs()->add("soldiers", g_gr->images().get(pic_tab_military),
46 	                create_soldier_list(*get_tabs(), *igbase(), *training_site),
47 	                _("Soldiers in training"));
48 	think();
49 }
50