-
-
Notifications
You must be signed in to change notification settings - Fork 317
/
Copy pathWrapVclActnList.pas
169 lines (140 loc) · 4.96 KB
/
WrapVclActnList.pas
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
(**************************************************************************)
(* This unit is part of the Python for Delphi (P4D) library *)
(* Project home: https://github.com/pyscripter/python4delphi *)
(* *)
(* Project Maintainer: PyScripter (pyscripter@gmail.com) *)
(* Original Authors: Dr. Dietmar Budelsky (dbudelsky@web.de) *)
(* Morgan Martinet (https://github.com/mmm-experts) *)
(* Core developer: Lucas Belo (lucas.belo@live.com) *)
(* Contributors: See contributors.md at project home *)
(* *)
(* LICENCE and Copyright: MIT (see project home) *)
(**************************************************************************)
{$I ..\Definition.Inc}
unit WrapVclActnList;
interface
uses
System.Classes,
PythonEngine, WrapDelphi,
WrapDelphiClasses,
WrapActions,
Vcl.ActnList;
type
{
Same as TPyDelphiContainedActionList but having wrappers, exposes
the types and allows the use of the constructors e.g. ActionList()
}
TPyDelphiCustomActionList = class(TPyDelphiContainedActionList)
private
function GetDelphiObject: TCustomActionList;
procedure SetDelphiObject(const Value: TCustomActionList);
public
class function DelphiObjectClass: TClass; override;
property DelphiObject: TCustomActionList read GetDelphiObject
write SetDelphiObject;
end;
TPyDelphiActionList = class (TPyDelphiCustomActionList)
private
function GetDelphiObject: TActionList;
procedure SetDelphiObject(const Value: TActionList);
public
// Class methods
class function DelphiObjectClass : TClass; override;
// Properties
property DelphiObject: TActionList read GetDelphiObject write SetDelphiObject;
end;
TPyDelphiCustomAction = class(TPyDelphiContainedAction)
private
function GetDelphiObject: TCustomAction;
procedure SetDelphiObject(const Value: TCustomAction);
public
class function DelphiObjectClass: TClass; override;
property DelphiObject: TCustomAction read GetDelphiObject
write SetDelphiObject;
end;
TPyDelphiAction = class(TPyDelphiContainedAction)
private
function GetDelphiObject: TAction;
procedure SetDelphiObject(const Value: TAction);
public
class function DelphiObjectClass: TClass; override;
property DelphiObject: TAction read GetDelphiObject write SetDelphiObject;
end;
implementation
{ Register the wrappers, the globals and the constants }
type
TActnListRegistration = class(TRegisteredUnit)
public
function Name : string; override;
procedure RegisterWrappers(APyDelphiWrapper : TPyDelphiWrapper); override;
end;
{ TActnListRegistration }
function TActnListRegistration.Name: string;
begin
Result := 'Vcl.ActnList';
end;
procedure TActnListRegistration.RegisterWrappers(APyDelphiWrapper: TPyDelphiWrapper);
begin
inherited;
APyDelphiWrapper.RegisterDelphiWrapper(TPyDelphiCustomActionList);
APyDelphiWrapper.RegisterDelphiWrapper(TPyDelphiActionList);
APyDelphiWrapper.RegisterDelphiWrapper(TPyDelphiCustomAction);
APyDelphiWrapper.RegisterDelphiWrapper(TPyDelphiAction);
end;
{ TPyDelphiCustomActionList }
class function TPyDelphiCustomActionList.DelphiObjectClass: TClass;
begin
Result := TCustomActionList;
end;
function TPyDelphiCustomActionList.GetDelphiObject: TCustomActionList;
begin
Result := TCustomActionList(inherited DelphiObject);
end;
procedure TPyDelphiCustomActionList.SetDelphiObject
(const Value: TCustomActionList);
begin
inherited DelphiObject := Value;
end;
{ TPyDelphiActionList }
class function TPyDelphiActionList.DelphiObjectClass: TClass;
begin
Result := TActionList;
end;
function TPyDelphiActionList.GetDelphiObject: TActionList;
begin
Result := TActionList(inherited DelphiObject);
end;
procedure TPyDelphiActionList.SetDelphiObject(
const Value: TActionList);
begin
inherited DelphiObject := Value;
end;
{ TPyDelphiCustomAction }
class function TPyDelphiCustomAction.DelphiObjectClass: TClass;
begin
Result := TCustomAction;
end;
function TPyDelphiCustomAction.GetDelphiObject: TCustomAction;
begin
Result := TCustomAction(inherited DelphiObject);
end;
procedure TPyDelphiCustomAction.SetDelphiObject(const Value: TCustomAction);
begin
inherited DelphiObject := Value;
end;
{ TPyDelphiAction }
class function TPyDelphiAction.DelphiObjectClass: TClass;
begin
Result := TAction;
end;
function TPyDelphiAction.GetDelphiObject: TAction;
begin
Result := TAction(inherited DelphiObject);
end;
procedure TPyDelphiAction.SetDelphiObject(const Value: TAction);
begin
inherited DelphiObject := Value;
end;
initialization
RegisteredUnits.Add(TActnListRegistration.Create);
end.