GAUGE.H 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /*
  2. ** Command & Conquer Red Alert(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. /* $Header: /CounterStrike/GAUGE.H 1 3/03/97 10:24a Joe_bostic $ */
  19. /***********************************************************************************************
  20. *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
  21. ***********************************************************************************************
  22. * *
  23. * Project Name : Command & Conquer *
  24. * *
  25. * File Name : GAUGE.H *
  26. * *
  27. * Programmer : Joe L. Bostic, Maria del Mar McCready Legg *
  28. * *
  29. * Start Date : 01/15/95 *
  30. * *
  31. * Last Update : January 15, 1995 [JLB] *
  32. * *
  33. *---------------------------------------------------------------------------------------------*
  34. * Functions: *
  35. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  36. #ifndef GAUGE_H
  37. #define GAUGE_H
  38. class GaugeClass : public ControlClass
  39. {
  40. public:
  41. GaugeClass(unsigned id, int x, int y, int w, int h);
  42. virtual int Draw_Me(int forced=false);
  43. virtual int Set_Maximum(int value);
  44. virtual int Set_Value(int value);
  45. virtual int Get_Value(void) const {return (CurValue);};
  46. virtual void Use_Thumb(int value) { HasThumb = value ? true : false; };
  47. virtual int Thumb_Pixels(void) { return (4);}
  48. /*
  49. ** If this gauge has a color to the left of the current setting, then this
  50. ** flag will be true.
  51. */
  52. unsigned IsColorized:1;
  53. protected:
  54. /*
  55. ** If a thumb is desired, set to true.
  56. */
  57. unsigned HasThumb:1;
  58. /*
  59. ** Is this a horizontal slider?
  60. */
  61. unsigned IsHorizontal:1;
  62. int MaxValue; // maximum value (in application units)
  63. int CurValue; // index of 1st displayed string in box
  64. // (in application units)
  65. /*
  66. ** This value records the difference between where the user clicked
  67. ** and the edge of the thumb, so that the thumb follows the mouse
  68. ** with the proper offset.
  69. */
  70. int ClickDiff;
  71. protected:
  72. virtual void Draw_Thumb(void);
  73. virtual int Action(unsigned flags, KeyNumType &key);
  74. virtual int Pixel_To_Value(int pixel);
  75. virtual int Value_To_Pixel(int value);
  76. };
  77. class TriColorGaugeClass : public GaugeClass
  78. {
  79. public:
  80. TriColorGaugeClass(unsigned id, int x, int y, int w, int h);
  81. virtual int Draw_Me(int forced);
  82. virtual int Set_Red_Limit(int value);
  83. virtual int Set_Yellow_Limit(int value);
  84. protected:
  85. int RedLimit; // maximum value for red
  86. int YellowLimit; // maximum value for yellow
  87. };
  88. #endif