-
Notifications
You must be signed in to change notification settings - Fork 12
/
Color.pas
115 lines (94 loc) · 2.02 KB
/
Color.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
113
114
115
unit Color;
interface
uses
Interfaces;
Type
TModelColor<T : IInterface> = class(TInterfacedObject, iModelColors<T>)
private
[weak]
FParent : T;
FColor : String;
public
constructor Create(Parent : T);
destructor Destroy; override;
class function New(Parent : T) : iModelColors<T>;
function Primary : iModelColors<T>;
function Secondary : iModelColors<T>;
function Success : iModelColors<T>;
function Danger : iModelColors<T>;
function Warning : iModelColors<T>;
function Info : iModelColors<T>;
function Light : iModelColors<T>;
function Dark : iModelColors<T>;
function Result : String;
function &End : T;
end;
implementation
uses
Injection;
{ TModelColor }
function TModelColor<T>.&End: T;
begin
Result := FParent;
end;
constructor TModelColor<T>.Create(Parent : T);
begin
{$IF RTLVERSION > 27 }
TInjection.Weak(@FParent, Parent);
{$ELSE}
FParent := Parent;
{$IFEND}
end;
function TModelColor<T>.Danger: iModelColors<T>;
begin
Result := Self;
FColor := 'danger';
end;
function TModelColor<T>.Dark: iModelColors<T>;
begin
Result := Self;
FColor := 'dark';
end;
destructor TModelColor<T>.Destroy;
begin
inherited;
end;
function TModelColor<T>.Info: iModelColors<T>;
begin
Result := Self;
FColor := 'info';
end;
function TModelColor<T>.Light: iModelColors<T>;
begin
Result := Self;
FColor := 'light';
end;
class function TModelColor<T>.New(Parent : T): iModelColors<T>;
begin
Result := Self.Create(Parent);
end;
function TModelColor<T>.Primary: iModelColors<T>;
begin
Result := Self;
FColor := 'primary';
end;
function TModelColor<T>.Result : String;
begin
Result := FColor;
end;
function TModelColor<T>.Secondary: iModelColors<T>;
begin
Result := Self;
FColor := 'secondary';
end;
function TModelColor<T>.Success: iModelColors<T>;
begin
Result := Self;
FColor := 'success';
end;
function TModelColor<T>.Warning: iModelColors<T>;
begin
Result := Self;
FColor := 'warning';
end;
end.