CHEKLIST.H 4.0 KB

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