Skip to content

Commit ccd1180

Browse files
committed
Added wrapper for TSpinEdit and TSpinButton (Samples.Spin)
1 parent 57ec1c9 commit ccd1180

File tree

2 files changed

+102
-1
lines changed

2 files changed

+102
-1
lines changed

Source/WrapDelphiSamplesSpin.pas

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

Source/WrapDelphiVCL.pas

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ implementation
2121
WrapDelphiComCtrls,
2222
WrapDelphiExtCtrls,
2323
WrapDelphiButtons,
24-
WrapDelphiGrids;
24+
WrapDelphiGrids,
25+
WrapDelphiSamplesSpin;
2526

2627
end.

0 commit comments

Comments
 (0)