CHEKLIST.H 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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/CHEKLIST.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 : CHEKLIST.H *
  26. * *
  27. * Programmer : Bill Randolph *
  28. * *
  29. * Start Date : February 16, 1995 *
  30. * *
  31. * Last Update : February 16, 1995 [BR] *
  32. * *
  33. *-------------------------------------------------------------------------*
  34. * This class behaves just like the standard list box, except that if the *
  35. * first character of a list entry is a space, clicking on it toggles the *
  36. * space with a check-mark ('\3'). This makes each entry in the list box *
  37. * "toggle-able". *
  38. *-------------------------------------------------------------------------*
  39. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  40. #ifndef CHEKLIST_H
  41. #define CHEKLIST_H
  42. #include "list.h"
  43. class CheckObject
  44. {
  45. public:
  46. CheckObject(char const * text = 0, bool checked=false) :
  47. Text(text),
  48. IsChecked(checked)
  49. {};
  50. char const * Text;
  51. bool IsChecked;
  52. };
  53. class CheckListClass : public ListClass
  54. {
  55. public:
  56. /*
  57. ** Constructor/Destructor
  58. */
  59. CheckListClass(int id, int x, int y, int w, int h, TextPrintType flags,
  60. void const * up, void const * down);
  61. ~CheckListClass(void);
  62. virtual int Add_Item(int text) {return ListClass::Add_Item(text);}
  63. virtual int Add_Item(char const * text);
  64. virtual char const * Current_Item(void) const;
  65. virtual char const * Get_Item(int index) const;
  66. virtual void Remove_Item(char const * text);
  67. virtual void Remove_Item(int text) {ListClass::Remove_Item(text);}
  68. virtual void Set_Selected_Index(char const * text);
  69. virtual void Set_Selected_Index(int index) {ListClass::Set_Selected_Index(index);};
  70. /*
  71. ** Checkmark utility functions
  72. */
  73. void Check_Item(int index, bool checked); // sets checked state of item
  74. bool Is_Checked(int index) const; // gets checked state of item
  75. void Set_Read_Only(int rdonly) {IsReadOnly = rdonly;}
  76. /*
  77. ** This defines the ASCII value of the checkmark character & non-checkmark
  78. ** character.
  79. */
  80. typedef enum CheckListClassEnum {
  81. CHECK_CHAR = '\3',
  82. UNCHECK_CHAR = ' '
  83. } CheckListClassEnum;
  84. protected:
  85. virtual int Action(unsigned flags, KeyNumType &key);
  86. virtual void Draw_Entry(int index, int x, int y, int width, int selected);
  87. private:
  88. bool IsReadOnly;
  89. };
  90. #endif