-
Notifications
You must be signed in to change notification settings - Fork 0
/
DefineEditText.h
142 lines (108 loc) · 3.4 KB
/
DefineEditText.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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
/*
* File: EditText.h
* Author: brucewang
*
* Created on October 27, 2009, 4:07 PM
*/
#ifndef _EDITTEXT_H
#define _EDITTEXT_H
#include "types.h"
#include "Rect.h"
#include "TagInstance.h"
//
// 2009-10-28 brucewang
// These bit flags are for Little Endian CPUs.
// Maybe you want to use BitFields, but BitFields are
// compiler dependant, and are not PACKED. So you can not
// directly save to and load from SWF file.
//
#define f_edit_has_text ((ushort)0x0080)
#define f_edit_word_wrap ((ushort)0x0040)
#define f_edit_multiline ((ushort)0x0020)
#define f_edit_password ((ushort)0x0010)
#define f_edit_readonly ((ushort)0x0008)
#define f_edit_has_color ((ushort)0x0004)
#define f_edit_has_max_length ((ushort)0x0002)
#define f_edit_has_font ((ushort)0x0001)
//if(version >= 6)
//{
#define f_edit_reserved1 ((ushort)0x8000)
#define f_edit_auto_size ((ushort)0x4000)
//}
//else {
// ushort f_edit_reserved : 2;
//}
#define f_edit_has_layout ((ushort)0x2000)
#define f_edit_no_select ((ushort)0x1000)
#define f_edit_border ((ushort)0x0800)
#define f_edit_reserved ((ushort)0x0400)
#define f_edit_html ((ushort)0x0200)
#define f_edit_use_outlines ((ushort)0x0100)
/*
* Header RECORDHEADER Tag type = 37.
* Fonts used by DefineEditText must be defined using DefineFont2, not DefineFont.
* */
typedef struct {
// CharacterID UI16 ID for this dynamic text
// character.
UInt16 CharacterID;
// Bounds RECT Rectangle that completely
// encloses the text field.
Rect Bounds;
//
UInt16 Flags;
//FontID If HasFont, UI16 ID of font to use.
UInt16 FontID;
//FontHeight If HasFont, UI16 Height of font in twips.
UInt16 FontHeight;
//FontClass If HasFontClass, STRING Class name of font to be loaded
//from another SWF and used for
//this text.
char FontClass[256];
//TextColor If HasTextColor, RGBA Color of text.
UInt32 TextColor;
//MaxLength If HasMaxLength, UI16 Text is restricted to this length.
UInt16 MaxLength;
//Align If HasLayout, UI8 0 = Left
//1 = Right
//2 = Center
//3 = Justify
byte Align;
//LeftMargin If HasLayout, UI16 Left margin in twips.
UInt16 LeftMargin;
//RightMargin If HasLayout, UI16 Right margin in twips.
UInt16 RightMargin;
//Indent If HasLayout, UI16 Indent in twips.
UInt16 Indent;
//Leading If HasLayout, SI16 Leading in twips (vertical
//distance between bottom of
//descender of one line and top of
//ascender of the next).
Int16 Leading;
//VariableName STRING Name of the variable where the
//contents of the text field are
//stored. May be qualified with
//dot syntax or slash syntax for
//non-global variables.
char VariableName[256];
//InitialText If HasText STRING Text that is initially displayed.
char InitialText[256];
}stDefineText;
class DefineEditText : public TagInstance{
void _init();
public:
DefineEditText();
DefineEditText(const DefineEditText& orig);
virtual ~DefineEditText();
void SetInitText(const char* sz);
const char* GetVariableName();
virtual void ReadData(SWFReader *swf, int length);
virtual void WriteData(SWFWriter *swf, int length);
virtual ulong GetLength(void);
virtual void SetLength(ulong len);
virtual UInt16 GetCharacterID();
virtual void SetCharacterID(UInt16 IdNew);
private:
stDefineText mDefineTextTag;
};
#endif /* _EDITTEXT_H */