EDIT.H 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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/EDIT.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 : EDIT.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 EDIT_H
  37. #define EDIT_H
  38. class EditClass : public ControlClass
  39. {
  40. public:
  41. typedef enum EditStyle {
  42. ALPHA =0x0001, // Edit accepts alphabetic characters.
  43. NUMERIC =0x0002, // Edit accepts numbers.
  44. MISC =0x0004, // Edit accepts misc graphic characters.
  45. UPPERCASE =0x0008, // Force to upper case.
  46. ALPHANUMERIC=(int)ALPHA|(int)NUMERIC|(int)MISC
  47. } EditStyle;
  48. EditClass (int id, char * text, int max_len, TextPrintType flags, int x, int y, int w=-1, int h=-1, EditStyle style=ALPHANUMERIC);
  49. virtual ~EditClass(void);
  50. virtual void Set_Focus(void);
  51. virtual int Draw_Me(int forced);
  52. virtual void Set_Text(char * text, int max_len);
  53. virtual char * Get_Text(void) {return(String);};
  54. void Set_Color (RemapControlType * color) { Color = color; }
  55. void Set_Read_Only(int rdonly) {IsReadOnly = rdonly;}
  56. protected:
  57. /*
  58. ** These are the text size and style flags to be used when displaying the text
  59. ** of the edit gadget.
  60. */
  61. TextPrintType TextFlags;
  62. /*
  63. ** Input flags that control what characters are allowed in the string.
  64. */
  65. EditStyle EditFlags;
  66. /*
  67. ** Pointer to text staging buffer and the maximum length of the string it
  68. ** can contain.
  69. */
  70. char *String;
  71. int MaxLength;
  72. /*
  73. ** This is the current length of the string. This length will never exceed the
  74. ** MaxLength allowed.
  75. */
  76. int Length;
  77. /*
  78. ** This is the desired color of the edit control.
  79. */
  80. RemapControlType * Color;
  81. virtual int Action (unsigned flags, KeyNumType &key);
  82. virtual void Draw_Background(void);
  83. virtual void Draw_Text(char const * text);
  84. virtual bool Handle_Key(KeyASCIIType ascii);
  85. private:
  86. int IsReadOnly;
  87. };
  88. inline EditClass::EditStyle operator |(EditClass::EditStyle, EditClass::EditStyle);
  89. inline EditClass::EditStyle operator &(EditClass::EditStyle, EditClass::EditStyle);
  90. inline EditClass::EditStyle operator ~(EditClass::EditStyle);
  91. #endif