forked from academiadocodigo/TBGWebCharts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Image.Classes.pas
112 lines (93 loc) · 2.22 KB
/
Image.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
unit Image.Classes;
interface
uses
Interfaces, Generics.Collections;
Type
TModelImageClass = class(TInterfacedObject, iModelImageClass)
private
[weak]
FParent : iModelImage;
FList : TList<String>;
public
constructor Create(Parent : iModelImage);
destructor Destroy; override;
class function New(Parent : iModelImage) : iModelImageClass;
function imgFluid : iModelImageClass;
function imgThumbnail : iModelImageClass;
function FloatLeft : iModelImageClass;
function FloatRight : iModelImageClass;
function MxAuto : iModelImageClass;
function DBlock : iModelImageClass;
function rounded : iModelImageClass;
function &End : iModelImage;
function ResultClass : String;
end;
implementation
uses
SysUtils, Injection;
{ TModelImageClass }
function TModelImageClass.&End: iModelImage;
begin
Result := FParent;
end;
constructor TModelImageClass.Create(Parent : iModelImage);
begin
{$IF RTLVERSION > 27 }
TInjection.Weak(@FParent, Parent);
{$ELSE}
FParent := Parent;
{$IFEND}
FList := TList<String>.Create;
end;
function TModelImageClass.DBlock: iModelImageClass;
begin
Result := Self;
FList.Add('d-block');
end;
destructor TModelImageClass.Destroy;
begin
FreeAndNil(FList);
inherited;
end;
function TModelImageClass.imgFluid: iModelImageClass;
begin
Result := Self;
FList.Add('img-fluid');
end;
function TModelImageClass.imgThumbnail: iModelImageClass;
begin
Result := Self;
FList.Add('img-thumbnail');
end;
class function TModelImageClass.New(Parent : iModelImage) : iModelImageClass;
begin
Result := Self.Create(Parent);
end;
function TModelImageClass.ResultClass: String;
var
I: Integer;
begin
for I := 0 to Pred(FList.Count) do
Result := Result + ' ' + FList[I];
end;
function TModelImageClass.rounded: iModelImageClass;
begin
Result := Self;
FList.Add('rounded');
end;
function TModelImageClass.FloatLeft: iModelImageClass;
begin
Result := Self;
FList.Add('float-left');
end;
function TModelImageClass.FloatRight: iModelImageClass;
begin
Result := Self;
FList.Add('float-right');
end;
function TModelImageClass.MxAuto: iModelImageClass;
begin
Result := Self;
FList.Add('mx-auto');
end;
end.