Skip to content

Commit 7595359

Browse files
authored
Merge pull request #3 from Embarcadero/pysamples
Pysamples
2 parents 88eb795 + b92078a commit 7595359

File tree

7 files changed

+587
-17
lines changed

7 files changed

+587
-17
lines changed

Modules/DelphiFMX/DelphiFMX.dpr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
library DelphiFMX;
22

33
uses
4+
System.StartUpCopy,
45
SysUtils,
56
Classes,
67
uMain in 'uMain.pas';

Packages/Delphi/Delphi 10.4+/PythonFmx.dpk

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ contains
5252
WrapFmxEdit in '..\..\..\Source\fmx\WrapFmxEdit.pas',
5353
WrapFmxListBox in '..\..\..\Source\fmx\WrapFmxListBox.pas',
5454
WrapFmxMedia in '..\..\..\Source\fmx\WrapFmxMedia.pas',
55-
WrapFmxMenus in '..\..\..\Source\fmx\WrapFmxMenus.pas';
55+
WrapFmxMenus in '..\..\..\Source\fmx\WrapFmxMenus.pas',
56+
WrapFmxStyles in '..\..\..\Source\fmx\WrapFmxStyles.pas';
5657

5758
end.

Source/PythonEngine.pas

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,7 @@ interface
9595
{$IF not Defined(FPC) and (CompilerVersion >= 23)}
9696
const
9797
{$IF CompilerVersion >= 33}
98-
pidSupportedPlatforms = pidWin32 or pidWin64 or pidOSX32 or pidOSX64
99-
or pidLinux64 or pidAndroid32Arm or pidAndroid64Arm;
98+
pidSupportedPlatforms = pidAllPlatforms;
10099
{$ELSE}
101100
pidSupportedPlatforms = pidWin32 or pidWin64 or pidOSX32;
102101
{$IFEND}

Source/fmx/WrapDelphiFmx.pas

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ implementation
2424
WrapFmxScrollBox,
2525
WrapFmxGrids,
2626
WrapFmxMedia,
27-
WrapFmxMenus;
27+
WrapFmxMenus,
28+
WrapFmxStyles;
2829

2930
end.

Source/fmx/WrapFmxListBox.pas

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,28 @@ TPyDelphiListBox = class(TPyDelphiCustomListBox)
4040
write SetDelphiObject;
4141
end;
4242

43+
TPyDelphiCustomComboBox = class(TPyDelphiStyledControl)
44+
private
45+
function GetDelphiObject: TCustomComboBox;
46+
procedure SetDelphiObject(const Value: TCustomComboBox);
47+
public
48+
class function DelphiObjectClass: TClass; override;
49+
// Properties
50+
property DelphiObject: TCustomComboBox read GetDelphiObject
51+
write SetDelphiObject;
52+
end;
53+
54+
TPyDelphiComboBox = class(TPyDelphiCustomComboBox)
55+
private
56+
function GetDelphiObject: TComboBox;
57+
procedure SetDelphiObject(const Value: TComboBox);
58+
public
59+
class function DelphiObjectClass: TClass; override;
60+
// Properties
61+
property DelphiObject: TComboBox read GetDelphiObject
62+
write SetDelphiObject;
63+
end;
64+
4365
implementation
4466

