GadgetProgressBar.cpp 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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: ProgressBar.cpp //////////////////////////////////////////////////////
  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: ProgressBar.cpp
  36. //
  37. // Created: Colin Day, June 2001
  38. //
  39. // Desc: Progress bar GUI control
  40. //
  41. //-----------------------------------------------------------------------------
  42. ///////////////////////////////////////////////////////////////////////////////
  43. // SYSTEM INCLUDES ////////////////////////////////////////////////////////////
  44. #include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine
  45. // USER INCLUDES //////////////////////////////////////////////////////////////
  46. #include "Common/Language.h"
  47. #include "GameClient/GameWindow.h"
  48. #include "GameClient/Gadget.h"
  49. #include "GameClient/GameWindowManager.h"
  50. // DEFINES ////////////////////////////////////////////////////////////////////
  51. // PRIVATE TYPES //////////////////////////////////////////////////////////////
  52. // PRIVATE DATA ///////////////////////////////////////////////////////////////
  53. // PUBLIC DATA ////////////////////////////////////////////////////////////////
  54. // PRIVATE PROTOTYPES /////////////////////////////////////////////////////////
  55. // PRIVATE FUNCTIONS //////////////////////////////////////////////////////////
  56. // PUBLIC FUNCTIONS ///////////////////////////////////////////////////////////
  57. // GadgetProgressBarSystem ====================================================
  58. /** Handle system messages for Progress Bar */
  59. //=============================================================================
  60. WindowMsgHandledType GadgetProgressBarSystem( GameWindow *window, UnsignedInt msg,
  61. WindowMsgData mData1, WindowMsgData mData2 )
  62. {
  63. switch( msg )
  64. {
  65. // ------------------------------------------------------------------------
  66. case GPM_SET_PROGRESS:
  67. {
  68. Int newPos = (Int)mData1;
  69. if (newPos < 0 || newPos > 100)
  70. break;
  71. window->winSetUserData( (void *)newPos );
  72. break;
  73. } // end set progress
  74. // ------------------------------------------------------------------------
  75. default:
  76. return MSG_IGNORED;
  77. } // end switch
  78. return MSG_HANDLED;
  79. } // end GadgetProgressBarSystem
  80. // GadgetProgressBarSetProgress ===============================================
  81. /** send progress system message to Progress Bar */
  82. //=============================================================================
  83. void GadgetProgressBarSetProgress( GameWindow *g, Int progress )
  84. {
  85. if(!g)
  86. return;
  87. TheWindowManager->winSendSystemMsg( g, GPM_SET_PROGRESS, progress, 0);
  88. } // end GadgetProgressBarSetProgress