Skip to content

Commit 00bb34c

Browse files
committed
Including the TCustomStyleServices type wrapper
1 parent 270ad81 commit 00bb34c

File tree

1 file changed

+59
-11
lines changed

1 file changed

+59
-11
lines changed

Source/vcl/WrapVclThemes.pas

Lines changed: 59 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,20 @@ TPyDelphiStyleInfo = class(TPyObject)
3535
property Value: TStyleInfo read fValue write fValue;
3636
end;
3737

38+
TPyDelphiCustomStyleServices = class(TPyDelphiObject)
39+
private
40+
function GetDelphiObject: TCustomStyleServices;
41+
procedure SetDelphiObject(const Value: TCustomStyleServices);
42+
public
43+
constructor Create( APythonType : TPythonType ); override;
44+
constructor CreateWith(APythonType: TPythonType; args: PPyObject); override;
45+
46+
class function DelphiObjectClass : TClass; override;
47+
class procedure RegisterMethods( PythonType : TPythonType ); override;
48+
// Properties
49+
property DelphiObject: TCustomStyleServices read GetDelphiObject write SetDelphiObject;
50+
end;
51+
3852
TPyDelphiStyleManager = class(TPyDelphiObject)
3953
private
4054
function GetDelphiObject: TStyleManager;
@@ -45,10 +59,7 @@ TPyDelphiStyleManager = class(TPyDelphiObject)
4559
// Exposed Methods
4660
function LoadFromFileName_Wrapper(AArgs: PPyObject): PPyObject; cdecl;
4761
function IsValidStyle_Wrapper(AArgs: PPyObject): PPyObject; cdecl;
48-
// Property Getters
49-
function Get_filename(AContext: Pointer): PPyObject; cdecl;
5062
public
51-
constructor Create( APythonType : TPythonType ); override;
5263
constructor CreateWith(APythonType: TPythonType; args: PPyObject); override;
5364

5465
class function DelphiObjectClass : TClass; override;
@@ -77,7 +88,7 @@ TStyleManagerStyleNamesAccess = class(TContainerAccess)
7788
implementation
7889

7990
uses
80-
System.SysUtils, Vcl.Controls;
91+
System.SysUtils;
8192

8293
{ Helper functions }
8394

@@ -97,10 +108,17 @@ TVclThemesRegistration = class(TRegisteredUnit)
97108
function Name: string; override;
98109
procedure RegisterWrappers(APyDelphiWrapper: TPyDelphiWrapper); override;
99110
procedure DefineVars(APyDelphiWrapper: TPyDelphiWrapper); override;
111+
procedure DefineFunctions(APyDelphiWrapper : TPyDelphiWrapper); override;
100112
end;
101113

102114
{ TVclThemesRegistration }
103115

116+
procedure TVclThemesRegistration.DefineFunctions(
117+
APyDelphiWrapper: TPyDelphiWrapper);
118+
begin
119+
inherited;
120+
end;
121+
104122
procedure TVclThemesRegistration.DefineVars(APyDelphiWrapper: TPyDelphiWrapper);
105123
begin
106124
inherited;
@@ -116,16 +134,12 @@ procedure TVclThemesRegistration.RegisterWrappers(
116134
begin
117135
inherited;
118136
APyDelphiWrapper.RegisterDelphiWrapper(TPyDelphiStyleManager);
137+
APyDelphiWrapper.RegisterDelphiWrapper(TPyDelphiCustomStyleServices);
119138
APyDelphiWrapper.RegisterHelperType(TPyDelphiStyleInfo);
120139
end;
121140

122141
{ TPyDelphiStyleManager }
123142

124-
constructor TPyDelphiStyleManager.Create(APythonType: TPythonType);
125-
begin
126-
inherited;
127-
end;
128-
129143
constructor TPyDelphiStyleManager.CreateWith(APythonType: TPythonType;
130144
args: PPyObject);
131145
begin
@@ -215,7 +229,6 @@ class procedure TPyDelphiStyleManager.RegisterMethods(PythonType: TPythonType);
215229
PythonType.AddMethod('IsValidStyle', @TPyDelphiStyleManager.IsValidStyle_Wrapper,
216230
'TStyleManager.IsValidStyle()'#10 +
217231
'Check if a Vcl Style file is valid');
218-
219232
end;
220233

221234
procedure TPyDelphiStyleManager.SetDelphiObject(const Value: TStyleManager);
@@ -372,7 +385,6 @@ function TPyDelphiStyleInfo.Set_AuthorEMail(AValue: PPyObject;
372385
end
373386
else
374387
Result := -1;
375-
376388
end;
377389

378390
function TPyDelphiStyleInfo.Set_AuthorUrl(AValue: PPyObject;
@@ -434,6 +446,42 @@ class procedure TPyDelphiStyleInfo.SetupType(APythonType: TPythonType);
434446
APythonType.Services.Basic := [bsGetAttrO, bsSetAttrO, bsRepr, bsStr, bsRichCompare];
435447
end;
436448

449+
{ TPyDelphiStyleServices }
450+
451+
constructor TPyDelphiCustomStyleServices.Create(APythonType: TPythonType);
452+
begin
453+
inherited;
454+
end;
455+
456+
constructor TPyDelphiCustomStyleServices.CreateWith(APythonType: TPythonType;
457+
args: PPyObject);
458+
begin
459+
inherited;
460+
DelphiObject := StyleServices();
461+
end;
462+
463+
class function TPyDelphiCustomStyleServices.DelphiObjectClass: TClass;
464+
begin
465+
Result := TCustomStyleServices;
466+
end;
467+
468+
function TPyDelphiCustomStyleServices.GetDelphiObject: TCustomStyleServices;
469+
begin
470+
Result := TCustomStyleServices(inherited DelphiObject);
471+
end;
472+
473+
procedure TPyDelphiCustomStyleServices.SetDelphiObject(
474+
const Value: TCustomStyleServices);
475+
begin
476+
inherited DelphiObject := Value;
477+
end;
478+
479+
class procedure TPyDelphiCustomStyleServices.RegisterMethods(
480+
PythonType: TPythonType);
481+
begin
482+
inherited;
483+
end;
484+
437485
initialization
438486
RegisteredUnits.Add(TVclThemesRegistration.Create());
439487

0 commit comments

Comments
 (0)