SLIDER.H 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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\slider.h_v 2.16 16 Oct 1995 16:45:38 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 : SLIDER.H *
  26. * *
  27. * Programmer : Joe L. Bostic *
  28. * *
  29. * Start Date : 01/15/95 *
  30. * *
  31. * Last Update : January 15, 1995 [JLB] *
  32. * *
  33. *---------------------------------------------------------------------------------------------*
  34. * Functions: *
  35. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  36. #ifndef SLIDER_H
  37. #define SLIDER_H
  38. #include "gauge.h"
  39. #include "shapebtn.h"
  40. /***************************************************************************
  41. * SliderClass -- Like a Windows ListBox structure *
  42. * *
  43. * INPUT: int id-- id of gadget *
  44. * int x -- x position of gadget *
  45. * int y -- y position of gadget *
  46. * int w -- width of gadget *
  47. * int h -- height of gadget *
  48. * int belong_to_list -- does this slider go with a listclass? *
  49. * *
  50. * OUTPUT: none. *
  51. * WARNINGS: *
  52. * HISTORY: 01/03/1995 MML : Created. *
  53. *=========================================================================*/
  54. class SliderClass : public GaugeClass
  55. {
  56. public:
  57. SliderClass(unsigned id, int x, int y, int w, int h, int belong_to_list=false);
  58. virtual ~SliderClass(void);
  59. // static SliderClass * Create_One_Of(unsigned id, int x, int y, int w, int h, int belong_to_list=false);
  60. virtual void Set_Thumb_Size(int value);
  61. virtual int Set_Maximum(int value);
  62. virtual int Set_Value(int);
  63. virtual int Bump(int up);
  64. virtual int Step(int up);
  65. virtual int Draw_Me(int forced);
  66. virtual void Peer_To_Peer(unsigned flags, KeyNumType & key, ControlClass & whom);
  67. virtual int Thumb_Pixels(void) { return (ThumbSize);}
  68. protected:
  69. /*
  70. ** If the slider bar has been created, these point to the respective gadgets
  71. ** that it is composed of.
  72. */
  73. ShapeButtonClass * PlusGadget;
  74. ShapeButtonClass * MinusGadget;
  75. /*
  76. ** If I belong to a listbox, I have to draw myself differently...
  77. **/
  78. unsigned BelongToList:1;
  79. /*
  80. ** This is the logical size of the thumb. This value is used when drawing
  81. ** the thumb imagery. It is also the amount that is bumped when the
  82. ** Bump() function is called. (This value is in application units.)
  83. */
  84. int Thumb;
  85. /*
  86. ** This is the current thumb pixel size and starting offset from beginning
  87. ** of slider region. (These values are in pixels.)
  88. */
  89. int ThumbSize;
  90. int ThumbStart; // x or y position for the thumb
  91. virtual int Action(unsigned flags, KeyNumType &key);
  92. virtual void Draw_Thumb(void);
  93. private:
  94. void Recalc_Thumb(void);
  95. };
  96. #endif