CompMessage.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /* Copyright (c) 2002-2012 Croteam Ltd.
  2. This program is free software; you can redistribute it and/or modify
  3. it under the terms of version 2 of the GNU General Public License as published by
  4. the Free Software Foundation
  5. This program is distributed in the hope that it will be useful,
  6. but WITHOUT ANY WARRANTY; without even the implied warranty of
  7. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  8. GNU General Public License for more details.
  9. You should have received a copy of the GNU General Public License along
  10. with this program; if not, write to the Free Software Foundation, Inc.,
  11. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
  12. #ifndef SE_INCL_COMPMESSAGE_H
  13. #define SE_INCL_COMPMESSAGE_H
  14. #ifdef PRAGMA_ONCE
  15. #pragma once
  16. #endif
  17. class CCompMessage {
  18. public:
  19. CTFileName cm_fnmFileName; // message identificator
  20. CCompMessageID *cm_pcmiOriginal; // identifier in player's array
  21. BOOL cm_bLoaded; // set if message is loaded
  22. CTString cm_strSubject; // message subject
  23. enum ImageType {
  24. IT_NONE,
  25. IT_MODEL,
  26. IT_PICTURE,
  27. IT_STATISTICS,
  28. } cm_itImage; // accompanying image if any
  29. CTString cm_strModel; // name of model if model
  30. CTFileName cm_fnmPicture; // filename of picture if picture
  31. CTString cm_strText; // original message text
  32. BOOL cm_bRead;
  33. INDEX cm_ctFormattedWidth; // chars per row in formatted text
  34. INDEX cm_ctFormattedLines; // number of lines in formatted text
  35. CTString cm_strFormattedText; // text formatted for given line width
  36. // load the message from file
  37. void Load_t(void); // throw char *
  38. // format message for given line width
  39. void Format(INDEX ctCharsPerLine);
  40. public:
  41. CCompMessage(void);
  42. void Clear(void);
  43. // constructs message from ID
  44. void SetMessage(CCompMessageID *pcmi);
  45. // prepare message for using (load, format, etc.)
  46. void PrepareMessage(INDEX ctCharsPerLine);
  47. // free memory used by message, but keep message filename
  48. void UnprepareMessage(void);
  49. // mark message as read
  50. void MarkRead(void);
  51. // get one formatted line
  52. CTString GetLine(INDEX iLine);
  53. };
  54. #endif /* include-once check. */