4567
uses
@@ -73,6 +95,8 @@ procedure TListBoxRegistration.RegisterWrappers(
7395
APyDelphiWrapper.RegisterDelphiWrapper(TPyListBoxItem);
7496
APyDelphiWrapper.RegisterDelphiWrapper(TPyDelphiCustomListBox);
7597
APyDelphiWrapper.RegisterDelphiWrapper(TPyDelphiListBox);
98+
APyDelphiWrapper.RegisterDelphiWrapper(TPyDelphiCustomComboBox);
99+
APyDelphiWrapper.RegisterDelphiWrapper(TPyDelphiComboBox);
76100
end;
77101

78102
{ TPyListBoxItem }
@@ -127,6 +151,40 @@ procedure TPyDelphiListBox.SetDelphiObject(const Value: TListBox);
127151
inherited DelphiObject := Value;
128152
end;
129153

154+
{ TPyDelphiCustomComboBox }
155+
156+
class function TPyDelphiCustomComboBox.DelphiObjectClass: TClass;
157+
begin
158+
Result := TCustomComboBox;
159+
end;
160+
161+
function TPyDelphiCustomComboBox.GetDelphiObject: TCustomComboBox;
162+
begin
163+
Result := TCustomComboBox(inherited DelphiObject)
164+
end;
165+
166+
procedure TPyDelphiCustomComboBox.SetDelphiObject(const Value: TCustomComboBox);
167+
begin
168+
inherited DelphiObject := Value;
169+
end;
170+
171+
{ TPyDelphiComboBox }
172+
173+
class function TPyDelphiComboBox.DelphiObjectClass: TClass;
174+
begin
175+
Result := TComboBox;
176+
end;
177+
178+
function TPyDelphiComboBox.GetDelphiObject: TComboBox;
179+
begin
180+
Result := TComboBox(inherited DelphiObject)
181+
end;
182+
183+
procedure TPyDelphiComboBox.SetDelphiObject(const Value: TComboBox);
184+
begin
185+
inherited DelphiObject := Value;
186+
end;
187+
130188
initialization
131189
RegisteredUnits.Add(TListBoxRegistration.Create);
132190

Source/fmx/WrapFmxStyles.pas

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
{$I ..\Definition.Inc}
2+
3+
unit WrapFmxStyles;
4+
5+
interface
6+
7+
uses
8+
WrapDelphi, FMX.Styles, PythonEngine;
9+
10+
type
11+
TPyDelphiStyleStreaming = class(TPyDelphiObject)
12+
private
13+
function GetDelphiObject: TStyleStreaming;
14+
procedure SetDelphiObject(const Value: TStyleStreaming);
15+
public
16+
constructor Create( APythonType : TPythonType ); override;
17+
constructor CreateWith(APythonType: TPythonType; args: PPyObject); override;
18+
class function DelphiObjectClass : TClass; override;
19+
class procedure RegisterGetSets(PythonType: TPythonType); override;
20+
class procedure RegisterMethods(PythonType: TPythonType); override;
21+
22+
property DelphiObject: TStyleStreaming read GetDelphiObject write SetDelphiObject;
23+
end;
24+
25+
TPyDelphiStyleManager = class(TPyDelphiObject)
26+
private
27+
function GetDelphiObject: TStyleManager;
28+
procedure SetDelphiObject(const Value: TStyleManager);
29+
public
30+
constructor Create( APythonType : TPythonType ); override;
31+
constructor CreateWith(APythonType: TPythonType; args: PPyObject); override;
32+
class function DelphiObjectClass : TClass; override;
33+
class procedure RegisterGetSets(PythonType: TPythonType); override;
34+
class procedure RegisterMethods(PythonType: TPythonType); override;
35+
36+
property DelphiObject: TStyleManager read GetDelphiObject write SetDelphiObject;
37+
end;
38+
39+
implementation
40+
41+
uses
42+
FMX.Types;
43+
44+
{ Register the wrappers, the globals and the constants }
45+
type
46+
TFmxStylesRegistration = class(TRegisteredUnit)
47+
public
48+
function Name: string; override;
49+
procedure RegisterWrappers(APyDelphiWrapper: TPyDelphiWrapper); override;
50+
procedure DefineVars(APyDelphiWrapper: TPyDelphiWrapper); override;
51+
end;
52+
53+
{ TFmxStylesRegistration }
54+
55+
procedure TFmxStylesRegistration.DefineVars(APyDelphiWrapper: TPyDelphiWrapper);
56+
begin
57+
inherited;
58+
end;
59+
60+
function TFmxStylesRegistration.Name: string;
61+
begin
62+
Result := 'Styles';
63+
end;
64+
65+
procedure TFmxStylesRegistration.RegisterWrappers(
66+
APyDelphiWrapper: TPyDelphiWrapper);
67+
begin
68+
inherited;
69+
APyDelphiWrapper.RegisterDelphiWrapper(TPyDelphiStyleStreaming);
70+
APyDelphiWrapper.RegisterDelphiWrapper(TPyDelphiStyleManager);
71+
end;
72+
73+
{ TPyDelphiStyleStreaming }
74+
75+
constructor TPyDelphiStyleStreaming.Create(APythonType: TPythonType);
76+
begin
77+
inherited;
78+
end;
79+
80+
constructor TPyDelphiStyleStreaming.CreateWith(APythonType: TPythonType;
81+
args: PPyObject);
82+
begin
83+
inherited;
84+
DelphiObject := TStyleStreaming.Create();
85+
end;
86+
87+
class function TPyDelphiStyleStreaming.DelphiObjectClass: TClass;
88+
begin
89+
Result := TStyleStreaming;
90+
end;
91+
92+
function TPyDelphiStyleStreaming.GetDelphiObject: TStyleStreaming;
93+
begin
94+
Result := TStyleStreaming(inherited DelphiObject);
95+
end;
96+
97+
class procedure TPyDelphiStyleStreaming.RegisterGetSets(
98+
PythonType: TPythonType);
99+
begin
100+
inherited;
101+
end;
102+
103+
class procedure TPyDelphiStyleStreaming.RegisterMethods(
104+
PythonType: TPythonType);
105+
begin
106+
inherited;
107+
end;
108+
109+
procedure TPyDelphiStyleStreaming.SetDelphiObject(const Value: TStyleStreaming);
110+
begin
111+
inherited DelphiObject := Value;
112+
end;
113+
114+
{ TPyDelphiStyleManager }
115+
116+
constructor TPyDelphiStyleManager.Create(APythonType: TPythonType);
117+
begin
118+
inherited;
119+
end;
120+
121+
constructor TPyDelphiStyleManager.CreateWith(APythonType: TPythonType;
122+
args: PPyObject);
123+
begin
124+
inherited;
125+
DelphiObject := TStyleManager.Create();
126+
end;
127+
128+
class function TPyDelphiStyleManager.DelphiObjectClass: TClass;
129+
begin
130+
Result := TStyleManager;
131+
end;
132+
133+
function TPyDelphiStyleManager.GetDelphiObject: TStyleManager;
134+
begin
135+
Result := TStyleManager(inherited DelphiObject);
136+
end;
137+
138+
class procedure TPyDelphiStyleManager.RegisterGetSets(PythonType: TPythonType);
139+
begin
140+
inherited;
141+
end;
142+
143+
class procedure TPyDelphiStyleManager.RegisterMethods(PythonType: TPythonType);
144+
begin
145+
inherited;
146+
end;
147+
148+
procedure TPyDelphiStyleManager.SetDelphiObject(const Value: TStyleManager);
149+
begin
150+
inherited DelphiObject := Value;
151+
end;
152+
153+
initialization
154+
RegisteredUnits.Add(TFmxStylesRegistration.Create());
155+
156+
end.

0 commit comments

Comments
 (0)