LayoutScheme.h 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. /*
  2. ** Command & Conquer Generals Zero Hour(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: LayoutScheme.h ///////////////////////////////////////////////////////
  24. //-----------------------------------------------------------------------------
  25. //
  26. // Westwood Studios Pacific.
  27. //
  28. // Confidential Information
  29. // Copyright (C) 2001 - All Rights Reserved
  30. //
  31. //-----------------------------------------------------------------------------
  32. //
  33. // Project: GUIEdit
  34. //
  35. // File name: LayoutScheme.h
  36. //
  37. // Created: Colin Day, August 2001
  38. //
  39. // Desc: Layout scheme editing and loading
  40. //
  41. //-----------------------------------------------------------------------------
  42. ///////////////////////////////////////////////////////////////////////////////
  43. #pragma once
  44. #ifndef __LAYOUTSCHEME_H_
  45. #define __LAYOUTSCHEME_H_
  46. // SYSTEM INCLUDES ////////////////////////////////////////////////////////////
  47. #include <windows.h>
  48. // USER INCLUDES //////////////////////////////////////////////////////////////
  49. #include "Lib/BaseType.h"
  50. #include "Properties.h"
  51. // FORWARD REFERENCES /////////////////////////////////////////////////////////
  52. ///////////////////////////////////////////////////////////////////////////////
  53. // TYPE DEFINES ///////////////////////////////////////////////////////////////
  54. ///////////////////////////////////////////////////////////////////////////////
  55. // LayoutScheme ---------------------------------------------------------------
  56. /** The layout scheme provides a place for default look of newly
  57. * created controls and windows */
  58. //-----------------------------------------------------------------------------
  59. class LayoutScheme
  60. {
  61. public:
  62. LayoutScheme();
  63. ~LayoutScheme();
  64. void init( void );
  65. void openDialog( void ); ///< open the scheme info and editing dialog
  66. char *getSchemeFilename( void ); ///< get the scheme filename
  67. void setSchemeFilename( char *filename ); ///< set the scheme filename
  68. Bool saveScheme( char *filename ); ///< save the current scheme to file
  69. Bool loadScheme( char *filename ); ///< load the scheme file
  70. ImageAndColorInfo *getImageAndColor( StateIdentifier id );
  71. void storeImageAndColor( StateIdentifier id, const Image *image,
  72. Color color, Color borderColor );
  73. void setFont( GameFont *font );
  74. GameFont *getFont( void );
  75. Color getEnabledTextColor( void );
  76. Color getEnabledTextBorderColor( void );
  77. Color getDisabledTextColor( void );
  78. Color getDisabledTextBorderColor( void );
  79. Color getHiliteTextColor( void );
  80. Color getHiliteTextBorderColor( void );
  81. void setEnabledTextColor( Color c );
  82. void setEnabledTextBorderColor( Color c );
  83. void setDisabledTextColor( Color c );
  84. void setDisabledTextBorderColor( Color c );
  85. void setHiliteTextColor( Color c );
  86. void setHiliteTextBorderColor( Color c );
  87. /** apply the image and color info stored in the state identifer tables
  88. used for "property editing" to all appropriate windows currently
  89. loaded in the editor */
  90. void applyPropertyTablesToWindow( GameWindow *root );
  91. protected:
  92. ImageAndColorInfo *findEntry( StateIdentifier id );
  93. char m_schemeFilename[ _MAX_PATH ]; ///< filename
  94. ImageAndColorInfo m_imageAndColorTable[ NUM_STATE_IDENTIFIERS ]; // the color and image info
  95. TextDrawData m_enabledText; ///< default text colors
  96. TextDrawData m_disabledText; ///< default text colors
  97. TextDrawData m_hiliteText; ///< default text colors
  98. GameFont *m_font; ///< default font
  99. }; // end LayoutScheme
  100. ///////////////////////////////////////////////////////////////////////////////
  101. // INLINING ///////////////////////////////////////////////////////////////////
  102. ///////////////////////////////////////////////////////////////////////////////
  103. inline char *LayoutScheme::getSchemeFilename( void ) { return m_schemeFilename; }
  104. inline void LayoutScheme::setSchemeFilename( char *filename ) { strcpy( m_schemeFilename, filename ); }
  105. inline Color LayoutScheme::getEnabledTextColor( void ) { return m_enabledText.color; }
  106. inline Color LayoutScheme::getEnabledTextBorderColor( void ) { return m_enabledText.borderColor; }
  107. inline Color LayoutScheme::getDisabledTextColor( void ) { return m_disabledText.color; }
  108. inline Color LayoutScheme::getDisabledTextBorderColor( void ) { return m_disabledText.borderColor; }
  109. inline Color LayoutScheme::getHiliteTextColor( void ) { return m_hiliteText.color; }
  110. inline Color LayoutScheme::getHiliteTextBorderColor( void ) { return m_hiliteText.borderColor; }
  111. inline void LayoutScheme::setEnabledTextColor( Color c ) { m_enabledText.color = c; }
  112. inline void LayoutScheme::setEnabledTextBorderColor( Color c ) { m_enabledText.borderColor = c; }
  113. inline void LayoutScheme::setDisabledTextColor( Color c ) { m_disabledText.color = c; }
  114. inline void LayoutScheme::setDisabledTextBorderColor( Color c ) { m_disabledText.borderColor = c; }
  115. inline void LayoutScheme::setHiliteTextColor( Color c ) { m_hiliteText.color = c; }
  116. inline void LayoutScheme::setHiliteTextBorderColor( Color c ) { m_hiliteText.borderColor = c; }
  117. inline void LayoutScheme::setFont( GameFont *font ) { m_font = font; }
  118. inline GameFont *LayoutScheme::getFont( void ) { return m_font; }
  119. ///////////////////////////////////////////////////////////////////////////////
  120. // EXTERNALS //////////////////////////////////////////////////////////////////
  121. ///////////////////////////////////////////////////////////////////////////////
  122. extern LayoutScheme *TheDefaultScheme;
  123. #endif // end __LAYOUTSCHEME_H_