Skip to content

Commit b916153

Browse files
committed
Including wrappers for FMX Styles
1 parent 5032895 commit b916153

File tree

1 file changed

+156
-0
lines changed

1 file changed

+156
-0
lines changed

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)