CnC_Remastered_Collection

Command and Conquer: Red Alert
Log | Files | Refs | README | LICENSE

CHEKLIST.H (4067B)


      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 
      9 // TiberianDawn.DLL and RedAlert.dll and corresponding source code is distributed 
     10 // in the hope that it will be useful, but with permitted additional restrictions 
     11 // under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT 
     12 // distributed with this program. You should have received a copy of the 
     13 // GNU General Public License along with permitted additional restrictions 
     14 // with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
     15 
     16 /* $Header: /CounterStrike/CHEKLIST.H 1     3/03/97 10:24a Joe_bostic $ */
     17 /***************************************************************************
     18  **   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        **
     19  ***************************************************************************
     20  *                                                                         *
     21  *                 Project Name : Command & Conquer                        *
     22  *                                                                         *
     23  *                    File Name : CHEKLIST.H                               *
     24  *                                                                         *
     25  *                   Programmer : Bill Randolph                            *
     26  *                                                                         *
     27  *                   Start Date : February 16, 1995                        *
     28  *                                                                         *
     29  *                  Last Update : February 16, 1995   [BR]                 *
     30  *                                                                         *
     31  *-------------------------------------------------------------------------*
     32  *	This class behaves just like the standard list box, except that if the	*
     33  * first character of a list entry is a space, clicking on it toggles the	*
     34  * space with a check-mark ('\3').  This makes each entry in the list box	*
     35  * "toggle-able".																				*
     36  *-------------------------------------------------------------------------*
     37  * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
     38 
     39 #ifndef CHEKLIST_H
     40 #define CHEKLIST_H
     41 
     42 #include "list.h"
     43 
     44 class CheckObject
     45 {
     46 	public:
     47 		CheckObject(char const * text = 0, bool checked=false) :
     48 			Text(text),
     49 			IsChecked(checked)
     50 		{};
     51 
     52 		char const * Text;
     53 		bool IsChecked;
     54 };
     55 
     56 
     57 class CheckListClass : public ListClass
     58 {
     59 	public:
     60 		/*
     61 		**	Constructor/Destructor
     62 		*/
     63 		CheckListClass(int id, int x, int y, int w, int h, TextPrintType flags,
     64 			void const * up, void const * down);
     65 		~CheckListClass(void);
     66 
     67 		virtual int Add_Item(int text) {return ListClass::Add_Item(text);}
     68 		virtual int Add_Item(char const * text);
     69 		virtual char const * Current_Item(void) const;
     70 		virtual char const * Get_Item(int index) const;
     71 		virtual void Remove_Item(char const * text);
     72 		virtual void Remove_Item(int text) {ListClass::Remove_Item(text);}
     73 		virtual void Set_Selected_Index(char const * text);
     74 		virtual void Set_Selected_Index(int index) {ListClass::Set_Selected_Index(index);};
     75 
     76 		/*
     77 		**	Checkmark utility functions
     78 		*/
     79 		void Check_Item(int index, bool checked);	// sets checked state of item
     80 		bool Is_Checked(int index) const;				// gets checked state of item
     81 
     82 		void Set_Read_Only(int rdonly) {IsReadOnly = rdonly;}
     83 
     84 		/*
     85 		**	This defines the ASCII value of the checkmark character & non-checkmark
     86 		**	character.
     87 		*/
     88 		typedef enum CheckListClassEnum {
     89 			CHECK_CHAR = '\3',
     90 			UNCHECK_CHAR = ' '
     91 		} CheckListClassEnum;
     92 
     93 	protected:
     94 		virtual int Action(unsigned flags, KeyNumType &key);
     95 		virtual void Draw_Entry(int index, int x, int y, int width, int selected);
     96 
     97 	private:
     98 		bool IsReadOnly;
     99 };
    100 
    101 
    102 #endif