00001 /* $Id$ */ 00002 00003 /* 00004 * This file is part of OpenTTD. 00005 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. 00006 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00007 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>. 00008 */ 00009 00012 #ifndef CARGODEST_GUI_H 00013 #define CARGODEST_GUI_H 00014 00015 #include "cargodest_base.h" 00016 #include "sortlist_type.h" 00017 00019 struct GUICargoLink { 00020 CargoID cid; 00021 const CargoLink *link; 00022 00023 GUICargoLink(CargoID c, const CargoLink *l) : cid(c), link(l) {} 00024 }; 00025 00027 class CargoDestinationList 00028 { 00029 private: 00030 const CargoSourceSink *obj; 00031 GUIList<GUICargoLink> link_list; 00032 00033 void RebuildList(); 00034 void SortList(); 00035 00036 public: 00037 CargoDestinationList(const CargoSourceSink *o); 00038 00039 void InvalidateData(); 00040 void Resort(); 00041 00042 uint GetListHeight() const; 00043 uint DrawList(uint left, uint right, uint y) const; 00044 00045 void OnClick(uint y) const; 00046 }; 00047 00048 #endif /* CARGODEST_GUI_H */