-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathDW.VCL.Region.pas
78 lines (65 loc) · 2.07 KB
/
DW.VCL.Region.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
unit DW.VCL.Region;
interface
uses
Classes, DW.VCL.CustomRegion, DW.VCL.Common, DWTypes;
type
TDWRegion = class(TDWCustomRegion)
private
FBackground: TDWRegionBack;
FRegionType: TDWRegionType;
FTagType: TDWRegionTagType;
procedure SetRegionType(AValue: TDWRegionType);
procedure SetBackground(AValue: TDWRegionBack);
procedure SetTagType(const Value: TDWRegionTagType);
protected
procedure InternalRenderCss(var ACss: string); override;
public
function GetRoleString: string; override;
published
property BSBackground: TDWRegionBack read FBackground write SetBackground default bsrbDefault;
property BSRegionType: TDWRegionType read FRegionType write SetRegionType default bsrtNone;
property TagType: TDWRegionTagType read FTagType write SetTagType default bsttDiv;
end;
implementation
uses DW.VCL.NavBar;
procedure TDWRegion.InternalRenderCss(var ACss: string);
begin
TDWBSCommon.AddCssClass(ACss, aDWRegionType[FRegionType]);
if (FRegionType = bsrtPanel) then
TDWBSCommon.AddCssClass(ACss, 'panel-' + aDWRegionBack[FBackground])
else if (FRegionType in [bsrtWell, bsrtWellLarge, bsrtWellSmall]) and (FBackground <> bsrbDefault)
then
TDWBSCommon.AddCssClass(ACss, 'well-' + aDWRegionBack[FBackground])
else if (FBackground <> bsrbDefault) then
TDWBSCommon.AddCssClass(ACss, 'bg-' + aDWRegionBack[FBackground])
else if (Parent is TDWNavBar) then
if TagType = bsttDiv then
TDWBSCommon.AddCssClass(ACss, 'navbar-btn')
else
TDWBSCommon.AddCssClass(ACss, 'navbar-text');
inherited;
end;
function TDWRegion.GetRoleString: string;
begin
if FRegionType = bsrtButtonToolbar then
Result := 'toolbar'
else
Result := '';
end;
procedure TDWRegion.SetRegionType(AValue: TDWRegionType);
begin
FRegionType := AValue;
Invalidate;
end;
procedure TDWRegion.SetTagType(const Value: TDWRegionTagType);
begin
FTagType := Value;
FTagName := aDWRegionTagType[Value];
AsyncRefreshControl;
end;
procedure TDWRegion.SetBackground(AValue: TDWRegionBack);
begin
FBackground := AValue;
Invalidate;
end;
end.