-
Notifications
You must be signed in to change notification settings - Fork 4
/
uMain.pas
135 lines (115 loc) · 3.43 KB
/
uMain.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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
unit uMain;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.StdCtrls, FMX.Controls.Presentation,
FMX.ListView.Types,
FMX.ListView.Appearances, FMX.ListView.Adapters.Base, FMX.ListView, FMX.MultiView, FMX.Layouts, FMX.Objects;
type
TFormMain = class(TForm)
ToolBar1: TToolBar;
lbNavBar: TLabel;
ListView1: TListView;
MultiView1: TMultiView;
Layout1: TLayout;
Text1: TText;
sbPlus: TSpeedButton;
sbMinus: TSpeedButton;
procedure FormShow(Sender: TObject);
procedure sbPlusClick(Sender: TObject);
procedure sbMinusClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FormMain: TFormMain;
implementation
{$R *.fmx}
uses
FMX.MaterialDesignIcons;
/// <summary> Ïðèìåíèòü âñåì äî÷åðíèì êîìïîíåíòàì êàñòîìíûé ñòèëü </summary>
procedure MaterialDesignIconsApply(const Control: TControl);
var
i: Integer;
begin
if Control is TControl then
begin
MaterialDesignIconsAssign(TControl(Control));
if Control is TStyledControl then
TStyledControl(Control).ApplyStyleLookup;
end;
for i := 0 to Control.ControlsCount - 1 do
MaterialDesignIconsApply(Control.Controls[i]);
end;
/// <summary> íàñòðîéêà ListView </summary>
procedure FontGlyphConfig(const aLV: TListView);
begin
aLV.CanSwipeDelete := false;
aLV.ItemAppearance.ItemAppearance := 'Custom';
with aLV.ItemAppearanceObjects.ItemObjects do
begin
Image.Visible := false;
Accessory.Visible := false;
TextButton.Visible := false;
GlyphButton.Visible := false;
Text.Visible := true;
Text.PlaceOffset.X := 40;
Detail.Visible := true;
Detail.Width := 30;
Detail.PlaceOffset.X := 0;
Detail.TextAlign := TTextAlign.Center;
Detail.TextColor := $FF3F51B5;
Detail.Font.Size := 24;
Detail.Font.Family := MaterialDesignIconsName;
end;
end;
/// <summary> çàïîëíåíèå ListView </summary>
procedure MenuMake(const aLV: TListView);
const
MAXARRAY = 5;
TLVMenuItems: array [0 .. MAXARRAY] of string = ('Áóäèëüíèê', 'Android', 'Apple', 'Çàðÿäêà', 'Ñåðäöå', 'Çâîíîê');
TLVMenuItemsSymb: array [0 .. MAXARRAY] of string = (mdi_alarm, mdi_android, mdi_apple, mdi_battery_charging_100,
mdi_heart, mdi_bell_ring);
var
i: Integer;
begin
FontGlyphConfig(aLV);
for i := Low(TLVMenuItems) to High(TLVMenuItems) do
begin
with aLV.Items.Add do
begin
Text := TLVMenuItems[i];
Detail := TLVMenuItemsSymb[i];
Tag := i;
end;
end;
end;
procedure TFormMain.FormShow(Sender: TObject);
begin
MaterialDesignIconsApply(ToolBar1);
lbNavBar.Font.Size := 24;
sbPlus.Font.Size := 24;
sbMinus.Font.Size := 24;
lbNavBar.Text := mdi_menu;
sbMinus.Text := mdi_minus;
sbPlus.Text := mdi_plus;
sbMinus.FontColor := TAlphaColorRec.Blue;
sbPlus.FontColor := TAlphaColorRec.Green;
MenuMake(ListView1);
MaterialDesignIconsAssign(Text1);
Text1.Font.Size := 20;
Text1.Text := 'Material Design Icons ' + mdi_alert + sLineBreak +
'growing icon collection allows designers and developers targeting various platforms to download icons in ' +
'the format, color and size they need for any project.';
end;
procedure TFormMain.sbMinusClick(Sender: TObject);
begin
Text1.Font.Size := Text1.Font.Size - 1;
end;
procedure TFormMain.sbPlusClick(Sender: TObject);
begin
Text1.Font.Size := Text1.Font.Size + 1;
end;
end.