1 #ifndef line_scrollitem_h 2 #define line_scrollitem_h 3 4 #include "components/gui_scrolled_list.h" 5 #include "../linehandle_t.h" 6 7 /** 8 * Container for list entries - consisting of text and color 9 */ 10 class line_scrollitem_t : public gui_scrolled_list_t::const_text_scrollitem_t 11 { 12 private: 13 linehandle_t line; 14 public: 15 // helper to sort 16 enum sort_modes_t { SORT_BY_NAME=0, SORT_BY_ID, SORT_BY_PROFIT, SORT_BY_TRANSPORTED, SORT_BY_CONVOIS, SORT_BY_DISTANCE, MAX_SORT_MODES }; 17 static sort_modes_t sort_mode; 18 // normal items line_scrollitem_t(linehandle_t l)19 line_scrollitem_t( linehandle_t l ) : gui_scrolled_list_t::const_text_scrollitem_t( NULL, color_idx_to_rgb(COL_ORANGE) ) { line = l; } 20 PIXVAL get_color() const OVERRIDE; get_line()21 linehandle_t get_line() const { return line; } 22 char const* get_text() const OVERRIDE; 23 void set_text(char const*) OVERRIDE; is_valid()24 bool is_valid() const OVERRIDE { return line.is_bound(); } // can be used to indicate invalid entries is_editable()25 bool is_editable() const OVERRIDE { return true; } 26 static bool compare(const gui_component_t *a, const gui_component_t *b ); 27 }; 28 29 #endif 30