1 /* 2 * Copyright (c) 1997 - 2003 Hansj�rg Malthaner 3 * 4 * This file is part of the Simutrans project under the artistic licence. 5 * (see licence.txt) 6 */ 7 8 #ifndef message_stats_t_h 9 #define message_stats_t_h 10 11 #include "components/gui_component.h" 12 #include "../simmesg.h" 13 #include "../tpl/slist_tpl.h" 14 15 16 /** 17 * City list stats display 18 * @author Hj. Malthaner 19 */ 20 class message_stats_t : public gui_world_component_t 21 { 22 private: 23 message_t *msg; 24 sint32 message_type; // Knightly : message type for filtering; -1 indicates no filtering 25 uint32 last_count; 26 sint32 message_selected; 27 const slist_tpl<message_t::node *> *message_list; // Knightly : points to the active message list (original or filtered) 28 slist_tpl<message_t::node *> filtered_messages; // Knightly : cache the list of messages belonging to a certain type 29 30 scr_size min_size; 31 public: 32 message_stats_t(); ~message_stats_t()33 ~message_stats_t() { filtered_messages.clear(); } 34 35 /** 36 * Filter messages by type 37 * @return whether there is a change in message filtering 38 * @author Knightly 39 */ 40 bool filter_messages(const sint32 msg_type); 41 42 bool infowin_event(event_t const*) OVERRIDE; 43 44 /** 45 * Recalc the size required to display everything and set size and min_size. 46 */ 47 void recalc_size(); 48 49 /** 50 * Draw the component 51 * @author Hj. Malthaner 52 */ 53 void draw(scr_coord offset) OVERRIDE; 54 55 get_max_size()56 scr_size get_max_size() const OVERRIDE { 57 return get_min_size(); 58 } 59 get_min_size()60 scr_size get_min_size() const OVERRIDE { 61 return min_size; 62 } 63 64 }; 65 66 #endif 67