Skip to content

Commit d8a00f9

Browse files
committed
Including FMX TEdit and TListBox types
1 parent 99b1561 commit d8a00f9

File tree

2 files changed

+178
-0
lines changed

2 files changed

+178
-0
lines changed

Source/fmx/WrapFmxEdit.pas

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
{$I Definition.Inc}
2+
3+
unit WrapFmxEdit;
4+
5+
interface
6+
7+
uses
8+
FMX.Edit, WrapFmxTypes, PythonEngine;
9+
10+
11+
type
12+
TPyDelphiEdit = class(TPyDelphiFMXObject)
13+
private
14+
function GetDelphiObject: TEdit;
15+
procedure SetDelphiObject(const Value: TEdit);
16+
public
17+
class function DelphiObjectClass: TClass; override;
18+
// Properties
19+
property DelphiObject: TEdit read GetDelphiObject
20+
write SetDelphiObject;
21+
end;
22+
23+
implementation
24+
25+
uses
26+
WrapDelphi;
27+
28+
{ Register the wrappers, the globals and the constants }
29+
type
30+
TEditRegistration = class(TRegisteredUnit)
31+
public
32+
function Name: string; override;
33+
procedure RegisterWrappers(APyDelphiWrapper: TPyDelphiWrapper); override;
34+
procedure DefineVars(APyDelphiWrapper: TPyDelphiWrapper); override;
35+
end;
36+
37+
{ TEditRegistration }
38+
39+
procedure TEditRegistration.DefineVars(APyDelphiWrapper: TPyDelphiWrapper);
40+
begin
41+
inherited;
42+
end;
43+
44+
function TEditRegistration.Name: string;
45+
begin
46+
Result := 'Edit';
47+
end;
48+
49+
procedure TEditRegistration.RegisterWrappers(
50+
APyDelphiWrapper: TPyDelphiWrapper);
51+
begin
52+
inherited;
53+
APyDelphiWrapper.RegisterDelphiWrapper(TPyDelphiEdit);
54+
end;
55+
56+
{ TPyDelphiEdit }
57+
58+
class function TPyDelphiEdit.DelphiObjectClass: TClass;
59+
begin
60+
Result := TEdit;
61+
end;
62+
63+
function TPyDelphiEdit.GetDelphiObject: TEdit;
64+
begin
65+
Result := TEdit(inherited DelphiObject);
66+
end;
67+
68+
procedure TPyDelphiEdit.SetDelphiObject(const Value: TEdit);
69+
begin
70+
inherited DelphiObject := Value;
71+
end;
72+
73+
initialization
74+
RegisteredUnits.Add(TEditRegistration.Create);
75+
76+
end.

Source/fmx/WrapFmxListBox.pas

+102
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
{$I Definition.Inc}
2+
3+
unit WrapFmxListBox;
4+
5+
interface
6+
7+
uses
8+
FMX.ListBox, WrapFmxTypes, PythonEngine;
9+
10+
type
11+
TPyListBoxItem = class(TPyDelphiFMXObject)
12+
private
13+
function GetDelphiObject: TListBoxItem;
14+
procedure SetDelphiObject(const Value: TListBoxItem);
15+
public
16+
class function DelphiObjectClass: TClass; override;
17+
property DelphiObject: TListBoxItem read GetDelphiObject
18+
write SetDelphiObject;
19+
end;
20+
TPyDelphiListBox = class(TPyDelphiFMXObject)
21+
private
22+
function GetDelphiObject: TListBox;
23+
procedure SetDelphiObject(const Value: TListBox);
24+
public
25+
class function DelphiObjectClass: TClass; override;
26+
// Properties
27+
property DelphiObject: TListBox read GetDelphiObject
28+
write SetDelphiObject;
29+
end;
30+
31+
implementation
32+
33+
uses
34+
WrapDelphi;
35+
36+
{ Register the wrappers, the globals and the constants }
37+
type
38+
TListBoxRegistration = class(TRegisteredUnit)
39+
public
40+
function Name: string; override;
41+
procedure RegisterWrappers(APyDelphiWrapper: TPyDelphiWrapper); override;
42+
procedure DefineVars(APyDelphiWrapper: TPyDelphiWrapper); override;
43+
end;
44+
45+
{ TListBoxRegistration }
46+
47+
procedure TListBoxRegistration.DefineVars(APyDelphiWrapper: TPyDelphiWrapper);
48+
begin
49+
inherited;
50+
end;
51+
52+
function TListBoxRegistration.Name: string;
53+
begin
54+
Result := 'ListBox';
55+
end;
56+
57+
procedure TListBoxRegistration.RegisterWrappers(
58+
APyDelphiWrapper: TPyDelphiWrapper);
59+
begin
60+
inherited;
61+
APyDelphiWrapper.RegisterDelphiWrapper(TPyDelphiListBox);
62+
end;
63+
64+
{ TPyDelphiListBox }
65+
66+
class function TPyDelphiListBox.DelphiObjectClass: TClass;
67+
begin
68+
Result := TListBox;
69+
end;
70+
71+
function TPyDelphiListBox.GetDelphiObject: TListBox;
72+
begin
73+
Result := TListBox(inherited DelphiObject);
74+
end;
75+
76+
77+
procedure TPyDelphiListBox.SetDelphiObject(const Value: TListBox);
78+
begin
79+
inherited DelphiObject := Value;
80+
end;
81+
82+
{ TPyListBoxItem }
83+
84+
class function TPyListBoxItem.DelphiObjectClass: TClass;
85+
begin
86+
Result := TListBox;
87+
end;
88+
89+
function TPyListBoxItem.GetDelphiObject: TListBoxItem;
90+
begin
91+
Result := TListBox(inherited DelphiObject);
92+
end;
93+
94+
procedure TPyListBoxItem.SetDelphiObject(const Value: TListBoxItem);
95+
begin
96+
inherited DelphiObject := Value;
97+
end;
98+
99+
initialization
100+
RegisteredUnits.Add(TListBoxRegistration.Create);
101+
102+
end.

0 commit comments

Comments
 (0)