LIST.H (6387B)
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: F:\projects\c&c\vcs\code\list.h_v 2.17 16 Oct 1995 16:46:24 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 : LIST.H * 24 * * 25 * Programmer : Joe L. Bostic * 26 * * 27 * Start Date : 01/15/95 * 28 * * 29 * Last Update : January 15, 1995 [JLB] * 30 * * 31 *---------------------------------------------------------------------------------------------* 32 * Functions: * 33 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ 34 35 #ifndef LIST_H 36 #define LIST_H 37 38 #include "control.h" 39 #include "shapebtn.h" 40 #include "slider.h" 41 42 43 /*************************************************************************** 44 * ListClass -- Like a Windows ListBox structure * 45 * * 46 * INPUT: int x -- x position of gadget * 47 * int y -- y position of gadget * 48 * int w -- width of gadget * 49 * int h -- height of gadget * 50 * UWORD flags -- see enumeration choices * 51 * * 52 * OUTPUT: none. * 53 * WARNINGS: * 54 * HISTORY: 01/03/1995 MML : Created. * 55 *=========================================================================*/ 56 class ListClass : public ControlClass 57 { 58 public: 59 ListClass(int id, int x, int y, int w, int h, TextPrintType flags, void const * up, void const * down); 60 virtual ~ListClass(void); 61 62 // static ListClass * Create_One_Of(int id, int x, int y, int w, int h, TextPrintType flags, void const * up, void const * down); 63 virtual int Add_Item(char const * text); 64 virtual int Add_Item(int text); 65 virtual int Add_Scroll_Bar(void); 66 virtual void Bump(int up); 67 virtual int Count(void) {return List.Count();}; 68 virtual int Current_Index(void); 69 virtual char const * Current_Item(void); 70 virtual int Draw_Me(int forced); 71 virtual char const * Get_Item(int index) const; 72 virtual int Step_Selected_Index(int forward); 73 74 virtual void Peer_To_Peer(unsigned flags, KeyNumType & key, ControlClass & whom); 75 virtual void Remove_Item(char const * text); 76 virtual int Remove_Scroll_Bar(void); 77 virtual void Set_Selected_Index(int index); 78 virtual void Set_Tabs(int const * tabs); 79 virtual int Set_View_Index(int index); 80 virtual void Step(int up); 81 82 /* 83 ** These overloaded list routines handle adding/removing the scroll bar 84 ** automatically when the list box is added or removed. 85 */ 86 virtual LinkClass & Add(LinkClass & object); 87 virtual LinkClass & Add_Tail(LinkClass & object); 88 virtual LinkClass & Add_Head(LinkClass & object); 89 virtual GadgetClass * Remove(void); 90 91 protected: 92 virtual int Action(unsigned flags, KeyNumType &key); 93 virtual void Draw_Entry(int index, int x, int y, int width, int selected); 94 95 /* 96 ** This controls what the text looks like. It uses the basic TPF_ flags that 97 ** are used to control Fancy_Text_Print(). 98 */ 99 TextPrintType TextFlags; 100 101 /* 102 ** This is a series of tabstop pixel positions to use when processing any 103 ** <TAB> characters found in a list box string. The tabs are a series of 104 ** pixel offsets from the starting pixel position of the text. 105 */ 106 int const *Tabs; 107 108 /* 109 ** The actual list of text pointers is maintained by this list manager. The pointers 110 ** are stored in EMS. The text that is pointed to may also be in EMS. 111 */ 112 DynamicVectorClass<char const *> List; 113 //EMSListOf<char const *> List; 114 115 /* 116 ** This is the total pixel height of a standar line of text. This is greatly 117 ** influenced by the TextFlags value. 118 */ 119 int LineHeight; 120 121 /* 122 ** This is the number of text lines that can fit within the list box. 123 */ 124 int LineCount; 125 126 /* 127 ** If the slider bar has been created, these point to the respective gadgets 128 ** that it is composed of. 129 */ 130 unsigned IsScrollActive:1; 131 ShapeButtonClass UpGadget; 132 ShapeButtonClass DownGadget; 133 SliderClass ScrollGadget; 134 135 /* 136 ** This is the currently selected index. It is highlighted. 137 */ 138 int SelectedIndex; 139 140 /* 141 ** This specifies the line (index) that is at the top of the list box. 142 */ 143 int CurrentTopIndex; 144 }; 145 146 #endif