ShellMenuScheme.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. /*
  2. ** Command & Conquer Generals(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. ////////////////////////////////////////////////////////////////////////////////
  19. // //
  20. // (c) 2001-2003 Electronic Arts Inc. //
  21. // //
  22. ////////////////////////////////////////////////////////////////////////////////
  23. // FILE: ShellMenuScheme.h /////////////////////////////////////////////////
  24. //-----------------------------------------------------------------------------
  25. //
  26. // Electronic Arts Pacific.
  27. //
  28. // Confidential Information
  29. // Copyright (C) 2002 - All Rights Reserved
  30. //
  31. //-----------------------------------------------------------------------------
  32. //
  33. // created: Jul 2002
  34. //
  35. // Filename: ShellMenuScheme.h
  36. //
  37. // author: Chris Huybregts
  38. //
  39. // purpose:
  40. //
  41. //-----------------------------------------------------------------------------
  42. ///////////////////////////////////////////////////////////////////////////////
  43. #pragma once
  44. #ifndef __SHELL_MENU_SCHEME_H_
  45. #define __SHELL_MENU_SCHEME_H_
  46. //-----------------------------------------------------------------------------
  47. // SYSTEM INCLUDES ////////////////////////////////////////////////////////////
  48. //-----------------------------------------------------------------------------
  49. //-----------------------------------------------------------------------------
  50. // USER INCLUDES //////////////////////////////////////////////////////////////
  51. //-----------------------------------------------------------------------------
  52. #include "GameClient/Color.h"
  53. //-----------------------------------------------------------------------------
  54. // FORWARD REFERENCES /////////////////////////////////////////////////////////
  55. //-----------------------------------------------------------------------------
  56. class Image;
  57. //-----------------------------------------------------------------------------
  58. // TYPE DEFINES ///////////////////////////////////////////////////////////////
  59. //-----------------------------------------------------------------------------
  60. class ShellMenuSchemeLine
  61. {
  62. public:
  63. ShellMenuSchemeLine( void );
  64. ~ShellMenuSchemeLine( void );
  65. ICoord2D m_startPos;
  66. ICoord2D m_endPos;
  67. Int m_width;
  68. Color m_color;
  69. };
  70. class ShellMenuSchemeImage
  71. {
  72. public:
  73. ShellMenuSchemeImage( void );
  74. ~ShellMenuSchemeImage( void );
  75. AsciiString m_name; ///< Name of the image
  76. ICoord2D m_position; ///< the position we'll draw it at
  77. ICoord2D m_size; ///< the size of the image needed when we draw it
  78. Image *m_image; ///< the actual pointer to the mapped image
  79. };
  80. class ShellMenuScheme
  81. {
  82. public:
  83. ShellMenuScheme( void );
  84. ~ShellMenuScheme( void );
  85. void draw( void );
  86. void addImage( ShellMenuSchemeImage* schemeImage );
  87. void addLine( ShellMenuSchemeLine* schemeLine );
  88. AsciiString m_name;
  89. typedef std::list< ShellMenuSchemeImage* > ShellMenuSchemeImageList;
  90. typedef ShellMenuSchemeImageList::iterator ShellMenuSchemeImageListIt;
  91. ShellMenuSchemeImageList m_imageList;
  92. typedef std::list< ShellMenuSchemeLine* > ShellMenuSchemeLineList;
  93. typedef ShellMenuSchemeLineList::iterator ShellMenuSchemeLineListIt;
  94. ShellMenuSchemeLineList m_lineList;
  95. };
  96. class ShellMenuSchemeManager
  97. {
  98. public:
  99. ShellMenuSchemeManager( void );
  100. ~ShellMenuSchemeManager( void );
  101. void init( void );
  102. void update( void );
  103. void setShellMenuScheme( AsciiString name );
  104. void draw( void );
  105. // parse Functions for the INI file
  106. const FieldParse *getFieldParse() const { return m_shellMenuSchemeFieldParseTable; } ///< returns the parsing fields
  107. static const FieldParse m_shellMenuSchemeFieldParseTable[]; ///< the parse table
  108. static void parseImagePart( INI* ini, void *instance, void *store, const void *userData ); ///< Parse the image part of the INI file
  109. static void parseLinePart( INI* ini, void *instance, void *store, const void *userData ); ///< Parse the line part of the INI file
  110. ShellMenuScheme *newShellMenuScheme(AsciiString name);
  111. private:
  112. typedef std::list< ShellMenuScheme* > ShellMenuSchemeList; ///< list of Shell Menu schemes
  113. typedef ShellMenuSchemeList::iterator ShellMenuSchemeListIt;
  114. ShellMenuSchemeList m_schemeList;
  115. ShellMenuScheme *m_currentScheme;
  116. };
  117. //-----------------------------------------------------------------------------
  118. // INLINING ///////////////////////////////////////////////////////////////////
  119. //-----------------------------------------------------------------------------
  120. //-----------------------------------------------------------------------------
  121. // EXTERNALS //////////////////////////////////////////////////////////////////
  122. //-----------------------------------------------------------------------------
  123. #endif // __SHELL_MENU_SCHEME_H_