forked from electronicarts/CnC_Remastered_Collection
-
Notifications
You must be signed in to change notification settings - Fork 0
/
EDIT.H
113 lines (91 loc) · 4.77 KB
/
EDIT.H
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
//
// Copyright 2020 Electronic Arts Inc.
//
// TiberianDawn.DLL and RedAlert.dll and corresponding source code is free
// software: you can redistribute it and/or modify it under the terms of
// the GNU General Public License as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
// TiberianDawn.DLL and RedAlert.dll and corresponding source code is distributed
// in the hope that it will be useful, but with permitted additional restrictions
// under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT
// distributed with this program. You should have received a copy of the
// GNU General Public License along with permitted additional restrictions
// with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
/* $Header: F:\projects\c&c\vcs\code\edit.h_v 2.17 16 Oct 1995 16:46:32 JOE_BOSTIC $ */
/***********************************************************************************************
*** 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 ***
***********************************************************************************************
* *
* Project Name : Command & Conquer *
* *
* File Name : EDIT.H *
* *
* Programmer : Joe L. Bostic *
* *
* Start Date : 01/15/95 *
* *
* Last Update : January 15, 1995 [JLB] *
* *
*---------------------------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef EDIT_H
#define EDIT_H
class EditClass : public ControlClass
{
public:
typedef enum EditStyle {
ALPHA =0x0001, // Edit accepts alphabetic characters.
NUMERIC =0x0002, // Edit accepts numbers.
MISC =0x0004, // Edit accepts misc graphic characters.
UPPERCASE =0x0008, // Force to upper case.
ALPHANUMERIC=(int)ALPHA|(int)NUMERIC|(int)MISC,
} EditStyle;
EditClass (int id, char * text, int max_len, TextPrintType flags, int x, int y, int w=-1, int h=-1, EditStyle style=ALPHANUMERIC);
virtual ~EditClass(void);
virtual int Draw_Me(int forced);
virtual void Set_Text(char * text, int max_len);
void Set_Color (int color) { Color = color; }
void Set_Read_Only(int rdonly) {IsReadOnly = rdonly;}
protected:
/*
** These are the text size and style flags to be used when displaying the text
** of the edit gadget.
*/
TextPrintType TextFlags;
/*
** Input flags that control what characters are allowed in the string.
*/
EditStyle EditFlags;
/*
** Pointer to text staging buffer and the maximum length of the string it
** can contain.
*/
char *String;
int MaxLength;
/*
** This is the current length of the string. This length will never exceed the
** MaxLength allowed.
*/
int Length;
/*
** This is the desired color of the edit control.
*/
int Color;
virtual int Action (unsigned flags, KeyNumType &key);
virtual void Draw_Background(void);
virtual void Draw_Text(char const * text);
virtual bool Handle_Key(KeyASCIIType ascii);
private:
int IsReadOnly;
};
//inline EditClass::EditStyle operator |(EditClass::EditStyle, EditClass::EditStyle);
//inline EditClass::EditStyle operator &(EditClass::EditStyle, EditClass::EditStyle);
//inline EditClass::EditStyle operator ~(EditClass::EditStyle);
inline EditClass::EditStyle operator|(EditClass::EditStyle a, EditClass::EditStyle b)
{return static_cast<EditClass::EditStyle>(static_cast<int>(a) | static_cast<int>(b));}
inline EditClass::EditStyle operator&(EditClass::EditStyle a, EditClass::EditStyle b)
{return static_cast<EditClass::EditStyle>(static_cast<int>(a) & static_cast<int>(b));}
inline EditClass::EditStyle operator~(EditClass::EditStyle a)
{return static_cast<EditClass::EditStyle>(~static_cast<int>(a));}
#endif