GadgetTextEntry.h 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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: GadgetTextEntry.h ////////////////////////////////////////////////////
  24. //-----------------------------------------------------------------------------
  25. //
  26. // Westwood Studios Pacific.
  27. //
  28. // Confidential Information
  29. // Copyright (C) 2001 - All Rights Reserved
  30. //
  31. //-----------------------------------------------------------------------------
  32. //
  33. // Project: RTS3
  34. //
  35. // File name: GadgetTextEntry.h
  36. //
  37. // Created: Colin Day, June 2001
  38. //
  39. // Desc: Helpful interface for TextEntrys
  40. //
  41. // TextEntry IMAGE/COLOR organization
  42. //
  43. // note that windows that have an outlined text field will use the color
  44. // for the outline specified with the TextBorder... functions
  45. //
  46. //-----------------------------------------------------------------------------
  47. ///////////////////////////////////////////////////////////////////////////////
  48. #pragma once
  49. #ifndef __GADGETTEXTENTRY_H_
  50. #define __GADGETTEXTENTRY_H_
  51. // SYSTEM INCLUDES ////////////////////////////////////////////////////////////
  52. // USER INCLUDES //////////////////////////////////////////////////////////////
  53. #include "GameClient/GameWindowManager.h"
  54. // FORWARD REFERENCES /////////////////////////////////////////////////////////
  55. class GameWindow;
  56. // TYPE DEFINES ///////////////////////////////////////////////////////////////
  57. ///////////////////////////////////////////////////////////////////////////////
  58. // INLINING ///////////////////////////////////////////////////////////////////
  59. ///////////////////////////////////////////////////////////////////////////////
  60. inline void GadgetTextEntrySetText( GameWindow *g, UnicodeString text )
  61. {
  62. TheWindowManager->winSendSystemMsg( g, GEM_SET_TEXT, (WindowMsgData)&text, 0 );
  63. }
  64. extern UnicodeString GadgetTextEntryGetText( GameWindow *textentry ); ///< Get the text from the text entry field
  65. extern void GadgetTextEntrySetFont( GameWindow *g, GameFont *font ); ///< set font for window and edit text display strings
  66. inline void GadgetTextEntrySetTextColor( GameWindow *g, Color color )
  67. {
  68. Color back = g->winGetEnabledTextBorderColor();
  69. g->winSetEnabledTextColors(color,back);
  70. g->winSetDisabledTextColors(GameDarkenColor(color, 25),back);
  71. }
  72. // text colors
  73. // enabled
  74. inline void GadgetTextEntrySetEnabledImageLeft( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 0, image ); }
  75. inline void GadgetTextEntrySetEnabledImageRight( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 1, image ); }
  76. inline void GadgetTextEntrySetEnabledImageCenter( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 2, image ); }
  77. inline void GadgetTextEntrySetEnabledImageSmallCenter( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 3, image ); }
  78. inline void GadgetTextEntrySetEnabledColor( GameWindow *g, Color color ) { g->winSetEnabledColor( 0, color ); }
  79. inline void GadgetTextEntrySetEnabledBorderColor( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( 0, color ); }
  80. inline const Image *GadgetTextEntryGetEnabledImageLeft( GameWindow *g ) { return g->winGetEnabledImage( 0 ); }
  81. inline const Image *GadgetTextEntryGetEnabledImageRight( GameWindow *g ) { return g->winGetEnabledImage( 1 ); }
  82. inline const Image *GadgetTextEntryGetEnabledImageCenter( GameWindow *g ) { return g->winGetEnabledImage( 2 ); }
  83. inline const Image *GadgetTextEntryGetEnabledImageSmallCenter( GameWindow *g ) { return g->winGetEnabledImage( 3 ); }
  84. inline Color GadgetTextEntryGetEnabledColor( GameWindow *g ) { return g->winGetEnabledColor( 0 ); }
  85. inline Color GadgetTextEntryGetEnabledBorderColor( GameWindow *g ) { return g->winGetEnabledBorderColor( 0 ); }
  86. // disabled
  87. inline void GadgetTextEntrySetDisabledImageLeft( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 0, image ); }
  88. inline void GadgetTextEntrySetDisabledImageRight( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 1, image ); }
  89. inline void GadgetTextEntrySetDisabledImageCenter( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 2, image ); }
  90. inline void GadgetTextEntrySetDisabledImageSmallCenter( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 3, image ); }
  91. inline void GadgetTextEntrySetDisabledColor( GameWindow *g, Color color ) { g->winSetDisabledColor( 0, color ); }
  92. inline void GadgetTextEntrySetDisabledBorderColor( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( 0, color ); }
  93. inline const Image *GadgetTextEntryGetDisabledImageLeft( GameWindow *g ) { return g->winGetDisabledImage( 0 ); }
  94. inline const Image *GadgetTextEntryGetDisabledImageRight( GameWindow *g ) { return g->winGetDisabledImage( 1 ); }
  95. inline const Image *GadgetTextEntryGetDisabledImageCenter( GameWindow *g ) { return g->winGetDisabledImage( 2 ); }
  96. inline const Image *GadgetTextEntryGetDisabledImageSmallCenter( GameWindow *g ) { return g->winGetDisabledImage( 3 ); }
  97. inline Color GadgetTextEntryGetDisabledColor( GameWindow *g ) { return g->winGetDisabledColor( 0 ); }
  98. inline Color GadgetTextEntryGetDisabledBorderColor( GameWindow *g ) { return g->winGetDisabledBorderColor( 0 ); }
  99. // hilite
  100. inline void GadgetTextEntrySetHiliteImageLeft( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 0, image ); }
  101. inline void GadgetTextEntrySetHiliteImageRight( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 1, image ); }
  102. inline void GadgetTextEntrySetHiliteImageCenter( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 2, image ); }
  103. inline void GadgetTextEntrySetHiliteImageSmallCenter( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 3, image ); }
  104. inline void GadgetTextEntrySetHiliteColor( GameWindow *g, Color color ) { g->winSetHiliteColor( 0, color ); }
  105. inline void GadgetTextEntrySetHiliteBorderColor( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( 0, color ); }
  106. inline const Image *GadgetTextEntryGetHiliteImageLeft( GameWindow *g ) { return g->winGetHiliteImage( 0 ); }
  107. inline const Image *GadgetTextEntryGetHiliteImageRight( GameWindow *g ) { return g->winGetHiliteImage( 1 ); }
  108. inline const Image *GadgetTextEntryGetHiliteImageCenter( GameWindow *g ) { return g->winGetHiliteImage( 2 ); }
  109. inline const Image *GadgetTextEntryGetHiliteImageSmallCenter( GameWindow *g ) { return g->winGetHiliteImage( 3 ); }
  110. inline Color GadgetTextEntryGetHiliteColor( GameWindow *g ) { return g->winGetHiliteColor( 0 ); }
  111. inline Color GadgetTextEntryGetHiliteBorderColor( GameWindow *g ) { return g->winGetHiliteBorderColor( 0 ); }
  112. // EXTERNALS //////////////////////////////////////////////////////////////////
  113. #endif // __GADGETTEXTENTRY_H_