ChatWindow.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. #ifndef CHATWINDOW_H
  2. #define CHATWINDOW_H
  3. //===========================================================================//
  4. //ChatWindow.h : Interface for the ChatWindow component.
  5. //---------------------------------------------------------------------------//
  6. // Copyright (C) Microsoft Corporation. All rights reserved. //
  7. //===========================================================================//
  8. #ifndef LOGISTICSSCREEN_H
  9. #include "LogisticsScreen.h"
  10. #endif
  11. //*************************************************************************************************
  12. /**************************************************************************************************
  13. CLASS DESCRIPTION
  14. ChatWindow:
  15. **************************************************************************************************/
  16. #ifndef ALISTBOX_H
  17. #include "aListBox.h"
  18. #endif
  19. class ChatMessageItem : public aListItem
  20. {
  21. public:
  22. ChatMessageItem();
  23. void setPlayerColor(long color);
  24. void setTextColor( long color );
  25. void setPlayerName( const char* name );
  26. int setText( const char* text ); // returns number of lines
  27. long getLineCount() { return lineCount; }
  28. private:
  29. aText name;
  30. aText playerText;
  31. aRect playerRect;
  32. long lineCount;
  33. };
  34. class ChatWidget : public LogisticsScreen // the one that obscures....
  35. {
  36. public:
  37. ChatWidget();
  38. virtual ~ChatWidget();
  39. void init();
  40. private:
  41. friend class ChatWindow;
  42. aListBox listBox;
  43. ChatMessageItem listItems[128];
  44. long curItem;
  45. };
  46. class ChatWindow: public LogisticsScreen
  47. {
  48. public:
  49. ChatWindow();
  50. virtual ~ChatWindow();
  51. static void init();
  52. static void destroy();
  53. static ChatWindow* instance() { return s_instance; }
  54. int initInstance();
  55. virtual void update();
  56. virtual void render( int xOffset, int yOffset );
  57. int handleMessage( unsigned long, unsigned long );
  58. virtual bool pointInside( long xPos, long yPos );
  59. bool isExpanded();
  60. private:
  61. static ChatWindow* s_instance;
  62. aListBox listBox;
  63. aEdit chatEdit;
  64. ChatWidget chatWidget;
  65. ChatMessageItem listItems[4];
  66. long curItem;
  67. long maxItems;
  68. static void refillListBox( aListBox& listBox, char** chatTexts, long* playerIDs, ChatMessageItem* pItems,
  69. long& curItem, long itemCount, long maxCount );
  70. };
  71. //*************************************************************************************************
  72. #endif // end of file ( ChatWindow.h )