-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathDW.VCL.ButtonGroup.pas
79 lines (67 loc) · 1.9 KB
/
DW.VCL.ButtonGroup.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
unit DW.VCL.ButtonGroup;
interface
uses
SysUtils, Classes, Controls, StrUtils,
DW.VCL.CustomRegion, DWTypes;
type
TDWButtonGroup = class(TDWCustomRegion)
private
FVertical: boolean;
FJustified: boolean;
FSize: TDWSize;
procedure SetJustified(const Value: boolean);
procedure SetSize(const Value: TDWSize);
procedure SetVertical(const Value: boolean);
protected
procedure InternalRenderCss(var ACss: string); override;
public
constructor Create(AOwner: TComponent); override;
function GetRoleString: string; override;
published
property BSVertical: boolean read FVertical write SetVertical default false;
property BSJustified: boolean read FJustified write SetJustified default false;
property BSButtonSize: TDWSize read FSize write SetSize default bsszDefault;
end;
implementation
uses DW.VCL.NavBar, DW.VCL.Common;
constructor TDWButtonGroup.Create(AOwner: TComponent);
begin
inherited;
FVertical := false;
FJustified := false;
FSize := bsszDefault;
end;
function TDWButtonGroup.GetRoleString: string;
begin
Result := 'group';
end;
procedure TDWButtonGroup.InternalRenderCss(var ACss: string);
begin
if FVertical then
TDWBSCommon.AddCssClass(ACss, 'btn-group-vertical')
else
TDWBSCommon.AddCssClass(ACss, 'btn-group');
if FSize <> bsszDefault then
TDWBSCommon.AddCssClass(ACss, 'btn-group-' + aDWSize[FSize]);
if FJustified then
TDWBSCommon.AddCssClass(ACss, 'btn-group-justified');
if Parent is TDWNavBarBase then
TDWBSCommon.AddCssClass(ACss, 'navbar-btn');
inherited;
end;
procedure TDWButtonGroup.SetJustified(const Value: boolean);
begin
FJustified := Value;
AsyncRefreshControl;
end;
procedure TDWButtonGroup.SetSize(const Value: TDWSize);
begin
FSize := Value;
AsyncRefreshControl;
end;
procedure TDWButtonGroup.SetVertical(const Value: boolean);
begin
FVertical := Value;
AsyncRefreshControl;
end;
end.