summaryrefslogtreecommitdiff
path: root/plugins/Watrack/kolframe/frm_icogroup.inc
blob: 2b6e9de6f9bc5b4b539004926a4f8ce4ca5b4ee2 (plain)
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
{Panel = group of icons}

procedure TWATFrame.AdjustButtons(atop:integer);
var
  i,lWidth,lOffs,gap:integer;
  lleft:integer;
  D:PWATFrameData;
begin
  D:=CustomData;

  if D.btnarray[0]=nil then exit;

  if (D.ShowControls and scGap)<>0 then
    gap:=BtnGap
  else
    gap:=0;

  D.btnarray[0].Visible:=(D.ShowControls and scVolume)<>0;
  D.btnarray[1].Visible:=(D.ShowControls and scVolume)<>0;

  lWidth:=(Length(D.btnarray)-2)*(16+gap)-gap;
  if (D.ShowControls and scVolume)<>0 then
    Inc(lWidth, VolBtnDist+2*(16+gap));
  lLeft:=(Width-lWidth) div 2;

  lOffs:=0;
  if (D.ShowControls and scVolume)<>0 then
  begin
    D.btnarray[0].Left:=lleft+lOffs;
    D.btnarray[0].Top :=atop;
    Inc(lOffs,16+gap);
    D.btnarray[1].Left:=lleft+lOffs;
    D.btnarray[1].Top :=atop;
    Inc(lOffs,16+gap+VolBtnDist);
  end;

  for i:=2 to HIGH(D.btnarray) do
  begin
    D.btnarray[i].Left:=lleft+lOffs;
    D.btnarray[i].Top :=atop;
    Inc(lOffs,16+gap);
  end;

end;

procedure TWATFrame.RefreshButtonIcons;
var
  i:integer;
  D:PWATFrameData;
begin
  D:=CustomData;

  if D.btnarray[0]<>nil then exit;

  for i:=0 to HIGH(D.btnarray) do
    D.btnarray[i].RefreshIcon;
end;

procedure TWATFrame.FreeButtonsDesigner;
var
  i:integer;
  D:PWATFrameData;
begin
  D:=CustomData;

  if D.btnarray[0]<>nil then exit;

  for i:=0 to HIGH(D.btnarray) do
    D.Designer.Disconnect(D.btnarray[i]);
end;

procedure TWATFrame.MakeButtonsDesigner;
var
  i:integer;
  D:PWATFrameData;
begin
  D:=CustomData;

  if D.btnarray[0]<>nil then exit;

  for i:=0 to HIGH(D.btnarray) do
    D.Designer.Connect('Button',D.btnarray[i],DESIGNER_NORESIZE);
end;

procedure TWATFrame.FreeButtons;
var
  i:integer;
  D:PWATFrameData;
begin
  D:=CustomData;

  if D.btnarray[0]<>nil then exit;

  for i:=0 to HIGH(D.btnarray) do
  begin
    D.btnarray[i].Free;
    D.btnarray[i]:=nil;
  end;
end;

procedure TWATFrame.MakeNewButtonGroup;
var
  D:PWATFrameData;
begin
  D:=CustomData;

  D.btnarray[0]:=CreateIcoButton(@self,waticons.GetIcon,DoAction,WAT_CTRL_VOLDN,300);
  D.btnarray[1]:=CreateIcoButton(@self,waticons.GetIcon,DoAction,WAT_CTRL_VOLUP,300);
  D.btnarray[2]:=CreateIcoButton(@self,waticons.GetIcon,DoAction,WAT_CTRL_PREV,2000);
  D.btnarray[3]:=CreateIcoButton(@self,waticons.GetIcon,DoAction,WAT_CTRL_PLAY);
  D.btnarray[4]:=CreateIcoButton(@self,waticons.GetIcon,DoAction,WAT_CTRL_PAUSE);
  D.btnarray[5]:=CreateIcoButton(@self,waticons.GetIcon,DoAction,WAT_CTRL_STOP);
  D.btnarray[6]:=CreateIcoButton(@self,waticons.GetIcon,DoAction,WAT_CTRL_NEXT,2000);
end;