Last change
on this file was 317, checked in by chronos, 6 months ago |
- Modified: Remove U prefix from unit names.
- Modified: Use TFormEx for all forms for code simplification.
|
File size:
1.3 KB
|
Line | |
---|
1 | unit Nation;
|
---|
2 |
|
---|
3 | interface
|
---|
4 |
|
---|
5 | uses
|
---|
6 | Classes, SysUtils, Graphics, ItemList;
|
---|
7 |
|
---|
8 | type
|
---|
9 |
|
---|
10 | { TNation }
|
---|
11 |
|
---|
12 | TNation = class(TItem)
|
---|
13 | Color: TColor;
|
---|
14 | class function GetFields: TItemFields; override;
|
---|
15 | procedure GetValue(Index: Integer; out Value); override;
|
---|
16 | procedure SetValue(Index: Integer; var Value); override;
|
---|
17 | class function GetClassSysName: string; override;
|
---|
18 | class function GetClassName: string; override;
|
---|
19 | end;
|
---|
20 |
|
---|
21 | { TNations }
|
---|
22 |
|
---|
23 | TNations = class(TItemList)
|
---|
24 | class function GetItemClass: TItemClass; override;
|
---|
25 | end;
|
---|
26 |
|
---|
27 | resourcestring
|
---|
28 | SNation = 'Nation';
|
---|
29 | SColor = 'Color';
|
---|
30 |
|
---|
31 |
|
---|
32 | implementation
|
---|
33 |
|
---|
34 | uses
|
---|
35 | Common;
|
---|
36 |
|
---|
37 | { TNation }
|
---|
38 |
|
---|
39 | class function TNation.GetFields: TItemFields;
|
---|
40 | begin
|
---|
41 | Result := inherited;
|
---|
42 | Result.AddField(2, 'Color', SColor, dtColor);
|
---|
43 | end;
|
---|
44 |
|
---|
45 | procedure TNation.GetValue(Index: Integer; out Value);
|
---|
46 | begin
|
---|
47 | if Index = 1 then string(Value) := Name
|
---|
48 | else if Index = 2 then TColor(Value) := Color
|
---|
49 | else inherited;
|
---|
50 | end;
|
---|
51 |
|
---|
52 | procedure TNation.SetValue(Index: Integer; var Value);
|
---|
53 | begin
|
---|
54 | if Index = 1 then Name := string(Value)
|
---|
55 | else if Index = 2 then Color := TColor(Value)
|
---|
56 | else inherited;
|
---|
57 | end;
|
---|
58 |
|
---|
59 | class function TNation.GetClassSysName: string;
|
---|
60 | begin
|
---|
61 | Result := 'Nation';
|
---|
62 | end;
|
---|
63 |
|
---|
64 | class function TNation.GetClassName: string;
|
---|
65 | begin
|
---|
66 | Result := SNation;
|
---|
67 | end;
|
---|
68 |
|
---|
69 | { TNations }
|
---|
70 |
|
---|
71 | class function TNations.GetItemClass: TItemClass;
|
---|
72 | begin
|
---|
73 | Result := TNation;
|
---|
74 | end;
|
---|
75 |
|
---|
76 | end.
|
---|
77 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.