-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathGDK.ToolsAPI.FormCreator.pas
More file actions
152 lines (127 loc) · 4 KB
/
Copy pathGDK.ToolsAPI.FormCreator.pas
File metadata and controls
152 lines (127 loc) · 4 KB
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
142
143
144
145
146
147
148
149
150
151
152
unit GDK.ToolsAPI.FormCreator;
interface
uses
ToolsAPI;
type
// Creates a new form unit through IOTAModuleServices.CreateModule: the IDE
// generates the default unit source and .dfm, adds the unit to the owning
// project and opens the designer.
TToolsApiFormCreator = class(TInterfacedObject, IOTACreator, IOTAModuleCreator)
private
FOwner: IOTAProject;
FUnitFileName: string;
FFormName: string;
FAncestorName: string;
public
constructor Create(const Owner: IOTAProject;
const UnitFileName: string;
const FormName: string;
const AncestorName: string);
// IOTACreator
function GetCreatorType: string;
function GetExisting: Boolean;
function GetFileSystem: string;
function GetOwner: IOTAModule;
function GetUnnamed: Boolean;
// IOTAModuleCreator
function GetAncestorName: string;
function GetImplFileName: string;
function GetIntfFileName: string;
function GetFormName: string;
function GetMainForm: Boolean;
function GetShowForm: Boolean;
function GetShowSource: Boolean;
function NewFormFile(const FormIdent: string; const AncestorIdent: string): IOTAFile;
function NewImplSource(const ModuleIdent: string; const FormIdent: string; const AncestorIdent: string): IOTAFile;
function NewIntfSource(const ModuleIdent: string; const FormIdent: string; const AncestorIdent: string): IOTAFile;
procedure FormCreated(const FormEditor: IOTAFormEditor);
end;
implementation
uses
System.SysUtils;
constructor TToolsApiFormCreator.Create(const Owner: IOTAProject;
const UnitFileName: string;
const FormName: string;
const AncestorName: string);
begin
inherited Create;
FOwner := Owner;
FUnitFileName := UnitFileName;
FFormName := FormName;
FAncestorName := AncestorName;
end;
function TToolsApiFormCreator.GetCreatorType: string;
begin
Result := sForm;
end;
function TToolsApiFormCreator.GetExisting: Boolean;
begin
Result := False;
end;
function TToolsApiFormCreator.GetFileSystem: string;
begin
Result := '';
end;
function TToolsApiFormCreator.GetOwner: IOTAModule;
begin
Result := FOwner;
end;
function TToolsApiFormCreator.GetUnnamed: Boolean;
begin
Result := FUnitFileName.IsEmpty;
end;
function TToolsApiFormCreator.GetAncestorName: string;
begin
// The IDE expects the ancestor identifier without the leading "T".
Result := FAncestorName;
if Result.StartsWith('T', True) and (Result.Length > 1) then
Result := Result.Substring(1);
if Result.IsEmpty then
Result := 'Form';
end;
function TToolsApiFormCreator.GetImplFileName: string;
begin
Result := FUnitFileName;
end;
function TToolsApiFormCreator.GetIntfFileName: string;
begin
Result := '';
end;
function TToolsApiFormCreator.GetFormName: string;
begin
Result := FFormName;
end;
function TToolsApiFormCreator.GetMainForm: Boolean;
begin
Result := False;
end;
function TToolsApiFormCreator.GetShowForm: Boolean;
begin
Result := True;
end;
function TToolsApiFormCreator.GetShowSource: Boolean;
begin
Result := True;
end;
function TToolsApiFormCreator.NewFormFile(const FormIdent: string; const AncestorIdent: string): IOTAFile;
begin
// nil: the IDE generates the default .dfm for the ancestor.
Result := nil;
end;
function TToolsApiFormCreator.NewImplSource(const ModuleIdent: string;
const FormIdent: string;
const AncestorIdent: string): IOTAFile;
begin
// nil: the IDE generates the default form unit source.
Result := nil;
end;
function TToolsApiFormCreator.NewIntfSource(const ModuleIdent: string;
const FormIdent: string;
const AncestorIdent: string): IOTAFile;
begin
Result := nil;
end;
procedure TToolsApiFormCreator.FormCreated(const FormEditor: IOTAFormEditor);
begin
end;
end.