1 /*
2  * Copyright (c) 1997 - 2001 Hansj�rg Malthaner
3  *
4  * This file is part of the Simutrans project under the artistic licence.
5  * (see licence.txt)
6  */
7 
8 /*
9  * Convoi details component
10  */
11 #include "components/gui_aligned_container.h"
12 #include "components/gui_scrollpane.h"
13 #include "components/gui_button.h"
14 #include "components/gui_label.h"                  // 09-Dec-2001      Markus Weber    Added
15 #include "components/action_listener.h"
16 #include "../convoihandle_t.h"
17 
18 class scr_coord;
19 class karte_ptr_t;
20 
21 /**
22  * Fills information table for convoi
23  *
24  * @author Hj. Malthaner
25  * @date 22-Aug-01
26  */
27 class convoi_detail_t : public gui_aligned_container_t, private action_listener_t
28 {
29 public:
30 	enum sort_mode_t { by_destination=0, by_via=1, by_amount_via=2, by_amount=3, SORT_MODES=4 };
31 
32 private:
33 
34 	gui_aligned_container_t container;
35 	gui_scrollpane_t scrolly;
36 
37 	gui_label_buf_t label_power, label_odometer, label_resale, label_length, label_speed;
38 
39 	convoihandle_t cnv;
40 	button_t	sale_button;
41 	button_t withdraw_button;
42 
43 	static karte_ptr_t welt;
44 public:
45 	convoi_detail_t(convoihandle_t cnv = convoihandle_t());
46 
47 	/**
48 	 * Initializes layout, @p cnv needs to be valid.
49 	 */
50 	void init(convoihandle_t cnv);
51 
52 	void draw(scr_coord offset) OVERRIDE;
53 
54 	bool action_triggered(gui_action_creator_t*, value_t) OVERRIDE;
55 
56 	void update_labels();
57 
58 	void rdwr( loadsave_t *file );
59 };
60