GAUGE.H 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. //
  2. // Copyright 2020 Electronic Arts Inc.
  3. //
  4. // TiberianDawn.DLL and RedAlert.dll and corresponding source code is free
  5. // software: you can redistribute it and/or modify it under the terms of
  6. // the GNU General Public License as published by the Free Software Foundation,
  7. // either version 3 of the License, or (at your option) any later version.
  8. // TiberianDawn.DLL and RedAlert.dll and corresponding source code is distributed
  9. // in the hope that it will be useful, but with permitted additional restrictions
  10. // under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT
  11. // distributed with this program. You should have received a copy of the
  12. // GNU General Public License along with permitted additional restrictions
  13. // with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
  14. /* $Header: /CounterStrike/GAUGE.H 1 3/03/97 10:24a Joe_bostic $ */
  15. /***********************************************************************************************
  16. *** 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 ***
  17. ***********************************************************************************************
  18. * *
  19. * Project Name : Command & Conquer *
  20. * *
  21. * File Name : GAUGE.H *
  22. * *
  23. * Programmer : Joe L. Bostic, Maria del Mar McCready Legg *
  24. * *
  25. * Start Date : 01/15/95 *
  26. * *
  27. * Last Update : January 15, 1995 [JLB] *
  28. * *
  29. *---------------------------------------------------------------------------------------------*
  30. * Functions: *
  31. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  32. #ifndef GAUGE_H
  33. #define GAUGE_H
  34. class GaugeClass : public ControlClass
  35. {
  36. public:
  37. GaugeClass(unsigned id, int x, int y, int w, int h);
  38. virtual int Draw_Me(int forced=false);
  39. virtual int Set_Maximum(int value);
  40. virtual int Set_Value(int value);
  41. virtual int Get_Value(void) const {return (CurValue);};
  42. virtual void Use_Thumb(int value) { HasThumb = value ? true : false; };
  43. virtual int Thumb_Pixels(void) { return (4);}
  44. /*
  45. ** If this gauge has a color to the left of the current setting, then this
  46. ** flag will be true.
  47. */
  48. unsigned IsColorized:1;
  49. protected:
  50. /*
  51. ** If a thumb is desired, set to true.
  52. */
  53. unsigned HasThumb:1;
  54. /*
  55. ** Is this a horizontal slider?
  56. */
  57. unsigned IsHorizontal:1;
  58. int MaxValue; // maximum value (in application units)
  59. int CurValue; // index of 1st displayed string in box
  60. // (in application units)
  61. /*
  62. ** This value records the difference between where the user clicked
  63. ** and the edge of the thumb, so that the thumb follows the mouse
  64. ** with the proper offset.
  65. */
  66. int ClickDiff;
  67. protected:
  68. virtual void Draw_Thumb(void);
  69. virtual int Action(unsigned flags, KeyNumType &key);
  70. virtual int Pixel_To_Value(int pixel);
  71. virtual int Value_To_Pixel(int value);
  72. };
  73. class TriColorGaugeClass : public GaugeClass
  74. {
  75. public:
  76. TriColorGaugeClass(unsigned id, int x, int y, int w, int h);
  77. virtual int Draw_Me(int forced);
  78. virtual int Set_Red_Limit(int value);
  79. virtual int Set_Yellow_Limit(int value);
  80. protected:
  81. int RedLimit; // maximum value for red
  82. int YellowLimit; // maximum value for yellow
  83. };
  84. #endif