Skip to content

Commit ff116cf

Browse files
authored
Merge pull request pyscripter#301 from Embarcadero/missingtypes
Missingtypes
2 parents 99b1561 + cee9d77 commit ff116cf

File tree

4 files changed

+243
-1
lines changed

4 files changed

+243
-1
lines changed

Packages/Delphi/Delphi 10.4+/PythonFmx.dpk

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ contains
4848
WrapFmxShapes in '..\..\..\Source\fmx\WrapFmxShapes.pas',
4949
WrapFmxStdCtrls in '..\..\..\Source\fmx\WrapFmxStdCtrls.pas',
5050
WrapFmxTypes in '..\..\..\Source\fmx\WrapFmxTypes.pas',
51-
WrapDelphiFmx in '..\..\..\Source\fmx\WrapDelphiFmx.pas';
51+
WrapDelphiFmx in '..\..\..\Source\fmx\WrapDelphiFmx.pas',
52+
WrapFmxEdit in '..\..\..\Source\fmx\WrapFmxEdit.pas',
53+
WrapFmxListBox in '..\..\..\Source\fmx\WrapFmxListBox.pas';
5254

5355
end.

Source/fmx/WrapDelphiFmx.pas

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ implementation
1111
WrapFireDac,
1212
WrapFmxTypes,
1313
WrapFmxStdCtrls,
14+
WrapFmxEdit,
15+
WrapFmxListBox,
1416
WrapFmxActnList,
1517
WrapFmxComCtrls,
1618
WrapFmxDialogs,

Source/fmx/WrapFmxEdit.pas

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

Source/fmx/WrapFmxListBox.pas

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
{$I ..\Definition.Inc}
2+
3+
unit WrapFmxListBox;
4+
5+
interface
6+
7+
uses
8+
FMX.ListBox, WrapFmxTypes, WrapFmxControls, WrapFmxLayouts, PythonEngine;
9+
10+
type
11+
TPyListBoxItem = class(TPyDelphiTextControl)
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+
21+
TPyDelphiCustomListBox = class(TPyDelphiScrollBox)
22+
private
23+
function GetDelphiObject: TCustomListBox;
24+
procedure SetDelphiObject(const Value: TCustomListBox);
25+
public
26+
class function DelphiObjectClass: TClass; override;
27+
// Properties
28+
property DelphiObject: TCustomListBox read GetDelphiObject
29+
write SetDelphiObject;
30+
end;
31+
32+
TPyDelphiListBox = class(TPyDelphiCustomListBox)
33+
private
34+
function GetDelphiObject: TListBox;
35+
procedure SetDelphiObject(const Value: TListBox);
36+
public
37+
class function DelphiObjectClass: TClass; override;
38+
// Properties
39+
property DelphiObject: TListBox read GetDelphiObject
40+
write SetDelphiObject;
41+
end;
42+
43+
implementation
44+
45+
uses
46+
WrapDelphi;
47+
48+
{ Register the wrappers, the globals and the constants }
49+
type
50+
TListBoxRegistration = class(TRegisteredUnit)
51+
public
52+
function Name: string; override;
53+
procedure RegisterWrappers(APyDelphiWrapper: TPyDelphiWrapper); override;
54+
procedure DefineVars(APyDelphiWrapper: TPyDelphiWrapper); override;
55+
end;
56+
57+
{ TListBoxRegistration }
58+
59+
procedure TListBoxRegistration.DefineVars(APyDelphiWrapper: TPyDelphiWrapper);
60+
begin
61+
inherited;
62+
end;
63+
64+
function TListBoxRegistration.Name: string;
65+
begin
66+
Result := 'ListBox';
67+
end;
68+
69+
procedure TListBoxRegistration.RegisterWrappers(
70+
APyDelphiWrapper: TPyDelphiWrapper);
71+
begin
72+
inherited;
73+
APyDelphiWrapper.RegisterDelphiWrapper(TPyListBoxItem);
74+
APyDelphiWrapper.RegisterDelphiWrapper(TPyDelphiCustomListBox);
75+
APyDelphiWrapper.RegisterDelphiWrapper(TPyDelphiListBox);
76+
end;
77+
78+
{ TPyListBoxItem }
79+
80+
class function TPyListBoxItem.DelphiObjectClass: TClass;
81+
begin
82+
Result := TListBox;
83+
end;
84+
85+
function TPyListBoxItem.GetDelphiObject: TListBoxItem;
86+
begin
87+
Result := TListBoxItem(inherited DelphiObject);
88+
end;
89+
90+
procedure TPyListBoxItem.SetDelphiObject(const Value: TListBoxItem);
91+
begin
92+
inherited DelphiObject := Value;
93+
end;
94+
95+
{ TPyDelphiCustomListBox }
96+
97+
class function TPyDelphiCustomListBox.DelphiObjectClass: TClass;
98+
begin
99+
Result := TCustomListBox;
100+
end;
101+
102+
function TPyDelphiCustomListBox.GetDelphiObject: TCustomListBox;
103+
begin
104+
Result := TCustomListBox(inherited DelphiObject);
105+
end;
106+
107+
procedure TPyDelphiCustomListBox.SetDelphiObject(const Value: TCustomListBox);
108+
begin
109+
inherited DelphiObject := Value;
110+
end;
111+
112+
{ TPyDelphiListBox }
113+
114+
class function TPyDelphiListBox.DelphiObjectClass: TClass;
115+
begin
116+
Result := TListBox;
117+
end;
118+
119+
function TPyDelphiListBox.GetDelphiObject: TListBox;
120+
begin
121+
Result := TListBox(inherited DelphiObject);
122+
end;
123+
124+
125+
procedure TPyDelphiListBox.SetDelphiObject(const Value: TListBox);
126+
begin
127+
inherited DelphiObject := Value;
128+
end;
129+
130+
initialization
131+
RegisteredUnits.Add(TListBoxRegistration.Create);
132+
133+
end.

0 commit comments

Comments
 (0)