GAUGE.H 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /*
  2. ** Command & Conquer(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: F:\projects\c&c\vcs\code\gauge.h_v 2.17 16 Oct 1995 16:45:24 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. // static GaugeClass * Create_One_Of(unsigned id, int x, int y, int w, int h);
  43. virtual int Draw_Me(int forced=false);
  44. virtual int Set_Maximum(int value);
  45. virtual int Set_Value(int value);
  46. virtual int Get_Value(void) const {return (CurValue);};
  47. virtual void Use_Thumb(int value) { HasThumb = value ? true : false; };
  48. virtual int Thumb_Pixels(void) { return (8);}
  49. /*
  50. ** If this gauge has a color to the left of the current setting, then this
  51. ** flag will be true.
  52. */
  53. unsigned IsColorized:1;
  54. protected:
  55. /*
  56. ** If a thumb is desired, set to true.
  57. */
  58. unsigned HasThumb:1;
  59. /*
  60. ** Is this a horizontal slider?
  61. */
  62. unsigned IsHorizontal:1;
  63. int MaxValue; // maximum value (in application units)
  64. int CurValue; // index of 1st displayed string in box
  65. // (in application units)
  66. /*
  67. ** This value records the difference between where the user clicked
  68. ** and the edge of the thumb, so that the thumb follows the mouse
  69. ** with the proper offset.
  70. */
  71. int ClickDiff;
  72. protected:
  73. virtual void Draw_Thumb(void);
  74. virtual int Action(unsigned flags, KeyNumType &key);
  75. virtual int Pixel_To_Value(int pixel);
  76. virtual int Value_To_Pixel(int value);
  77. };
  78. class TriColorGaugeClass : public GaugeClass
  79. {
  80. public:
  81. TriColorGaugeClass(unsigned id, int x, int y, int w, int h);
  82. // static TriColorGaugeClass * Create_One_Of(unsigned id, int x, int y, int w, int h);
  83. virtual int Draw_Me(int forced);
  84. virtual int Set_Red_Limit(int value);
  85. virtual int Set_Yellow_Limit(int value);
  86. protected:
  87. int RedLimit; // maximum value for red
  88. int YellowLimit; // maximum value for yellow
  89. };
  90. #endif