ComponentListBox.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. #ifndef COMPONENTLISTBOX_H
  2. #define COMPONENTLISTBOX_H
  3. /*************************************************************************************************\
  4. ComponentListBox.h : Interface for the ComponentListBox component.
  5. //---------------------------------------------------------------------------//
  6. // Copyright (C) Microsoft Corporation. All rights reserved. //
  7. //===========================================================================//
  8. \*************************************************************************************************/
  9. #ifndef ALISTBOX_H
  10. #include "aListBox.h"
  11. #endif
  12. #ifndef AANIM_H
  13. #include "aanim.h"
  14. #endif
  15. #ifndef ELIST_H
  16. #include "eList.h"
  17. #endif
  18. class LogisticsVariant;
  19. class LogisticsComponent;
  20. class LogisticsVehicle;
  21. #define COMP_ANIMATION_COUNT 5
  22. //*************************************************************************************************
  23. /**************************************************************************************************
  24. CLASS DESCRIPTION
  25. ComponentListBox:
  26. **************************************************************************************************/
  27. // complex list box items, icons and all
  28. class ComponentListItem : public aListItem
  29. {
  30. public:
  31. ComponentListItem( LogisticsComponent* pComp );
  32. virtual ~ComponentListItem();
  33. static int init( FitIniFile& file );
  34. LogisticsComponent* getComponent() { return pComponent; }
  35. virtual void render();
  36. void update();
  37. private:
  38. friend class ComponentIconListBox;
  39. static ComponentListItem* s_templateItem;
  40. aText name;
  41. aText costText;
  42. aText heatText;
  43. aObject costIcon;
  44. aObject heatIcon;
  45. aObject icon;
  46. aRect iconOutline;
  47. aRect outline;
  48. aText disabledText;
  49. aAnimGroup animations[COMP_ANIMATION_COUNT];
  50. aAnimGroup* pChildAnims[6];
  51. LogisticsComponent* pComponent;
  52. static void assignAnimation( FitIniFile& file,
  53. int whichChild, char animNames[COMP_ANIMATION_COUNT][32], aObject* pObject );
  54. void doAdd();
  55. void setComponent();
  56. void startDrag();
  57. };
  58. class ComponentIconListBox : public aListBox
  59. {
  60. public:
  61. ComponentIconListBox();
  62. virtual ~ComponentIconListBox();
  63. void setType( int Type, int orThisType, int orThis);
  64. virtual void update();
  65. LogisticsComponent* getComponent();
  66. int selectFirstAvailableComponent();
  67. static ComponentIconListBox* s_instance;
  68. private:
  69. ComponentIconListBox( const ComponentIconListBox& src );
  70. ComponentIconListBox& operator=( const ComponentIconListBox& src );
  71. EList<ComponentListItem*, ComponentListItem*> masterComponentList;
  72. int type;
  73. void addSortedItem( ComponentListItem* pItem );
  74. };
  75. //*************************************************************************************************
  76. #endif // end of file ( ComponentListBox.h )