forked from academiadocodigo/TBGWebCharts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CardStyled.Shape.Classes.pas
90 lines (75 loc) · 2.12 KB
/
CardStyled.Shape.Classes.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
unit CardStyled.Shape.Classes;
interface
uses
Interfaces,
Generics.Collections;
Type
TModelCardStyledShapeClasses = class(TInterfacedObject, iModelCardStyledShapeClasses)
private
[weak]
FParent : iModelCardStyledShape;
FClasses : TList<String>;
public
constructor Create(Parent : iModelCardStyledShape);
destructor Destroy; override;
class function New(Parent : iModelCardStyledShape) : iModelCardStyledShapeClasses;
function ResultShapeClass : String;
function RoundedCircle : iModelCardStyledShapeClasses;
function Rounded : iModelCardStyledShapeClasses;
function Shadow : iModelCardStyledShapeClasses;
function &End : iModelCardStyledShape;
end;
implementation
uses
Injection,
System.SysUtils;
{ TModelCardStyledShapeClasses }
function TModelCardStyledShapeClasses.&End: iModelCardStyledShape;
begin
Result := FParent;
end;
constructor TModelCardStyledShapeClasses.Create(Parent : iModelCardStyledShape);
begin
{$IF RTLVERSION > 27 }
TInjection.Weak(@FParent, Parent);
{$ELSE}
FParent := Parent;
{$IFEND}
FClasses := Tlist<string>.Create;
end;
destructor TModelCardStyledShapeClasses.Destroy;
begin
FClasses.Free;
inherited;
end;
class function TModelCardStyledShapeClasses.New(Parent : iModelCardStyledShape) : iModelCardStyledShapeClasses;
begin
Result := Self.Create(Parent);
end;
function TModelCardStyledShapeClasses.ResultShapeClass: String;
var
I : Integer;
begin
if FClasses.Count > 0 then
begin
for I := 0 to Pred(FClasses.Count) do
Result := Result + FClasses.Items[I] + ' ';
Result := Format('class="%s"', [Trim(Result)]);
end;
end;
function TModelCardStyledShapeClasses.Rounded: iModelCardStyledShapeClasses;
begin
Result := Self;
FClasses.Add('rounded');
end;
function TModelCardStyledShapeClasses.RoundedCircle: iModelCardStyledShapeClasses;
begin
Result := Self;
FClasses.Add('rounded-circle');
end;
function TModelCardStyledShapeClasses.Shadow: iModelCardStyledShapeClasses;
begin
Result := Self;
FClasses.Add('shadow');
end;
end.