Browse Source

Added BCExpandPanel Controls

Massimo Magnano 1 year ago
parent
commit
4eb5a3bbec
4 changed files with 2938 additions and 19 deletions
  1. 286 0
      BCExpandPanels.lrs
  2. 2633 0
      BCExpandPanels.pas
  3. 7 2
      bgracontrols.lpk
  4. 12 17
      bgracontrols.pas

+ 286 - 0
BCExpandPanels.lrs

@@ -0,0 +1,286 @@
+LazarusResources.Add('TBCExpandPanel','BMP',[
+  'BM*'#5#0#0#0#0#0#0'z'#0#0#0'l'#0#0#0#20#0#0#0#20#0#0#0#1#0#24#0#0#0#0#0#176#4
+  +#0#0#196#14#0#0#196#14#0#0#0#0#0#0#0#0#0#0'BGRs'#0#0#0#0#0#0#0#0#0#0#0#0#0#0
+  +#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#2#0#0#0
+  +#0#0#0#0#0#0#0#0#0#0#0#0#245#244#243#193#192#194#193#192#194#193#192#194#193
+  +#192#194#193#192#194#193#192#194#193#192#194#193#192#194#193#192#194#193#192
+  +#194#193#192#194#193#192#194#193#192#194#193#192#194#193#192#194#193#192#194
+  +#193#192#194#193#192#194#193#192#194#146'ww'#146'ww'#146'ww'#146'ww'#146'ww'
+  +#146'ww'#146'ww'#146'ww'#146'ww'#146'ww'#146'ww'#146'ww'#146'ww'#146'ww'#146
+  +'ww'#146'ww'#146'ww'#146'ww'#146'ww'#193#192#194#146'ww'#255#255#255#193#192
+  +#194#193#192#194#193#192#194#193#192#194#193#192#194#193#192#194#193#192#194
+  +#193#192#194#193#192#194#193#192#194#193#192#194#193#192#194#193#192#194#193
+  +#192#194#193#192#194#193#192#194#146'ww'#193#192#194#146'ww'#255#255#255#219
+  +#223#223#219#223#223#219#223#223#219#223#223#219#223#223#219#223#223#219#223
+  +#223#219#223#223#219#223#223#219#223#223#219#223#223#219#223#223#219#223#223
+  +#219#223#223#219#223#223#193#192#194#146'ww'#193#192#194#146'ww'#255#255#255
+  +#219#223#223#219#223#223#219#223#223#219#223#223#219#223#223#219#223#223#219
+  +#223#223#219#223#223#219#223#223#219#223#223#219#223#223#219#223#223#219#223
+  +#223#219#223#223#219#223#223#193#192#194#146'ww'#193#192#194#146'ww'#255#255
+  +#255#219#223#223#219#223#223#219#223#223#219#223#223#219#223#223#219#223#223
+  +#219#223#223#219#223#223#219#223#223#219#223#223#219#223#223#219#223#223#219
+  +#223#223#219#223#223#219#223#223#193#192#194#146'ww'#193#192#194#146'ww'#255
+  +#255#255#219#223#223#219#223#223#219#223#223#219#223#223#219#223#223#219#223
+  +#223#219#223#223#219#223#223#219#223#223#219#223#223#219#223#223#219#223#223
+  +#219#223#223#219#223#223#219#223#223#193#192#194#146'ww'#193#192#194#146'ww'
+  +#255#255#255#219#223#223#219#223#223#219#223#223#219#223#223#219#223#223#219
+  +#223#223#219#223#223#219#223#223#219#223#223#219#223#223#219#223#223#219#223
+  +#223#219#223#223#219#223#223#219#223#223#193#192#194#146'ww'#193#192#194#146
+  +'ww'#255#255#255#219#223#223#219#223#223#219#223#223#219#223#223#219#223#223
+  +#219#223#223#219#223#223#219#223#223#219#223#223#219#223#223#219#223#223#219
+  +#223#223#219#223#223#219#223#223#219#223#223#193#192#194#146'ww'#193#192#194
+  +#146'ww'#255#255#255#219#223#223#219#223#223#219#223#223#219#223#223#219#223
+  +#223#219#223#223#219#223#223#219#223#223#219#223#223#219#223#223#219#223#223
+  +#219#223#223#219#223#223#219#223#223#219#223#223#193#192#194#146'ww'#193#192
+  +#194#146'ww'#255#255#255#219#223#223#219#223#223#219#223#223#219#223#223#219
+  +#223#223#219#223#223#219#223#223#219#223#223#219#223#223#219#223#223#219#223
+  +#223#219#223#223#219#223#223#219#223#223#219#223#223#193#192#194#146'ww'#193
+  +#192#194#146'ww'#255#255#255#219#223#223#219#223#223#219#223#223#219#223#223
+  +#219#223#223#219#223#223#219#223#223#219#223#223#219#223#223#219#223#223#219
+  +#223#223#219#223#223#219#223#223#219#223#223#219#223#223#193#192#194#146'ww'
+  +#193#192#194#146'ww'#255#255#255#219#223#223#219#223#223#219#223#223#219#223
+  +#223#219#223#223#219#223#223#219#223#223#219#223#223#219#223#223#219#223#223
+  +#219#223#223#219#223#223#219#223#223#219#223#223#219#223#223#193#192#194#146
+  +'ww'#193#192#194#146'ww'#255#255#255#219#223#223#219#223#223#219#223#223#219
+  +#223#223#219#223#223#219#223#223#219#223#223#219#223#223#219#223#223#219#223
+  +#223#219#223#223#219#223#223#219#223#223#219#223#223#219#223#223#193#192#194
+  +#146'ww'#193#192#194#146'ww'#255#255#255#219#223#223#219#223#223#219#223#223
+  +#219#223#223#219#223#223#219#223#223#219#223#223#219#223#223#219#223#223#219
+  +#223#223#219#223#223#219#223#223#219#223#223#219#223#223#219#223#223#193#192
+  +#194#146'ww'#193#192#194#146'ww'#255#255#255#219#223#223#219#223#223#219#223
+  +#223#219#223#223#219#223#223#219#223#223#219#223#223#219#223#223#219#223#223
+  +#219#223#223#219#223#223#219#223#223#219#223#223#219#223#223#219#223#223#193
+  +#192#194#146'ww'#193#192#194#146'ww'#255#255#255#219#223#223#219#223#223#219
+  +#223#223#219#223#223#219#223#223#219#223#223#219#223#223#219#223#223#219#223
+  +#223#219#223#223#219#223#223#219#223#223#219#223#223#219#223#223#219#223#223
+  +#193#192#194#146'ww'#193#192#194#248#135#23#248#135#23#248#135#23#248#135#23
+  +#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23
+  +#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23
+  +#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23
+  +#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23
+  +#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23
+  +#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23
+  +#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23
+  +#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23
+]);
+LazarusResources.Add('TBCExpandPanels','BMP',[
+  'BM*'#5#0#0#0#0#0#0'z'#0#0#0'l'#0#0#0#20#0#0#0#20#0#0#0#1#0#24#0#0#0#0#0#176#4
+  +#0#0#196#14#0#0#196#14#0#0#0#0#0#0#0#0#0#0'BGRs'#0#0#0#0#0#0#0#0#0#0#0#0#0#0
+  +#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#2#0#0#0
+  +#0#0#0#0#0#0#0#0#0#0#0#0#245#244#243#193#192#194#193#192#194#193#192#194#193
+  +#192#194#193#192#194#193#192#194#193#192#194#193#192#194#193#192#194#193#192
+  +#194#193#192#194#193#192#194#193#192#194#193#192#194#193#192#194#193#192#194
+  +#193#192#194#193#192#194#193#192#194#146'ww'#146'ww'#146'ww'#146'ww'#146'ww'
+  +#146'ww'#146'ww'#146'ww'#146'ww'#146'ww'#146'ww'#146'ww'#146'ww'#146'ww'#146
+  +'ww'#146'ww'#146'ww'#146'ww'#146'ww'#193#192#194#146'ww'#255#255#255#193#192
+  +#194#193#192#194#193#192#194#193#192#194#193#192#194#193#192#194#193#192#194
+  +#193#192#194#193#192#194#193#192#194#193#192#194#193#192#194#193#192#194#193
+  +#192#194#193#192#194#193#192#194#146'ww'#193#192#194#146'ww'#255#255#255#219
+  +#223#223#219#223#223#219#223#223#219#223#223#219#223#223#219#223#223#219#223
+  +#223#219#223#223#219#223#223#219#223#223#219#223#223#219#223#223#219#223#223
+  +#219#223#223#219#223#223#193#192#194#146'ww'#193#192#194#146'ww'#255#255#255
+  +#219#223#223#219#223#223#219#223#223#219#223#223#219#223#223#219#223#223#219
+  +#223#223#219#223#223#219#223#223#219#223#223#219#223#223#219#223#223#219#223
+  +#223#219#223#223#219#223#223#193#192#194#146'ww'#193#192#194#146'ww'#255#255
+  +#255#219#223#223#219#223#223#219#223#223#219#223#223#219#223#223#219#223#223
+  +#219#223#223#219#223#223#219#223#223#219#223#223#219#223#223#219#223#223#219
+  +#223#223#219#223#223#219#223#223#193#192#194#146'ww'#193#192#194#248#135#23
+  +#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23
+  +#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23
+  +#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23
+  +#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23
+  +#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23
+  +#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23
+  +#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23
+  +#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23
+  +#248#135#23#248#135#23#248#135#23#245#244#243#193#192#194#193#192#194#193#192
+  +#194#193#192#194#193#192#194#193#192#194#193#192#194#193#192#194#193#192#194
+  +#193#192#194#193#192#194#193#192#194#193#192#194#193#192#194#193#192#194#193
+  +#192#194#193#192#194#193#192#194#193#192#194#146'ww'#146'ww'#146'ww'#146'ww'
+  +#146'ww'#146'ww'#146'ww'#146'ww'#146'ww'#146'ww'#146'ww'#146'ww'#146'ww'#146
+  +'ww'#146'ww'#146'ww'#146'ww'#146'ww'#146'ww'#193#192#194#146'ww'#255#255#255
+  +#193#192#194#193#192#194#193#192#194#193#192#194#193#192#194#193#192#194#193
+  +#192#194#193#192#194#193#192#194#193#192#194#193#192#194#193#192#194#193#192
+  +#194#193#192#194#193#192#194#193#192#194#146'ww'#193#192#194#146'ww'#255#255
+  +#255#219#223#223#219#223#223#219#223#223#219#223#223#219#223#223#219#223#223
+  +#219#223#223#219#223#223#219#223#223#219#223#223#219#223#223#219#223#223#219
+  +#223#223#219#223#223#219#223#223#193#192#194#146'ww'#193#192#194#146'ww'#255
+  +#255#255#219#223#223#219#223#223#219#223#223#219#223#223#219#223#223#219#223
+  +#223#219#223#223#219#223#223#219#223#223#219#223#223#219#223#223#219#223#223
+  +#219#223#223#219#223#223#219#223#223#193#192#194#146'ww'#193#192#194#146'ww'
+  +#255#255#255#219#223#223#219#223#223#219#223#223#219#223#223#219#223#223#219
+  +#223#223#219#223#223#219#223#223#219#223#223#219#223#223#219#223#223#219#223
+  +#223#219#223#223#219#223#223#219#223#223#193#192#194#146'ww'#193#192#194#146
+  +'ww'#255#255#255#219#223#223#219#223#223#219#223#223#219#223#223#219#223#223
+  +#219#223#223#219#223#223#219#223#223#219#223#223#219#223#223#219#223#223#219
+  +#223#223#219#223#223#219#223#223#219#223#223#193#192#194#146'ww'#193#192#194
+  +#146'ww'#255#255#255#219#223#223#219#223#223#219#223#223#219#223#223#219#223
+  +#223#219#223#223#219#223#223#219#223#223#219#223#223#219#223#223#219#223#223
+  +#219#223#223#219#223#223#219#223#223#219#223#223#193#192#194#146'ww'#193#192
+  +#194#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23#248
+  +#135#23#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23#248
+  +#135#23#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23#248
+  +#135#23#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23#248
+  +#135#23#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23#248
+  +#135#23#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23#248
+  +#135#23#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23#248
+  +#135#23#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23#248#135#23#248
+  +#135#23#248#135#23#248#135#23#248#135#23#248#135#23
+]);
+LazarusResources.Add('BCEXP_PANEL_BOTTOM','PNG',[
+  #137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#16#0#0#0#16#8#4#0#0#0#181#250'7'
+  +#234#0#0#0#2'bKGD'#0#255#135#143#204#191#0#0#0#9'pHYs'#0#0#1#187#0#0#1#187#1
+  +':'#236#227#226#0#0#0#7'tIME'#7#223#7#11#14'#4'#223#30#241#149#0#0#1#158'IDA'
+  +'T('#207'-'#209#191'k'#19'a'#28#128#241#231'}'#239#189'\'#175#197'T9Z'#141
+  +#232'P1)H'#196#18#210#14#226'&"58('#212#210#198'Eq'#179'H'#139'C'#161#25#196
+  +'!N'#21#138#255#130#20#172'N'#14#181'K'#7#193'A'#171'!t'#208#197#173#131'M'
+  +#196#31#164#197#203#245'8'#239#251'vh'#158#241'Y?'#138'^'#245#130'T'#165',%'
+  +#208'M'#221#208#171#181#239'G_'#1'<Q2'#255#191#30#251#154#1' D'#240'"S'#211
+  +'+O-(XRv'#189';'#217#199'U'#134#241#209#196#236#178'IL'#255#134#170'<'#179#14
+  +'L,'#132's#'#220#226#28#1'Y'#142#145'e'#136#139#180'h'#231#213#222#199'Oj'
+  +#161#144'l{'#254'}N'#225#227'b'#16',B'#196#30'/8'#136#220'1'#29'WC'#191#194
+  +'I|'#222'3'#195'%'#250#201#243#138#1#6#185'K'#232#199#179'&)'#187#28#199'%'
+  +#195'$'#134#151#12's'#143'Y'#192''''#135'G2n'#146'R'#128'Fp'#128'k8'#132#220
+  +#4'@'#147'!'#224'G'#201#164'X\4'#31'x'#199'/~'#178#201#9'N'#243#152'i4'#138
+  +#20'-'#205#191'$'#8#151#169#16'0'#200'Y'#2#230#152#193'"'#180#145#166#161#241
+  +#239'F'#155#28#194#21'<'#222'r'#192'4S'#128#240#155#14#222#23#167#184'k'#31
+  +#236#184#227'd0'#156#193'r'#129#219'@J'#151#231#236'G'#234#161#243#245'O'#177
+  +#187#127#189#195'('#26#205#8#163#8')]'#214#248#140'Y\[w'#160#184#229'L'#236
+  +#228#183'9'#143'!%!'#166#197'2[x'#27#234#209#183'#'#172';J'#230#165#158#250
+  +'YrhZtp"]'#211'+'#175'mO'#19'`'#170'`'#171'R'#182'%PM'#221'P'#171'oz'#220#135
+  +'D'#29#142#195#249#157'fT'#0#0#0#0'IEND'#174'B`'#130
+]);
+LazarusResources.Add('BCEXP_PANEL_LEFT','PNG',[
+  #137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#16#0#0#0#16#8#4#0#0#0#181#250'7'
+  +#234#0#0#0#2'sBIT'#8#8'U'#236'F'#4#0#0#0#9'pHYs'#0#0#1#187#0#0#1#187#1':'#236
+  +#227#226#0#0#0#25'tEXtSoftware'#0'www.inkscape.org'#155#238'<'#26#0#0#1'xIDA'
+  +'Tx'#218'='#145'?K'#195'P'#20#197'_&'#253#10#142#14'f'#18#23#191#130#163'P'
+  +#173'iDB'#177#226'_T'#144#215'H'#181#213#18'C'#169#155'~'#0#23'A'#208#193'M!'
+  +'AD'#29'ts'#144#130':Hqq'#137#21#165'D'#225#13'1'#229'g'#9'A.'#247'p'#185#28
+  +#14#247#158'#H'#171#174#215'\'#215's'#2'''p'#189#154'['#215'I'#247#9'8ZU'#150
+  +'U'#145'u'#28#156'.'#22')'#171#170't'#180#148'P'#209#202#254#26#27'\'#210#224
+  +#133'&O'#221#169#196#26'e'#191#162'%'#4'['#174#176#207'#'#239#180#249#230#135
+  +#144#15'^'#217'c'#5'["'#132#212'W'#149#205'3_(~'#185#165'CLD'#200#27#235#172
+  +'*'#169#139'ew'#134#27'>Qt'#184'c'#19#0#159#152#144#6'3,'#239#136'yo'#129#7
+  +'Bb'#238')1'#11'\b'#0#17'-'#150#152#247'D!'#176'i'#208#230#138'-,F'#185'&'
+  +#207#16#16#211#238'n'#10#129#200#7'E'#158#9'9c'#130#1'z9g'#132#30#160'C'#200
+  +'6'#249'@X^!Q'#136'9e'#144'>'#224#152#254'Ta'#14#203#19#150'kpA'#139#8'8d'#24
+  +#128'# '#162#137#129#181'#'#166#244#156'Z'#228'59'#19'N'#0' '#249#194'&'#167
+  +#166't'#129'0'#229#24#187#188#17#18#17#255#251'p'#192#24#166'L'#156#156#212
+  +'L?'#195#18#13'Z'#180#9#187#221#164'H'#6#211#159#212#210#176'L'#205#144'Y'
+  +#149'!O'#137'M'#166#201#144'U'#134'4'#211#176#210#202#233#134#155#245#198#131
+  +#241' '#235#25'n'#238'?'#238'?'#21#138'nE'#16#166'W~'#0#0#0#0'IEND'#174'B`'
+  +#130
+]);
+LazarusResources.Add('BCEXP_PANEL_RIGHT','PNG',[
+  #137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#16#0#0#0#16#8#4#0#0#0#181#250'7'
+  +#234#0#0#0#2'sBIT'#8#8'U'#236'F'#4#0#0#0#9'pHYs'#0#0#1#187#0#0#1#187#1':'#236
+  +#227#226#0#0#0#25'tEXtSoftware'#0'www.inkscape.org'#155#238'<'#26#0#0#1'yIDA'
+  +'T'#24#25#5#193'AKS'#1#28#0#240#255'N'#245#21#250#0#237#222#197'K'#135#238#29
+  +#154#142'mbCR'#200#146')'#200#219#196#154'&s'#136#221#10'/'#29#234#214'%'#8
+  +#161'C'#240#134#8#246#1':'#196#160'<'#132'x'#241#178#140'b'#188#130'wXo'#252
+  +#250#253'B'#8'!'#14#202#251#253'~'#218#27#245'F'#253't'#191#127'P'#22'B'#136
+  +#16#162'W'#218'M'#186'y'#219#166#158#158'Mm'#221'|7'#233#149#132#8#177']'#234
+  +#14'6<qb'#232#187's'#223#156#216#178#161';'#216'.'#137#16#157'd'#205'K_'#253
+  +'0'#246#199'_'#153#159'.'#188#176#166#147#136'H'#202#235'y'#199#153#223'r'
+  +#255'L'#157'*Ld.mZ'#207#147'r'#180#250#203'>'#249'%'#247#25#236#248#136'BfhY'
+  +'k/V'#210'G'#190#200#20#14#157#162#229#158'w'#152#184#178'j%'#141#165'Q'#199
+  +#208'X'#161#165#238#216'}'#183#204'8R'#24#219#177'4'#138#197'Q'#219#153#204
+  +#212#140'k'#222#154'q'#221'M'#239'Me'#158'Y'#28'E3]24V'#184#227#16#183#221
+  +#240#10#133#177#135#154'i4'#251'5'#199#174'L'#28#129#187'^'#131#137's5'#205
+  +#189'X('#215#243#199'.d'#10#240#1#20'2'#29#245'|'#161#28#162#145#204'z'#238
+  +'Rf'#162'0U'#152#200#188'1'#171#145#136#16#243#165#198#160'b'#213#208#149#177
+  +#204#216#185#182#138#198'`'#190'$B'#136'F'#169#150'T'#243#138'E['#158'z'#160
+  +#162#154#215#146'FI'#136#16'B'#136'z'#185#214#175#166's'#163#185'Q5'#173#245
+  +#235'e!'#132#248#15#166'~m'#219#194#10#172#23#0#0#0#0'IEND'#174'B`'#130
+]);
+LazarusResources.Add('BCEXP_PANEL_TOP','PNG',[
+  #137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#16#0#0#0#16#8#4#0#0#0#181#250'7'
+  +#234#0#0#0#2'bKGD'#0#255#135#143#204#191#0#0#0#9'pHYs'#0#0#1#187#0#0#1#187#1
+  +':'#236#227#226#0#0#0#7'tIME'#7#223#7#11#14'"7_'#12#145'n'#0#0#1#156'IDAT('
+  +#207'5'#209'=h'#19'q'#28#198#241#239#255'w'#255#235#245#26#26#165'U1'#131#130
+  +'/M'#151#10#229#136#157#28#196#23#164'u'#18'T'#8#221#156#165#180#139#130#25
+  +#138'B'#156','#20'q'#23#132#6'Z'#197'Eb'#23#183#14'Z'#13'!'#131'.n*4'#25'LI'
+  +#164#201'y\'#238'w'#14#141#207#248','#15'<'#31#195'0'#229#188'.jA'#3#144#186
+  +#212'd'#163#244#253#176'7'#0#171'F'#151#7#229#200#23'2@'#15#197#11'mI'#214#31
+  +#167'`'#224#145'I'#171#253#249'Q'#174'r'#2#31'!b'#143#15'D'#140'm'#155#155'O'
+  +'S'#7#230'Vz'#247#207'p'#139#179'L'#146'e'#156','#199#185'@'#147#214#148#233
+  +'~'#252'dV'#242'q'#195#243#239'q'#18#31#151#247'd'#184#140#18#210#229'9'#127
+  +'Cw'#214#9#150#250#215'ns'#142'1<'#222'R'#225#128'#'#156#194'"'#156'f'#199'5'
+  +#251'6.'#184#28#197'e'#132'W'#172#17'1'#202#27'".'#225#147#195'#'#190'(q0'
+  +#142#160'l'#241#130'6'#191#232#210#166#202#14#194#8#147#196#129'MHq'#17#138
+  +#20#129'wd'#184#2#128'"'#24#18#172#214#247#23'b'#148#4#135#10'/'#201#145'p'
+  +#29'HQZh'#221'R;Xh'#145'C'#169#176#202#30#211#132#12#152'G'#249'M'#7#239#139
+  +')'#230#7#141#9#255#1#199#200#224#252#255#157#132#30'O'#248#25#218'Y'#231'k{'
+  +#166#255#231'F'#135'i'#4#25#174''''#244#217#228'3'#246#225'f'#213#129#153']g'
+  +#238#199'T'#131#243'X'#18'b"'#154'<c'#23'o'#219',};'#196#186'ktY'#203#137#159
+  +'%'#135#208#164#131#19'JI'#214#183#210#161'&'#192#157'|'#186#168#133'4'#0'S'
+  +#151#154#217'x='#228#254#7#30'^'#147#14#156#201'>g'#0#0#0#0'IEND'#174'B`'#130
+]);
+LazarusResources.Add('BCEXP_PANEL_CLOSE','PNG',[
+  #137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#16#0#0#0#16#8#4#0#0#0#181#250'7'
+  +#234#0#0#0#2'bKGD'#0#255#135#143#204#191#0#0#0#9'pHYs'#0#0#1#187#0#0#1#187#1
+  +':'#236#227#226#0#0#0#7'tIME'#7#224#6#20#8'4'#11#168'@'#255#141#0#0#1#162'ID'
+  +'AT('#207'-'#209'AHSq'#28#192#241#239#255#247#222#235#245#22'{'#134#163#194
+  +#130'@a'#15#130#149#181#182'u'#19#164'C'#136#16#4#21#209':E7C'#28#4#145#3'%d'
+  +']'#2#17#207']'#133'J'#130' '#134#151#14#221#202#26#195#162#16#186#136#135't'
+  +'H'#197#146#230#219#235#249#254#255#14#238'{'#252'^?'#138'^'#181'@'#151'uA'
+  +#231'A'#154#210#144#165#234#247#131#175#0'f'#149#158#218#175'E'#158'p'#4#232
+  +#160'qC'#187'*'#11#143#13'('#152'V'#166#190'7v'#152#203#28#199'C'#136#216#226
+  +'-'#17#169#21'5'#254#196'XP'#170't'#238#15'r'#141'!2'#248#164#241'9'#198'Y'
+  +#182'ie'#213#159#247#31'T%'#136#215'\'#239'.i"N'#146'"d'#157#13'F'#232#178'H'
+  +'7t'#206'KT'#238'x'#227#156#224#21'Y'#222#144#240#153#167'\'#231#11'i'#238
+  +#208#241#162#219'v\p8'#138#131'C'#31#183#168#177#206'sF'#241'I1'#128'K\'#180
+  +#227'|'#6'A3'#129#207#28'U'#224'*3\$'#225#16#25'~'#228'%'#193#224' @'#145'S'
+  +#0#12's'#1'P'#8#138#4#209#205#223#196'h6x'#192';F8'#199#28#139#236'`'#208#180
+  +#208'M'#161#241#151#22#255'xD'#157'I'#158'1'#203#25'*'#188#166#203'O'#218#240
+  +#201#202'm'#153'{'#155'N'#145'~.Q&`'#144'a'#134#24#165#143'yvC5a}'#253#149
+  +#219#219#189#210'f'#140#18#253'X'#216#156#166'D'#154'e>b?|Q'#183' '#183'j'
+  +#149'6'#179'k'#4#184'$'#196'D'#236'0'#207'*'#238#138#154#252'v'#128'uS'#233
+  +')]K<'#159#1#132'm'#218'X'#161'Te'#225#165#233'i'#2#220#8'LY'#23'L'#30'TS'#26
+  +'ji'#185#199#253#31#25#251#143#143#203'P'#224'<'#0#0#0#0'IEND'#174'B`'#130
+]);
+LazarusResources.Add('BCEXP_PANEL_MIN_H','PNG',[
+  #137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#16#0#0#0#16#8#6#0#0#0#31#243#255'a'
+  +#0#0#0#6'bKGD'#0#239#0#240#0#241','#185'Z+'#0#0#0#9'pHYs'#0#0#1#187#0#0#1#187
+  +#1':'#236#227#226#0#0#0'pIDAT8'#17#237'SI'#14#128'0'#8#28#186#164#135#242'"'
+  +#19#253#168#209'K'#245'}'#234#11#144#242#1'k'#188'x('#132#219#204'0'#16#160
+  +#227#188#240'%'#220#23'r'#229'v'#129#190#131#255#220#129#168#149#215#149'R'
+  +#170#28#4#155#195'9'#144'#'#212'|'#10#177'^'#138'Rh'#217'v!'#253'F'#9'!'#192
+  +'{'#15#162#6#1#177#198#134#29#198#201#28'P)E'#230'e'#5'37'#139#196#24#193'9'
+  +#227#6#4'6&'#159#227#23#139#223#0#0#0#0'IEND'#174'B`'#130
+]);
+LazarusResources.Add('BCEXP_PANEL_MIN_V','PNG',[
+  #137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#16#0#0#0#16#8#6#0#0#0#31#243#255'a'
+  +#0#0#0#6'bKGD'#0#239#0#240#0#241','#185'Z+'#0#0#0#9'pHYs'#0#0#1#187#0#0#1#187
+  +#1':'#236#227#226#0#0#0#139'IDAT8'#17#237#146'K'#10'B1'#12'Eo^'#127#131#186
+  +'#AA'#158'+U'#233#242#212'Y'#11#181'1'#161'+Hg'#130'7'#159'Qr'#184#164#165
+  +#231#235#13#139'RJ'#12#130'$'#161#214'J'#155'eYg[k'#232#189#131#153'q'#187'?'
+  +#152#172#14#132#193#206';x'#231'q<'#157'av'#160'.'#212'>'#17#225#144#243#26
+  +'@!*'#133',9'#152#235#179#255#1#248#213'#2$'#228'+'#171#252'|M['#231#193#248
+  +'H(d'#9'0'#198#128'V'#8'a'#233#136'TJ'#193'e'#191'"'#198#136'/'#207#235'-D'
+  +#235'F2'#205#0#0#0#0'IEND'#174'B`'#130
+]);
+LazarusResources.Add('BCEXP_PANEL_MAX_H','PNG',[
+  #137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#16#0#0#0#16#8#6#0#0#0#31#243#255'a'
+  +#0#0#0#6'bKGD'#0#239#0#240#0#241','#185'Z+'#0#0#0#9'pHYs'#0#0#1#187#0#0#1#187
+  +#1':'#236#227#226#0#0#0#147'IDAT8'#17#237'S;'#14#194'0'#12'}N'#156#143#212
+  +#156#8#9'.'#138'`'#1#148#227#1'["E2q'#203#210#169'-'#172'u'#166'8'#239'cE'
+  +#207#244'|'#189#5'?T'#8#1#181'Vb'#229#26'c@'#134#160'g'#169#4'_'#191#14#189
+  +#221#31'B:'#1'3'#195'Z'#11#162#21#2'2'#9'('#246'p<'#129'c'#140'('#165'Pkm'
+  +#201'|'#246#222'y'#146#134#1'f'#214#221'x'#209')'#254#18'P'#191']`'#255#3#233
+  +#177#30#151'Ic'#185'1'#132'#'#220'9'#7#214'='#200'9'#203#249'rEJi'#245'B)'
+  +#217'{'#143#15#149'W)'#213#173#7#246#210#0#0#0#0'IEND'#174'B`'#130
+]);
+LazarusResources.Add('BCEXP_PANEL_MAX_V','PNG',[
+  #137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#16#0#0#0#16#8#6#0#0#0#31#243#255'a'
+  +#0#0#0#6'bKGD'#0#239#0#240#0#241','#185'Z+'#0#0#0#9'pHYs'#0#0#1#187#0#0#1#187
+  +#1':'#236#227#226#0#0#0#149'IDAT8'#17#237#147#203#14#2'!'#12'Eo'#229#17#146
+  +#225#255'7F'#205'D'#13#127#168#176#144#218'2'#201'$'#238'h'#220#184#176#229
+  +#209#144'r.'#16'J'#143'ge'#16#164#201'`'#180'Z+'#249#214#26#156'w'#240#206'C'
+  +#226'iJJ'#137#175#183';'#31#140#162#31#233#151'u'#197#0#232#241#137#166#197
+  +'wH^'#150#13#176#175#24#3#21#253#234#10#170#247#7#252#204#27'0'#196#153#141
+  +#191'`K'#247':qg'#188#196#173#166#162#3#208'{'#135'v-'#16#11'$'#132'0'#0'TJ'
+  +#225#227#233#140#156#243'TM'#168#178'n'#142'1'#226#13'L'#243'/'#9#26'z'#250
+  +#220#0#0#0#0'IEND'#174'B`'#130
+]);

+ 2633 - 0
BCExpandPanels.pas

@@ -0,0 +1,2633 @@
+{
+********************************************************************************
+*                         BGRAExpandPanels   Version 1.0                       *
+*                                                                              *
+*                                                                              *
+*   (c)  Massimo Magnano, Alexander Roth                                       *
+*                                                                              *
+*                                                                              *
+********************************************************************************
+
+2014-01-31 MaxM: First port from original code
+}
+
+unit BCExpandPanels;
+
+
+{$mode objfpc}{$H+}
+
+// for debugging purposes
+//{$DEFINE DebugInfo}
+//{$DEFINE DEBUG_PAINT}
+
+interface
+
+uses
+  Controls, Classes, ExtCtrls, Graphics, Math, LResources, Dialogs, SysUtils,
+  Buttons, Themes, Types, Menus, BCPanel;
+
+type
+  TBCExpandPanelsBehaviour = (EPHotMouse, EPMultipanel, EPSinglePanel);
+  //  TBoundEvent=procedure(sender:TObject; ALeft, ATop, AWidth, AHeight: integer) of object;
+  TAnimationEvent = procedure(Sender: TObject; deltaLeft, deltaTop, deltaWidth, deltaHeight: integer) of object;
+  TNormalProcedure = procedure of object;
+
+
+  { TBCBoundButton }
+
+  TGlyphLayout =
+  (
+    glLeft,
+    glRight,
+    glNone
+  );
+
+  TGlyphKind =
+  (
+    gkArrows,
+    gkClose,
+    gkMinMax
+  );
+
+  TTextLayout =
+  (
+    tlLeft,
+    tlRight,
+    tlCenter,
+    tlNone
+  );
+
+  TBCBoundButtonStyle = (bbsButton, bbsTab, bbsLine, bbsLineDouble,
+                       bbsLineTop, bbsLineBottom, bbsLineDoubleTop, bbsLineDoubleBottom);
+
+  TBCBoundButton = class(TCustomSpeedButton)
+  private
+    rColorExpanded: TColor;
+    rColorHighlight: TColor;
+    rColorShadow: TColor;
+    rGlyphKind: TGlyphKind;
+    rGlyphLayout: TGlyphLayout;
+    rStyle: TBCBoundButtonStyle;
+    rTabWidth: Integer;
+    rTextLayout: TTextLayout;
+
+    procedure setColorExpanded(AValue: TColor);
+    procedure SetColorHighlight(AValue: TColor);
+    procedure SetColorShadow(AValue: TColor);
+    procedure SetGlyphKind(AValue: TGlyphKind);
+    procedure SetGlyphLayout(AValue: TGlyphLayout);
+    procedure SetStyle(AValue: TBCBoundButtonStyle);
+    procedure SetTabWidth(AValue: Integer);
+    procedure SetTextLayout(AValue: TTextLayout);
+
+  protected
+    rGlyph :TButtonGlyph;
+    rUserGlyphExpanded,
+    rUserGlyphCollapsed,
+    rGlyphExpanded,
+    rGlyphCollapsed :TBitmap;
+
+    procedure SetGlyphCollapsed(AValue: TBitmap);
+    procedure SetGlyphExpanded(AValue: TBitmap);
+    procedure LoadGlyph(GlyphDST :TBitmap; ResName :String);
+    procedure BuildGlyphs;
+    procedure Paint; override;
+    procedure Loaded; override;
+
+  (*  property AllowAllUp;
+    property Down;
+    property Glyph;
+    property GroupIndex;
+    property Height;            //Don't Decrease visibility :-O
+    property HelpContext;
+    property HelpKeyword;
+    property HelpType;
+    property Layout;
+    property Left;
+    property Margin;
+    property Name;
+    property NumGlyphs;
+    property Spacing;
+    property ShowCaption;
+    property Tag;
+    property Top;
+    property Width;
+    property Transparent;
+    *)
+  public
+    constructor Create(AOwner: TComponent); override;
+    destructor Destroy; override;
+
+  published
+    property Caption;
+    property Color nodefault;
+    property ColorExpanded: TColor read rColorExpanded write setColorExpanded;
+    property ColorHighlight: TColor read rColorHighlight write SetColorHighlight default clDefault;
+    property ColorShadow: TColor read rColorShadow write SetColorShadow default clDefault;
+    property Font;
+    property Flat;
+    property GlyphExpanded: TBitmap read rUserGlyphExpanded write SetGlyphExpanded;
+    property GlyphCollapsed: TBitmap read rUserGlyphCollapsed write SetGlyphCollapsed;
+
+    property GlyphLayout: TGlyphLayout read rGlyphLayout write SetGlyphLayout default glNone;
+    property GlyphKind: TGlyphKind read rGlyphKind write SetGlyphKind default gkArrows;
+
+    property ShowAccelChar;
+    property TextLayout: TTextLayout read rTextLayout write SetTextLayout default tlLeft;
+    property Style: TBCBoundButtonStyle read rStyle write SetStyle default bbsButton;
+
+    //Negative Values is the % of Total Width, Positive is a Fixed Width
+    property TabWidth: Integer read rTabWidth write SetTabWidth default -50;
+  end;
+
+  { TBCExpandPanel }
+
+  TBCExpandPanel = class(TBCPanel)
+  private
+    FEPManagesCollapsing: TNotifyEvent;
+    FButton:      TBCBoundButton;
+    FButtonSize:  integer;
+    FCollapseKind: TAnchorKind;
+    FCollapsed:   boolean;
+    FAnimated:    boolean;
+    FOnExpand:    TNotifyEvent;
+    FOnPreExpand: TNotifyEvent;
+    FOnAnimate:   TAnimationEvent;
+    FOnCollapse:  TNotifyEvent;
+    FOnPreCollapse: TNotifyEvent;
+    FOnButtonClick: TNotifyEvent;
+    FInternalOnAnimate: TAnimationEvent;
+    FButtonPosition: TAnchorKind;
+    FExpandedButtonColor: TColor;
+    FCollapsedButtonColor: TColor;
+    FExpandedSize: integer;
+    FAnimationSpeed: real;
+    FTextAlignment: TAlignment;
+    rBevelColorHighlight: TColor;
+    rBevelColorShadow: TColor;
+    rBevelRounded: Boolean;
+    StopCircleActions: boolean;
+    FAnimating:   boolean;
+    FVisibleTotal: boolean;
+
+    TargetAnimationSize:     integer;
+    EndProcedureOfAnimation: TNormalProcedure;
+
+    Timer: TTimer;
+
+    function GetEnabled: Boolean;
+    procedure SetBevelColorHighlight(AValue: TColor);
+    procedure SetBevelColorShadow(AValue: TColor);
+    procedure SetBevelRounded(AValue: Boolean);
+    procedure SetEnabled(AValue: Boolean);
+    procedure setExpandedSize(Value: integer);
+    procedure setButtonSize(Value: integer);
+
+    procedure setButtonPosition(Value: TAnchorKind);
+    procedure setCollapseKind(Value: TAnchorKind);
+    procedure setAnimationSpeed(Value: real);
+    procedure setCollapsed(Value: boolean);
+
+    procedure PositionButton;
+
+    procedure SetRelevantSize(comp: TControl; AKind: TAnchorKind; ASize: Integer);
+    function RelevantSize(comp: TControl; akind: TAnchorKind): integer;
+    function RelevantOrthogonalSize(comp: TControl; akind: TAnchorKind): integer;
+    function DeltaCoordinates(deltaMove, deltaSize: integer): TRect;  // the outpot (left,top right, bottom) has all the information: left and top encode the movement. rigth and bottom the size changes
+
+
+    procedure Animate(aTargetSize: integer);
+    procedure SetTextAlignment(AValue: TAlignment);
+
+    procedure TimerAnimateSize(Sender: TObject);
+    procedure EndTimerCollapse;
+    procedure EndTimerExpand;
+    procedure UpdateAll;
+
+    procedure ButtonClick(Sender: TObject);
+    procedure DoCollapse;
+    procedure DoExpand;
+    procedure AdjustClientRect(var ARect: TRect); override;
+
+    property InternalOnAnimate: TAnimationEvent read FInternalOnAnimate write FInternalOnAnimate;
+    property EPManagesCollapsing: TNotifyEvent read FEPManagesCollapsing write FEPManagesCollapsing;
+  protected
+    procedure Loaded; override;
+    procedure CreateWnd; override;
+    procedure Paint; override;
+  public
+    property Animating: boolean read FAnimating;
+
+    constructor Create(TheOwner: TComponent); override;
+    destructor Destroy; override;
+
+    procedure SetBounds(ALeft, ATop, AWidth, AHeight: integer); override;
+  published
+    property TextAlignment: TAlignment read FTextAlignment write SetTextAlignment;
+    property Enabled: Boolean read GetEnabled write SetEnabled;
+    property CollapseKind: TAnchorKind read FCollapseKind write setCollapseKind;   //To where should it collapse?
+    property ExpandedSize: integer read FExpandedSize write setExpandedSize;
+    property ButtonPosition: TAnchorKind read FButtonPosition write setButtonPosition;
+    property ButtonSize: integer read FButtonSize write setButtonSize;
+
+    property Button: TBCBoundButton read FButton;
+
+    property AnimationSpeed: real read FAnimationSpeed write setAnimationSpeed;
+    property Animated: boolean read FAnimated write FAnimated default True;
+    property Collapsed: boolean read FCollapsed write setCollapsed default False;
+
+    property BevelColorHighlight: TColor read rBevelColorHighlight write SetBevelColorHighlight default clBtnHighlight;
+    property BevelColorShadow: TColor read rBevelColorShadow write SetBevelColorShadow default clBtnShadow;
+    property BevelRounded: Boolean read rBevelRounded write SetBevelRounded default True;
+
+    property OnAnimate: TAnimationEvent read FOnAnimate write FOnAnimate;
+    property OnButtonClick: TNotifyEvent read FOnButtonClick write FOnButtonClick;
+    property OnPreExpand: TNotifyEvent read FOnPreExpand write FOnPreExpand;
+    property OnExpand: TNotifyEvent read FOnExpand write FOnExpand;
+    property OnCollapse: TNotifyEvent read FOnCollapse write FOnCollapse;
+    property OnPreCollapse: TNotifyEvent read FOnPreCollapse write FOnPreCollapse;
+  end;
+
+
+
+
+  {==============================================================================
+   Class:   TBCExpandPanels
+   Description:
+  ==============================================================================}
+
+  { TBCExpandPanels }
+
+  TBCExpandPanels = class(TComponent)
+  private
+    { Private-Deklarationen }
+    PanelArray: TList;
+
+    // Properties
+    FArrangeKind: TAnchorKind;
+    FButtonPosition, FCollapseKind: TAnchorKind;
+    FButtonGlyphKind: TGlyphKind;
+    FButtonGlyphLayout: TGlyphLayout;
+    FButtonStyle: TBCBoundButtonStyle;
+    FButtonTabWidth: Integer;
+    FButtonTextLayout: TTextLayout;
+    FOrthogonalAbove: integer;
+    FAbove:     integer;
+    FOrthogonalSize: integer;
+    FBehaviour: TBCExpandPanelsBehaviour;
+    FOnArrangePanels: TNotifyEvent;
+    FFixedSize: integer;
+    FUseFixedSize: boolean;
+    FAutoCollapseIfTooHigh: boolean;
+
+    FUseClientSize: boolean;
+
+    function RelevantAbove(comp: TControl): integer;
+    function RelevantOrthogonalAbove(comp: TControl): integer;
+    function RelevantSize(comp: TControl): integer;
+    function RelevantOrthogonalSize(comp: TControl): integer;
+    procedure setButtonGlyphKind(AValue: TGlyphKind);
+    procedure setButtonGlyphLayout(AValue: TGlyphLayout);
+    procedure setButtonStyle(AValue: TBCBoundButtonStyle);
+    procedure SetButtonTabWidth(AValue: Integer);
+    procedure setButtonTextLayout(AValue: TTextLayout);
+    procedure WriteRelevantAbove(comp: TBCExpandPanel; above: integer);
+    procedure WriteRelevantSize(comp: TBCExpandPanel; size: integer);
+    procedure WriteRelevantOrthogonalSize(comp: TBCExpandPanel; size: integer);
+    procedure WriteRelevantOrthogonalAbove(comp: TBCExpandPanel; size: integer);
+
+    procedure setArrangeKind(Value: TAnchorKind);
+    procedure setButtonPosition(Value: TAnchorKind);
+    procedure setCollapseKind(Value: TAnchorKind);
+    procedure setUseClientSize(Value: boolean);
+    procedure setUseFixedSize(Value: boolean);
+    procedure setAutoCollapseIfTooHigh(Value: boolean);
+    procedure setFixedSize(Value: integer);
+    procedure setOrthogonalAbove(Value: integer);
+    procedure setAbove(Value: integer);
+    procedure setOrthogonalSize(Value: integer);
+    procedure setBehaviour(Value: TBCExpandPanelsBehaviour);
+
+    procedure MakeCorrectButtonClickPointers;
+
+    procedure RollOutOnAnimate(Sender: TObject; deltaLeft, deltaTop, deltaWidth, deltaHeight: integer);
+
+    procedure RollOutClick(Sender: TObject);
+    procedure HotTrackSetActivePanel(Value: integer);
+    procedure DelLastPanel;
+
+    procedure RollOut1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: integer);
+  protected
+    { Protected-Deklarationen }
+  public
+    { Public-Deklarationen }
+
+    property OrthogonalAbove: integer read FOrthogonalAbove write setOrthogonalAbove;
+    property Above: integer read FAbove write setAbove;
+    property OrthogonalSize: integer read FOrthogonalSize write setOrthogonalSize;
+
+    function IdxOfPanel(aname: string): integer; overload;
+
+    procedure CollapseIfTooHigh;
+    //    procedure SetCorrectSize;
+    procedure AddPanel(rollout: TBCExpandPanel);
+    procedure InsertPanel(idx: integer; rollout: TBCExpandPanel);
+    function DeltePanel(aname: string): boolean; overload;
+    function DeltePanel(idx: integer): boolean; overload;
+    procedure DelteLastPanel;
+    procedure ArrangePanels;
+    function Count: integer;
+    function Panel(idx: integer): TBCExpandPanel;
+
+    property CollapseKind: TAnchorKind read FCollapseKind write setCollapseKind;
+    property ButtonPosition: TAnchorKind read FButtonPosition write setButtonPosition;
+    property ButtonGlyphLayout: TGlyphLayout read FButtonGlyphLayout write setButtonGlyphLayout;
+    property ButtonGlyphKind: TGlyphKind read FButtonGlyphKind write setButtonGlyphKind;
+    property ButtonStyle: TBCBoundButtonStyle read FButtonStyle write setButtonStyle;
+    property ButtonTabWidth: Integer read FButtonTabWidth write SetButtonTabWidth;
+    property ButtonTextLayout: TTextLayout read FButtonTextLayout write setButtonTextLayout;
+
+    constructor Create(AOwner: TComponent); override;
+    destructor Destroy; override;
+  published
+    { Published-Deklarationen }
+
+    //    property FixedHeight:integer read FFixedHeight write setFixedSize;
+    //    property UseFixedHeight:boolean read FUseFixedHeight write setUseFixedSize;
+    //    property UseClientHeight:boolean read FUseClientHeight write setUseClientSize;
+    //    property AutoCollapseIfTooHigh:boolean read FAutoCollapseIfTooHigh write setAutoCollapseIfTooHigh;
+    property ArrangeKind: TAnchorKind read FArrangeKind write setArrangeKind;
+    property OnArrangePanels: TNotifyEvent read FOnArrangePanels write FOnArrangePanels;
+    property Behaviour: TBCExpandPanelsBehaviour read FBehaviour write setBehaviour;
+  end;
+
+procedure Register;
+
+implementation
+
+uses GraphType, LCLProc;
+
+const
+  //GrayScale a Color : Taken from BGRABitmap package
+  redWeightShl10   = 306; // = 0.299
+  greenWeightShl10 = 601; // = 0.587
+  blueWeightShl10  = 117; // = 0.114
+
+
+procedure korrigiere(var w: real; min, max: real);
+var
+  temp: real;
+begin
+  if max < min then
+    begin
+    temp := min;
+    min  := max;
+    max  := temp;
+    end;
+
+  if w < min then
+    w := min;
+  if w > max then
+    w := max;
+end;
+
+
+//Function copied from BGRABitmap package may work ;-)
+function Grayscale(AColor :TColor):TColor;
+Var
+  rColor, gray :Integer;
+
+begin
+  rColor :=ColorToRGB(AColor);
+  gray  := (Red(rColor) * redWeightShl10 + Green(rColor) * greenWeightShl10 + Blue(rColor) * blueWeightShl10 + 512) shr 10;
+  Result :=RGBToColor(gray, gray, gray);
+end;
+
+function GetHighlightColor(BaseColor: TColor; Value:Integer): TColor;
+Var
+  rColor :Integer;
+
+begin
+  rColor :=ColorToRGB(BaseColor);
+  Result := RGBToColor(
+       Min(Red(rColor) + Value, $FF),
+       Min(Green(rColor) + Value, $FF),
+       Min(Blue(rColor) + Value, $FF));
+end;
+
+function GetShadowColor(BaseColor: TColor; Value:Integer): TColor;
+Var
+  rColor :Integer;
+
+begin
+  rColor :=ColorToRGB(BaseColor);
+  Result := RGBToColor(
+       Max(Red(rColor) - Value, $22),
+       Max(Green(rColor) - Value, $22),
+       Max(Blue(rColor) - Value, $22));
+end;
+
+//Canvas Draw Functions
+procedure Frame3d_Rounded(Canvas: TCanvas;
+                          var ARect: TRect; const FrameWidth : integer; RX, RY:Integer;
+                          const Style : TGraphicsBevelCut;
+                          ShadowColor, HighlightColor, InternalColor: TColor);
+var
+   DRect: TRect;
+
+   procedure drawUP;
+   begin
+     inc(DRect.Left,1); inc(DRect.Top,1);
+
+     //is outside the Rect but in this way we don't have a hole of 1 px
+     inc(DRect.Right,1); inc(DRect.Bottom,1);
+
+     Canvas.Brush.Color :=ShadowColor;
+     Canvas.Brush.Style :=bsSolid;
+     Canvas.Pen.Color := clNone;
+     Canvas.Pen.Width := 1;         //The Shadow is always 1 Pixel
+     Canvas.Pen.Style := psClear;
+     Canvas.RoundRect(DRect, RX,RY);
+
+     dec(DRect.Left,1); dec(DRect.Top,1);
+     dec(DRect.Right,2); dec(DRect.Bottom,2);
+     Canvas.Brush.Color :=InternalColor;
+
+     if (InternalColor = clNone)
+     then Canvas.Brush.Style :=bsClear
+     else Canvas.Brush.Style :=bsSolid;
+
+     Canvas.Pen.Color :=HighlightColor;
+     Canvas.Pen.Width := FrameWidth;
+     Canvas.Pen.Style := psSolid;
+     Canvas.RoundRect(DRect, RX,RY);
+
+     Inc(ARect.Top, FrameWidth);
+     Inc(ARect.Left, FrameWidth);
+     Dec(ARect.Right, FrameWidth+1); //+The Shadow (1 Pixel) +1?
+     Dec(ARect.Bottom, FrameWidth+1);
+   end;
+
+   procedure drawFLAT;
+   begin
+     Canvas.Brush.Color := InternalColor;
+
+     if (InternalColor = clNone)
+     then Canvas.Brush.Style :=bsClear
+     else Canvas.Brush.Style :=bsSolid;
+
+     Canvas.Pen.Color := clNone;
+     Canvas.Pen.Width := FrameWidth;
+     Canvas.Pen.Style := psClear;
+     Canvas.RoundRect(DRect, RX,RY);
+   end;
+
+   procedure drawDOWN;
+   begin
+     Canvas.Brush.Color :=ShadowColor;
+     Canvas.Brush.Style :=bsSolid;
+     Canvas.Pen.Color := clNone;
+     Canvas.Pen.Width := 1;
+     Canvas.Pen.Style := psClear;
+     Canvas.RoundRect(DRect, RX,RY);
+
+     inc(DRect.Left,1); inc(DRect.Top,1);
+     Canvas.Brush.Color :=InternalColor;
+
+     if (InternalColor = clNone)
+     then Canvas.Brush.Style :=bsClear
+     else Canvas.Brush.Style :=bsSolid;
+
+     Canvas.Pen.Color :=HighlightColor;
+     Canvas.Pen.Width := FrameWidth;
+     Canvas.Pen.Style := psSolid;
+     Canvas.RoundRect(DRect, RX,RY);
+
+     Inc(ARect.Top, FrameWidth+1); //+The Shadow (1 Pixel)
+     Inc(ARect.Left, FrameWidth+1);
+     Dec(ARect.Right, FrameWidth);
+     Dec(ARect.Bottom, FrameWidth);
+   end;
+
+begin
+     DRect :=ARect;
+     Case Style of
+     bvNone: drawFLAT;
+     bvSpace: begin
+                drawFLAT;
+                InflateRect(ARect, -FrameWidth, -FrameWidth);
+              end;
+     bvRaised: drawUP;
+     bvLowered: drawDOWN;
+     end;
+end;
+
+procedure TBCBoundButton.SetColorHighlight(AValue: TColor);
+begin
+  if (rColorHighlight <> AValue) then
+  begin
+       rColorHighlight := AValue;
+
+       if not(csLoading in ComponentState)
+       then Invalidate;
+  end;
+end;
+
+procedure TBCBoundButton.setColorExpanded(AValue: TColor);
+begin
+  if (rColorExpanded <> AValue) then
+  begin
+       rColorExpanded := AValue;
+
+       if not(csLoading in ComponentState)
+       then Invalidate;
+  end;
+end;
+
+procedure TBCBoundButton.SetColorShadow(AValue: TColor);
+begin
+  if (rColorShadow <> AValue) then
+  begin
+       rColorShadow := AValue;
+
+       if not(csLoading in ComponentState)
+       then Invalidate;
+  end;
+end;
+
+procedure TBCBoundButton.SetGlyphKind(AValue: TGlyphKind);
+begin
+  if (rGlyphKind <> AValue) then
+  begin
+       rGlyphKind:=AValue;
+
+       if not(csLoading in ComponentState) then
+       begin
+            BuildGlyphs;
+            Invalidate;
+        end;
+  end;
+end;
+
+procedure TBCBoundButton.SetGlyphLayout(AValue: TGlyphLayout);
+begin
+  if (rGlyphLayout <> AValue) then
+  begin
+       rGlyphLayout := AValue;
+
+       if not(csLoading in ComponentState) then
+       begin
+            BuildGlyphs;
+            Invalidate;
+        end;
+  end;
+end;
+
+procedure TBCBoundButton.SetStyle(AValue: TBCBoundButtonStyle);
+begin
+  if (rStyle <> AValue) then
+  begin
+       rStyle:=AValue;
+       if not(csLoading in ComponentState)
+       then Invalidate;
+  end;
+end;
+
+procedure TBCBoundButton.SetTabWidth(AValue: Integer);
+begin
+  if (rTabWidth <> AValue) then
+  begin
+       rTabWidth:=AValue;
+       if not(csLoading in ComponentState) and (rStyle = bbsTab)
+       then Invalidate;
+  end;
+end;
+
+procedure TBCBoundButton.SetTextLayout(AValue: TTextLayout);
+begin
+  if (rTextLayout <> AValue) then
+  begin
+       rTextLayout := AValue;
+       if not(csLoading in ComponentState)
+       then Invalidate;
+  end;
+end;
+
+procedure TBCBoundButton.SetGlyphCollapsed(AValue: TBitmap);
+begin
+     rUserGlyphCollapsed.Assign(AValue);
+     if not(csLoading in ComponentState) then
+     begin
+          BuildGlyphs;
+          Invalidate;
+      end;
+end;
+
+procedure TBCBoundButton.SetGlyphExpanded(AValue: TBitmap);
+begin
+     rUserGlyphExpanded.Assign(AValue);
+     if not(csLoading in ComponentState) then
+     begin
+          BuildGlyphs;
+          Invalidate;
+      end;
+end;
+
+procedure TBCBoundButton.LoadGlyph(GlyphDST: TBitmap; ResName: String);
+Var
+   rGlyphO: TPortableNetworkGraphic;
+
+begin
+  rGlyphO :=TPortableNetworkGraphic.Create;
+  rGlyphO.LoadFromLazarusResource(ResName);
+  GlyphDST.Assign(rGlyphO);
+  FreeAndNil(rGlyphO);
+end;
+
+procedure TBCBoundButton.BuildGlyphs;
+begin
+  if (rGlyphLayout <> glNone) then
+  begin
+       if (rUserGlyphCollapsed.Empty)
+       then Case rGlyphKind of
+            gkArrows: case TBCExpandPanel(Owner).CollapseKind of
+                      akTop: LoadGlyph(rGlyphCollapsed, 'BCEXP_PANEL_BOTTOM');
+                      akLeft: LoadGlyph(rGlyphCollapsed, 'BCEXP_PANEL_RIGHT');
+                      akRight: LoadGlyph(rGlyphCollapsed, 'BCEXP_PANEL_LEFT');
+                      akBottom: LoadGlyph(rGlyphCollapsed, 'BCEXP_PANEL_TOP');
+                      end;
+            gkClose: LoadGlyph(rGlyphCollapsed, 'BCEXP_PANEL_CLOSE');
+            gkMinMax: if (TBCExpandPanel(Owner).CollapseKind in [akTop, akBottom])
+                      then LoadGlyph(rGlyphCollapsed, 'BCEXP_PANEL_MAX_H')
+                      else LoadGlyph(rGlyphCollapsed, 'BCEXP_PANEL_MAX_V');
+            end
+       else rGlyphCollapsed.Assign(rUserGlyphCollapsed);
+
+       if (rUserGlyphExpanded.Empty)
+       then Case rGlyphKind of
+            gkArrows: case TBCExpandPanel(Owner).CollapseKind of
+                      akTop: LoadGlyph(rGlyphExpanded, 'BCEXP_PANEL_TOP');
+                      akLeft: LoadGlyph(rGlyphExpanded, 'BCEXP_PANEL_LEFT');
+                      akRight: LoadGlyph(rGlyphExpanded, 'BCEXP_PANEL_RIGHT');
+                      akBottom: LoadGlyph(rGlyphExpanded, 'BCEXP_PANEL_BOTTOM');
+                      end;
+            gkClose: LoadGlyph(rGlyphExpanded, 'BCEXP_PANEL_CLOSE');
+            gkMinMax: if (TBCExpandPanel(Owner).CollapseKind in [akTop, akBottom])
+                      then LoadGlyph(rGlyphExpanded, 'BCEXP_PANEL_MIN_H')
+                      else LoadGlyph(rGlyphExpanded, 'BCEXP_PANEL_MIN_V');
+            end
+       else rGlyphExpanded.Assign(rUserGlyphExpanded);
+  end;
+end;
+
+procedure TBCBoundButton.Paint;
+var
+  paintRect, fRect :TRect;
+  xColor,
+  xHColor,
+  xSColor  :TColor;
+  middleX,
+  middleY,
+  txtWidth,
+  txtLeft,
+  txtTop,
+  glyphLeft,
+  glyphTop :Integer;
+  xCaption :String;
+  FButtonPosition :TAnchorKind;
+  FCollapsed, Rounded :Boolean;
+
+
+  procedure drawGlyph(var ATop, ALeft :Integer);
+  var
+    AWidth, AHeight :Integer;
+
+  begin
+    AWidth :=paintRect.Right-paintRect.Left-2;
+    AHeight :=paintRect.Bottom-paintRect.Top-2;
+
+    if FCollapsed
+    then rGlyph.Glyph.Assign(rGlyphCollapsed)
+    else rGlyph.Glyph.Assign(rGlyphExpanded);
+
+    //We must Calculate the Real Position of the Glyph
+    Case FButtonPosition of
+    akTop,
+    akBottom : begin
+                    if (rGlyphLayout = glLeft)
+                    then begin
+                              ALeft :=2;
+                              ATop :=middleY-(rGlyph.Glyph.Height div 2);
+                          end
+                    else begin
+                              ALeft :=AWidth-rGlyph.Glyph.Width;
+                              ATop :=middleY-(rGlyph.Glyph.Height div 2);
+                          end;
+                end;
+    akLeft :begin
+                 if (rGlyphLayout = glLeft)
+                 then begin  //Really on Bottom of paintRect
+                           ALeft :=middleX-(rGlyph.Glyph.Width div 2);
+                           ATop :=AHeight-rGlyph.Glyph.Height;
+                       end
+                 else begin  //Really on Top of paintRect
+                           ALeft :=middleX-(rGlyph.Glyph.Width div 2);
+                           ATop :=2;
+                       end;
+             end;
+    akRight :begin
+                 if (rGlyphLayout = glLeft)
+                 then begin  //Really on Top of paintRect
+                           ALeft :=middleX-(rGlyph.Glyph.Width div 2);
+                           ATop :=2;
+                       end
+                 else begin  //Really on Bottom of paintRect
+                           ALeft :=middleX-(rGlyph.Glyph.Width div 2);
+                           ATop :=AHeight-rGlyph.Glyph.Height;
+                       end;
+             end;
+    end;
+
+    rGlyph.Draw(Canvas, paintRect, point(ALeft, ATop), FState, true, 0);
+  end;
+
+  procedure drawBtn(const ABorderStyle : TGraphicsBevelCut);
+  var
+     xTabWidth,
+     tY, tX: Integer;
+
+  begin
+    Case rStyle of
+    bbsButton: Frame3d_Rounded(Canvas, paintRect, 1, 5, 5, ABorderStyle, xSColor, xHColor, xColor);
+    bbsTab: begin
+              fRect :=paintRect;
+
+              Case FButtonPosition of
+              akTop : begin
+                        //If rTabWidth is Negative Calculate the Tab Width
+                        if (rTabWidth < 0)
+                        then xTabWidth :=(fRect.Right-fRect.Left)*-rTabWidth div 100
+                        else xTabWidth :=rTabWidth;
+
+                        inc(paintRect.Left, middleX-(xTabWidth div 2));
+                        paintRect.Right:=paintRect.Left+xTabWidth;
+                        Frame3d_Rounded(Canvas, paintRect, 1, 5, 5, ABorderStyle, xSColor, xHColor, xColor);
+
+                        tY :=fRect.Bottom-2;
+                        Canvas.Pen.Style:=psSolid;
+                        Canvas.Pen.Width:=1;
+                        Canvas.Pen.Color :=xHColor;
+                        if Rounded
+                        then Canvas.MoveTo(2, tY)
+                        else Canvas.MoveTo(0, tY);
+                        Canvas.LineTo(paintRect.Left-3, tY);
+                        Canvas.LineTo(paintRect.Left, tY-3);
+
+                        if Rounded
+                        then Canvas.MoveTo(fRect.Right-4, tY)
+                        else Canvas.MoveTo(fRect.Right, tY);
+                        Canvas.LineTo(paintRect.Right+2, tY);
+                        Canvas.LineTo(paintRect.Right-1, tY-3);
+
+                        Canvas.Pen.Color :=xColor;
+                        Canvas.MoveTo(paintRect.Left-2, tY);
+                        Canvas.LineTo(paintRect.Right+2, tY);
+                        dec(tY);
+                        Canvas.MoveTo(paintRect.Left-1, tY);
+                        Canvas.LineTo(paintRect.Right+1, tY);
+
+                        tY :=fRect.Bottom-1;
+                        if FCollapsed then Canvas.Pen.Color :=xSColor;
+                        if Rounded
+                        then begin
+                               Canvas.MoveTo(fRect.Left+2, tY);
+                               Canvas.LineTo(fRect.Right-3, tY);
+                              end
+                        else begin
+                               Canvas.MoveTo(fRect.Left, tY);
+                               Canvas.LineTo(fRect.Right, tY);
+                             end;
+                      end;
+              akBottom : begin
+                        if (rTabWidth < 0)
+                        then xTabWidth :=(fRect.Right-fRect.Left)*-rTabWidth div 100
+                        else xTabWidth :=rTabWidth;
+
+                        inc(paintRect.Left, middleX-(xTabWidth div 2));
+                        paintRect.Right:=paintRect.Left+xTabWidth;
+                        dec(paintRect.Top);
+                        Frame3d_Rounded(Canvas, paintRect, 1, 5, 5, ABorderStyle, xSColor, xHColor, xColor);
+
+                        Canvas.Pen.Style:=psSolid;
+                        Canvas.Pen.Width:=1;
+                        Canvas.Pen.Color :=xHColor;
+                        if Rounded
+                        then Canvas.MoveTo(2, 1)
+                        else Canvas.MoveTo(0, 1);
+                        Canvas.LineTo(paintRect.Left-3, 1);
+                        Canvas.LineTo(paintRect.Left, 4);
+
+                        if Rounded
+                        then Canvas.MoveTo(fRect.Right-4, 1)
+                        else Canvas.MoveTo(fRect.Right, 1);
+                        Canvas.LineTo(paintRect.Right+2, 1);
+                        Canvas.LineTo(paintRect.Right-1, 4);
+
+                        Canvas.Pen.Color :=xColor;
+                        Canvas.MoveTo(paintRect.Left-2, 1);
+                        Canvas.LineTo(paintRect.Right+2, 1);
+                        Canvas.MoveTo(paintRect.Left-1, 2);
+                        Canvas.LineTo(paintRect.Right+1, 2);
+
+                        if FCollapsed then Canvas.Pen.Color :=xSColor;
+                        if Rounded
+                        then begin
+                               Canvas.MoveTo(fRect.Left+2, 0);
+                               Canvas.LineTo(fRect.Right-3, 0);
+                              end
+                        else begin
+                               Canvas.MoveTo(fRect.Left, 0);
+                               Canvas.LineTo(fRect.Right, 0);
+                             end;
+                      end;
+              akLeft : begin
+                        if (rTabWidth < 0)
+                        then xTabWidth :=(fRect.Bottom-fRect.Top)*-rTabWidth div 100
+                        else xTabWidth :=rTabWidth;
+
+                        inc(paintRect.Top, middleY-(xTabWidth div 2));
+                        paintRect.Bottom:=paintRect.Top+xTabWidth;
+                        Frame3d_Rounded(Canvas, paintRect, 1, 5, 5, ABorderStyle, xSColor, xHColor, xColor);
+
+                        tX :=fRect.Right-2;
+                        Canvas.Pen.Style:=psSolid;
+                        Canvas.Pen.Width:=1;
+                        Canvas.Pen.Color :=xHColor;
+
+                        if Rounded
+                        then Canvas.MoveTo(tX, 2)
+                        else Canvas.MoveTo(tX, 0);
+                        Canvas.LineTo(tX, paintRect.Top-3);
+                        Canvas.LineTo(tX-3, paintRect.Top);
+
+                        if Rounded
+                        then Canvas.MoveTo(tX, fRect.Bottom-4)
+                        else Canvas.MoveTo(tX, fRect.Bottom);
+                        Canvas.LineTo(tX, paintRect.Bottom+2);
+                        Canvas.LineTo(tX-3, paintRect.Bottom-1);
+
+                        Canvas.Pen.Color :=xColor;
+                        Canvas.MoveTo(tX, paintRect.Top-2);
+                        Canvas.LineTo(tX, paintRect.Bottom+2);
+                        dec(tX);
+                        Canvas.MoveTo(tX, paintRect.Top-1);
+                        Canvas.LineTo(tX, paintRect.Bottom+1);
+
+                        tX :=fRect.Right-1;
+                        if FCollapsed then Canvas.Pen.Color :=xSColor;
+                        if Rounded
+                        then begin
+                               Canvas.MoveTo(tX, fRect.Top+2);
+                               Canvas.LineTo(tX, fRect.Bottom-3);
+                              end
+                        else begin
+                               Canvas.MoveTo(tX, fRect.Top);
+                               Canvas.LineTo(tX, fRect.Bottom);
+                             end;
+                      end;
+              akRight : begin
+                        if (rTabWidth < 0)
+                        then xTabWidth :=(fRect.Bottom-fRect.Top)*-rTabWidth div 100
+                        else xTabWidth :=rTabWidth;
+
+                        inc(paintRect.Top, middleY-(xTabWidth div 2));
+                        paintRect.Bottom:=paintRect.Top+xTabWidth;
+                        dec(paintRect.Left);
+                        Frame3d_Rounded(Canvas, paintRect, 1, 5, 5, ABorderStyle, xSColor, xHColor, xColor);
+
+                        Canvas.Pen.Style:=psSolid;
+                        Canvas.Pen.Width:=1;
+                        Canvas.Pen.Color :=xHColor;
+                        if Rounded
+                        then Canvas.MoveTo(1, 2)
+                        else Canvas.MoveTo(1, 0);
+                        Canvas.LineTo(1, paintRect.Top-3);
+                        Canvas.LineTo(4, paintRect.Top);
+
+                        if Rounded
+                        then Canvas.MoveTo(1, fRect.Bottom-4)
+                        else Canvas.MoveTo(1, fRect.Bottom);
+                        Canvas.LineTo(1, paintRect.Bottom+2);
+                        Canvas.LineTo(4, paintRect.Bottom-1);
+
+                        Canvas.Pen.Color :=xColor;
+                        Canvas.MoveTo(1, paintRect.Top-2);
+                        Canvas.LineTo(1, paintRect.Bottom+2);
+                        Canvas.MoveTo(2, paintRect.Top-1);
+                        Canvas.LineTo(2, paintRect.Bottom+1);
+
+                        if FCollapsed then Canvas.Pen.Color :=xSColor;
+                        if Rounded
+                        then begin
+                               Canvas.MoveTo(0, fRect.Top+2);
+                               Canvas.LineTo(0, fRect.Bottom-3);
+                              end
+                        else begin
+                               Canvas.MoveTo(0, fRect.Top);
+                               Canvas.LineTo(0, fRect.Bottom);
+                             end;
+                      end;
+              end;
+            end;
+    end;
+  end;
+
+
+  procedure drawText;
+  Var
+     DTop, DLeft,
+     AWidth, AHeight,
+     txtH   :Integer;
+
+    procedure CalcCuttedCaption(MaxWidth :Integer);
+    Var
+       txtMaxChars  :Integer;
+
+    begin
+         txtWidth :=0;
+         if (MaxWidth < Canvas.TextWidth('...'))
+         then xCaption :=''
+         else begin
+                   txtMaxChars :=Canvas.TextFitInfo(xCaption, MaxWidth);
+                   txtWidth :=Canvas.TextWidth(xCaption);
+                   while (txtWidth > MaxWidth) do
+                   begin
+                        dec(txtMaxChars, 3);    //-1 Chars fit better, -3 Chars for more speed
+                        xCaption :=Copy(xCaption, 0, txtMaxChars)+'...';
+                        txtWidth :=Canvas.TextWidth(xCaption);
+                   end;
+               end;
+         (* Original Code, Test Speed
+         if (txtW > AWidth)
+         then begin
+                   txtMaxChars :=Canvas.TextFitInfo(xCaption, AWidth);
+                   xCaption :=Copy(xCaption, 0, txtMaxChars-3)+'...';
+                   txtW :=Canvas.TextWidth(xCaption);
+                   if (txtW > AWidth)
+                   then xCaption :='';
+               end;
+         *)
+    end;
+
+  begin
+    txtH :=Canvas.TextHeight(xCaption);
+    AWidth :=paintRect.Right-paintRect.Left-2;
+    AHeight :=paintRect.Bottom-paintRect.Top-2;
+
+    Case FButtonPosition of
+    akTop,
+    akBottom : begin
+                 Canvas.Font.Orientation := 0;
+
+                 txtTop :=middleY-(txtH div 2);
+
+                 if (rGlyphLayout <> glNone) then
+                 begin
+                   if (rTextLayout = tlCenter)
+                   then dec(AWidth, rGlyph.Glyph.Width*2+4)
+                   else dec(AWidth, rGlyph.Glyph.Width+2)
+                 end;
+
+                 CalcCuttedCaption(AWidth);
+
+                 Case rTextLayout of
+                 tlLeft :begin
+                           txtLeft :=paintRect.Left+4;
+                           if (rGlyphLayout = glLeft)
+                           then inc(txtLeft, rGlyph.Glyph.Width+2);
+                         end;
+                 tlRight:begin
+                           txtLeft :=paintRect.Left+AWidth-txtWidth;
+                           if (rGlyphLayout = glLeft)
+                           then inc(txtLeft, rGlyph.Glyph.Width+2);
+                         end;
+                 tlCenter:begin
+                            txtLeft :=middleX-(txtWidth div 2);
+                          end;
+                 end;
+
+                 //Disabled Position
+                 DTop :=txtTop+1;
+                 DLeft :=txtLeft+1;
+               end;
+    akLeft : begin
+               //Vertically from Bottom to Top
+               Canvas.Font.Orientation := 900;
+
+               txtLeft:=middleX-(txtH div 2);
+
+               if (rGlyphLayout <> glNone) then
+               begin
+                 if (rTextLayout = tlCenter)
+                 then dec(AHeight, rGlyph.Glyph.Height*2+4)
+                 else dec(AHeight, rGlyph.Glyph.Height+2)
+               end;
+
+               //Vertically the Max Width is Height
+               CalcCuttedCaption(AHeight);
+
+               Case rTextLayout of
+               tlLeft :begin   //To Bottom of the ClientRect
+                         txtTop :=paintRect.Top+AHeight-2;
+
+                         if (rGlyphLayout = glRight)
+                         then inc(txtTop, rGlyph.Glyph.Height+2);
+                       end;
+               tlRight:begin  //To Top of the ClientRect
+                         txtTop :=paintRect.Top+txtWidth+2;
+                         if (rGlyphLayout = glRight)
+                         then inc(txtTop, rGlyph.Glyph.Height+2);
+                       end;
+               tlCenter:begin
+                          txtTop :=middleY+(txtWidth div 2);
+                        end;
+               end;
+
+               //Disabled Position
+               DTop :=txtTop-1;
+               DLeft :=txtLeft+1;
+              end;
+    akRight : begin
+                //Vertically from Top to Bottom
+                Canvas.Font.Orientation := -900;
+
+                txtLeft:=middleX+(txtH div 2)+1; //+1 because is better centered
+
+                if (rGlyphLayout <> glNone) then
+                begin
+                  if (rTextLayout = tlCenter)
+                  then dec(AHeight, rGlyph.Glyph.Height*2+4)
+                  else dec(AHeight, rGlyph.Glyph.Height+2)
+                end;
+
+                CalcCuttedCaption(AHeight);
+
+                Case rTextLayout of
+                tlLeft :begin  //To Top of the ClientRect
+                          txtTop :=paintRect.Top+4;
+
+                          if (rGlyphLayout = glLeft)
+                          then inc(txtTop, rGlyph.Glyph.Height+2);
+                        end;
+                tlRight:begin  //To Bottom of the ClientRect
+                          txtTop :=paintRect.Top+AHeight-txtWidth;
+                          if (rGlyphLayout = glLeft)
+                          then inc(txtTop, rGlyph.Glyph.Height+2);
+                        end;
+                tlCenter:begin
+                           txtTop :=middleY-(txtWidth div 2);
+                         end;
+                end;
+
+                //Disabled Position
+                DTop :=txtTop+1;
+                DLeft :=txtLeft-1;
+              end;
+    end;
+
+    //Re Test here because we may not have space to draw the text, so now can be empty
+    if (xCaption <> '') then
+    begin
+      if (FState = bsDisabled)
+      then begin
+             Canvas.Font.Color := clBtnHighlight;
+             Canvas.TextOut(DLeft, DTop, xCaption);
+             Canvas.Font.Color := clBtnShadow;
+           end
+      else Canvas.Font.Color := Font.Color;
+
+      Canvas.Brush.Style:=bsClear;
+      Canvas.TextOut(txtLeft, txtTop, xCaption);
+    end
+    else txtWidth:=0;
+  end;
+
+  procedure DrawLines;
+  var
+     d1, d2, d3, d4, dx :Integer;
+     isVertical :Boolean;
+
+     procedure calc_d(txtL, txtR, glyphL, glyphR :Integer);
+     begin
+       if (txtWidth > 0)
+       then Case rTextLayout of
+            tlLeft: begin
+                      d1 :=txtR;
+                      if (rGlyphLayout = glRight)
+                      then d2 :=glyphL;
+                    end;
+            tlCenter:begin
+                       d2 :=txtL;
+                       d3 :=txtR;
+                       if (rGlyphLayout = glLeft)
+                       then d1 :=glyphR
+                       else if (rGlyphLayout = glRight)
+                            then d4 :=glyphL;
+                     end;
+            tlRight:begin
+                      d2 :=txtL;
+                      if (rGlyphLayout = glLeft)
+                      then d1 :=glyphR;
+                    end;
+            end
+       else if (rGlyphLayout = glLeft)
+            then d1 :=glyphR
+            else if (rGlyphLayout = glRight)
+                 then d2 :=glyphL;
+     end;
+
+     procedure DrawALine(pCenterX, pCenterY :Integer);
+     begin
+       inc(d2); inc(d4); //LineTo don't paint the last Pixel
+
+       if isVertical
+       then begin
+              //Avoid go outside the Box
+              pCenterX :=EnsureRange(pCenterX, 0, paintRect.Right-2);
+
+              Canvas.Pen.Color := {$ifdef DEBUG_PAINT} clLime {$else} xHColor {$endif};
+              Canvas.MoveTo(pCenterX, d1);
+              Canvas.LineTo(pCenterX, d2);
+              if (d3 > -1) then
+              begin
+                Canvas.MoveTo(pCenterX, d3);
+                Canvas.LineTo(pCenterX, d4);
+              end;
+              Canvas.Pen.Color := {$ifdef DEBUG_PAINT} clGreen {$else} xSColor {$endif};
+              Canvas.MoveTo(pCenterX+1, d1+1);
+              Canvas.LineTo(pCenterX+1, d2);
+              if (d3 > -1) then
+              begin
+                Canvas.MoveTo(pCenterX+1, d3+1);
+                Canvas.LineTo(pCenterX+1, d4);
+              end;
+            end
+       else begin
+              pCenterY :=EnsureRange(pCenterY, 0, paintRect.Bottom-2);
+
+              Canvas.Pen.Color :={$ifdef DEBUG_PAINT} clLime {$else} xHColor {$endif};
+              Canvas.MoveTo(d1, pCenterY);
+              Canvas.LineTo(d2, pCenterY);
+              if (d3 > -1) then
+              begin
+                Canvas.MoveTo(d3, pCenterY);
+                Canvas.LineTo(d4, pCenterY);
+              end;
+              Canvas.Pen.Color :={$ifdef DEBUG_PAINT} clGreen {$else} xSColor {$endif};
+              Canvas.MoveTo(d1+1, pCenterY+1);
+              Canvas.LineTo(d2, pCenterY+1);
+              if (d3 > -1) then
+              begin
+                Canvas.MoveTo(d3+1, pCenterY+1);
+                Canvas.LineTo(d4, pCenterY+1);
+              end;
+            end;
+
+       dec(d2); dec(d4); //return to the real Pixels
+     end;
+
+  begin
+    d3 :=-1;
+    isVertical :=(FButtonPosition in [akLeft, akRight]);
+
+    //Assign to (d1-d2) Line All the space
+    if isVertical
+    then begin
+           d1 :=paintRect.Top;
+           d2 :=paintRect.Bottom-1;
+         end
+    else begin
+           d1 :=paintRect.Left;
+           d2 :=paintRect.Right-1;
+          end;
+
+    //Calculate the (d1-d2) (d3-d4) Lines between the Glyph and the Text elements
+    if (rStyle in [bbsLine, bbsLineDouble]) then
+    begin
+      d4 :=d2;
+      if isVertical
+      then begin
+             if (FButtonPosition = akRight)
+             then calc_d(txtTop-3, txtTop+txtWidth+2, glyphTop-3, glyphTop+rGlyph.Glyph.Height+2)
+             else begin
+                    //Only in this case (akLeft) the point coordinate is from bottom to top
+                    d1 :=paintRect.Bottom-1;
+                    d2 :=paintRect.Top;
+                    d4 :=d2;
+
+                    calc_d(txtTop+2, txtTop-txtWidth-3, glyphTop+rGlyph.Glyph.Height+2, glyphTop-3);
+
+                    //Exchange the values for Shadow coerence
+                    dx :=d1; d1 :=d2; d2 :=dx;
+                    if (d3 > -1) then begin dx :=d3; d3 :=d4; d4 :=dx; end;
+                  end;
+           end
+      else calc_d(txtLeft-3, txtLeft+txtWidth+2, glyphLeft-3, glyphLeft+rGlyph.Glyph.Width+2);
+    end;
+
+    //Draw the Lines
+    Canvas.Pen.Style:=psSolid;
+    Canvas.Pen.Width:=1;
+    Case rStyle of
+    bbsLine: DrawALine(middleX, middleY);
+    bbsLineDouble: begin
+                     DrawALine(middleX-2, middleY-2);
+                     DrawALine(middleX+2, middleY+2);
+                   end;
+    bbsLineTop: DrawALine(paintRect.Left, paintRect.Top);
+    bbsLineBottom: DrawALine(paintRect.Right-2, paintRect.Bottom-2);
+    bbsLineDoubleTop: begin
+                        DrawALine(paintRect.Left, paintRect.Top);
+                        DrawALine(paintRect.Left+3, paintRect.Top+3);
+                      end;
+    bbsLineDoubleBottom: begin
+                           DrawALine(paintRect.Right-5, paintRect.Bottom-5);
+                           DrawALine(paintRect.Right-2, paintRect.Bottom-2);
+                         end;
+    end;
+  end;
+
+begin
+  paintRect :=GetClientRect;
+
+  {$ifdef DEBUG_PAINT}
+    Canvas.Brush.Color:=clYellow;
+    Canvas.Brush.Style:=bsSolid;
+    Canvas.FillRect(paintRect);
+  {$endif}
+
+  middleY :=paintRect.Top+((paintRect.Bottom-paintRect.Top) div 2);
+  middleX :=paintRect.Left+((paintRect.Right-paintRect.Left) div 2);
+
+  FButtonPosition :=TBCExpandPanel(Owner).FButtonPosition;
+  FCollapsed :=TBCExpandPanel(Owner).FCollapsed;
+  Rounded :=not(FCollapsed) and TBCExpandPanel(Owner).rBevelRounded;
+
+  if FCollapsed
+  then xColor :=Self.Color
+  else xColor :=rColorExpanded;
+
+  xCaption :=Caption;
+
+  Case FState of
+  Buttons.bsHot:begin
+                     if (rColorHighlight = clDefault)
+                     then xHColor :=GetHighlightColor(xColor, 120)
+                     else xHColor :=rColorHighlight;
+
+                     if (rColorShadow = clDefault)
+                     then xSColor :=GetShadowColor(xColor, 40)
+                     else xSColor :=rColorShadow;
+
+                     xColor :=GetHighlightColor(xColor, 20);
+                     drawBtn(bvRaised);
+                end;
+  Buttons.bsDown:begin
+                      if (rColorHighlight = clDefault)
+                      then xHColor :=GetHighlightColor(xColor, 60)
+                      else xHColor :=rColorHighlight;
+
+                      if (rColorShadow = clDefault)
+                      then xSColor :=GetShadowColor(xColor, 60)
+                      else xSColor :=rColorShadow;
+
+                      xColor :=GetHighlightColor(xColor, 20);
+                      drawBtn(bvLowered);
+                  end;
+  else begin
+            if (FState = bsDisabled)
+            then xColor :=GrayScale(xColor);
+
+            if Flat
+            then xHColor :=xColor
+            else if (rColorHighlight = clDefault)
+                 then xHColor :=GetHighlightColor(xColor, 60)
+                 else xHColor :=rColorHighlight;
+
+            if (rColorShadow = clDefault)
+            then xSColor :=GetShadowColor(xColor, 60)
+            else xSColor :=rColorShadow;
+
+            if Flat
+            then drawBtn(bvSpace)
+            else drawBtn(bvRaised);
+        end;
+  end;
+
+  if (rGlyphLayout <> glNone)
+  then drawGlyph(glyphTop, glyphLeft)
+  else begin
+            glyphTop :=0;
+            glyphLeft:=0;
+        end;
+
+  if (rTextLayout <> tlNone) and (xCaption <> '')
+  then drawText
+  else txtWidth:=0;
+
+  if (rStyle in [bbsLine..bbsLineDoubleBottom])
+  then DrawLines;
+end;
+
+procedure TBCBoundButton.Loaded;
+begin
+  inherited Loaded;
+
+  if not(csDesigning in ComponentState) then
+  begin
+       //IF Used Outside TBCExpandPanel
+       if not(Owner is TBCExpandPanel)
+       then BuildGlyphs;
+  end;
+end;
+
+constructor TBCBoundButton.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+
+  Color :=clSkyBlue;
+  rColorExpanded := RGBToColor(23, 136, 248);
+  rColorHighlight :=clDefault;
+  rColorShadow :=clDefault;
+  rGlyphLayout :=glNone;
+  rGlyphKind :=gkArrows;
+  rTextLayout :=tlLeft;
+  Flat :=False;
+  rStyle :=bbsButton;
+  rTabWidth :=-50;
+
+  //Why FGlyph is Private in ancestor?????
+  rGlyph := TButtonGlyph.Create;
+  rGlyph.IsDesigning := csDesigning in ComponentState;
+  rGlyph.ShowMode := gsmAlways;
+
+  rGlyphExpanded :=TBitmap.Create;
+  rGlyphExpanded.Transparent := True;
+  rGlyphCollapsed :=TBitmap.Create;
+  rGlyphCollapsed.Transparent := True;
+  rUserGlyphExpanded :=TBitmap.Create;
+  rUserGlyphExpanded.Transparent := True;
+  rUserGlyphCollapsed :=TBitmap.Create;
+  rUserGlyphCollapsed.Transparent := True;
+
+  SetSubComponent((Owner is TBCExpandPanel));
+//  ControlStyle := ControlStyle + [csNoFocus, csNoDesignSelectable];
+end;
+
+destructor TBCBoundButton.Destroy;
+begin
+  FreeAndNil(rGlyphExpanded);
+  FreeAndNil(rGlyphCollapsed);
+  FreeAndNil(rUserGlyphExpanded);
+  FreeAndNil(rUserGlyphCollapsed);
+  FreeAndNil(rGlyph);
+  inherited Destroy;
+end;
+
+{TBCExpandPanels}
+
+constructor TBCExpandPanels.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+
+  PanelArray := TList.Create;
+
+  FCollapseKind := akTop;
+  FButtonPosition := akTop;
+  FButtonGlyphKind :=gkArrows;
+  FButtonGlyphLayout :=glNone;
+  FButtonStyle :=bbsButton;
+  FButtonTabWidth :=-50;
+  FButtonTextLayout :=tlLeft;
+  FArrangeKind := akTop;
+  FUseFixedSize := False;
+  FUseClientSize := False;
+  FFixedSize := 400;
+  FAutoCollapseIfTooHigh := False;
+  FAbove := 10;
+  FOrthogonalAbove := 10;
+  FOrthogonalSize := 200;
+end;
+
+destructor TBCExpandPanels.Destroy;
+var
+  i: integer;
+begin
+  for I := PanelArray.Count - 1 downto 0 do
+    PanelArray.Delete(i);
+
+  PanelArray.Free;
+  PanelArray := nil;
+
+  inherited Destroy;
+end;
+
+procedure TBCExpandPanels.AddPanel(rollout: TBCExpandPanel);
+begin
+  InsertPanel(PanelArray.Count, rollout);
+end;
+
+procedure TBCExpandPanels.InsertPanel(idx: integer; rollout: TBCExpandPanel);
+begin
+  if Count <= 0 then
+    begin
+    FAbove := RelevantAbove(rollout);
+    FOrthogonalAbove := RelevantOrthogonalAbove(rollout);
+    FOrthogonalSize := RelevantOrthogonalSize(rollout);
+    end
+  else
+    begin
+    WriteRelevantAbove(rollout, FAbove);
+    WriteRelevantOrthogonalAbove(rollout, FOrthogonalAbove);
+    WriteRelevantOrthogonalSize(rollout, FOrthogonalSize);
+    end;
+
+  with rollout do
+    begin
+    Tag := Idx;
+    FButton.Tag := Idx;
+
+    FButton.OnMouseMove := @RollOut1MouseMove;
+    InternalOnAnimate   := @RollOutOnAnimate;
+    end;
+
+
+  PanelArray.Insert(idx, rollout);
+
+  if FBehaviour <> EPMultipanel then
+    HotTrackSetActivePanel(0);  //damit das erste ausgeklappt ist
+
+  ArrangePanels;
+  MakeCorrectButtonClickPointers;
+end;
+
+
+
+
+function TBCExpandPanels.DeltePanel(aname: string): boolean;
+var
+  i: integer;
+begin
+  Result := False;
+  for i := 0 to PanelArray.Count - 1 do
+    if TBCExpandPanel(PanelArray[i]).Name = aname then
+      begin
+      PanelArray.Delete(i);
+      Result := True;
+      break;
+      end;
+  ArrangePanels;
+end;
+
+
+function TBCExpandPanels.DeltePanel(idx: integer): boolean;
+begin
+  Result := False;
+  if (idx >= 0) and (idx <= PanelArray.Count - 1) then
+    begin
+    PanelArray.Delete(idx);
+    Result := True;
+    end;
+  ArrangePanels;
+end;
+
+procedure TBCExpandPanels.DelteLastPanel;
+begin
+  if (PanelArray.Count >= 1) then
+    PanelArray.Delete(PanelArray.Count - 1);
+  ArrangePanels;
+end;
+
+
+
+
+procedure TBCExpandPanels.DelLastPanel;
+begin
+  PanelArray.Delete(PanelArray.Count - 1);
+end;
+
+
+function TBCExpandPanels.RelevantAbove(comp: TControl): integer;
+begin
+  case FArrangeKind of
+    akLeft: Result := comp.Left;
+    akTop: Result  := comp.Top;
+    end;
+end;
+
+function TBCExpandPanels.RelevantOrthogonalAbove(comp: TControl): integer;
+begin
+  case FArrangeKind of
+    akTop: Result  := comp.Left;
+    akLeft: Result := comp.Top;
+    end;
+end;
+
+function TBCExpandPanels.RelevantSize(comp: TControl): integer;
+begin
+  case FArrangeKind of
+    akLeft: Result := comp.Width;
+    akTop: Result  := comp.Height;
+    end;
+end;
+
+function TBCExpandPanels.RelevantOrthogonalSize(comp: TControl): integer;
+begin
+  case FArrangeKind of
+    akLeft: Result := comp.Height;
+    akTop: Result  := comp.Width;
+    end;
+end;
+
+procedure TBCExpandPanels.setButtonGlyphKind(AValue: TGlyphKind);
+var
+   i: Integer;
+
+begin
+  if (FButtonGlyphKind <> AValue) then
+  begin
+    FButtonGlyphKind:=AValue;
+
+    for i := 0 to PanelArray.Count - 1 do
+      Panel(i).Button.GlyphKind := AValue;
+  end;
+end;
+
+procedure TBCExpandPanels.setButtonGlyphLayout(AValue: TGlyphLayout);
+var
+   i: Integer;
+
+begin
+  if (FButtonGlyphLayout <> AValue) then
+  begin
+    FButtonGlyphLayout:=AValue;
+
+    for i := 0 to PanelArray.Count - 1 do
+      Panel(i).Button.GlyphLayout := AValue;
+  end;
+end;
+
+procedure TBCExpandPanels.setButtonStyle(AValue: TBCBoundButtonStyle);
+var
+   i: Integer;
+
+begin
+  if (FButtonStyle <> AValue) then
+  begin
+    FButtonStyle:=AValue;
+
+    for i := 0 to PanelArray.Count - 1 do
+      Panel(i).Button.Style := AValue;
+  end;
+end;
+
+procedure TBCExpandPanels.SetButtonTabWidth(AValue: Integer);
+var
+   i: Integer;
+
+begin
+  if (FButtonTabWidth <> AValue) then
+  begin
+    FButtonTabWidth:=AValue;
+
+    for i := 0 to PanelArray.Count - 1 do
+      Panel(i).Button.TabWidth := AValue;
+  end;
+end;
+
+procedure TBCExpandPanels.setButtonTextLayout(AValue: TTextLayout);
+var
+   i: Integer;
+
+begin
+  if (FButtonTextLayout <> AValue) then
+  begin
+    FButtonTextLayout:=AValue;
+
+    for i := 0 to PanelArray.Count - 1 do
+      Panel(i).Button.TextLayout := AValue;
+  end;
+end;
+
+procedure TBCExpandPanels.WriteRelevantAbove(comp: TBCExpandPanel; above: integer);
+begin
+  case FArrangeKind of
+    akLeft: comp.Left := above;
+    akTop: comp.Top   := above;
+    end;
+end;
+
+procedure TBCExpandPanels.WriteRelevantSize(comp: TBCExpandPanel; size: integer);
+begin
+  case FArrangeKind of
+    akLeft: comp.Width := size;
+    akTop: comp.Height := size;
+    end;
+end;
+
+procedure TBCExpandPanels.WriteRelevantOrthogonalSize(comp: TBCExpandPanel; size: integer);
+begin
+  case FArrangeKind of
+    akLeft: comp.Height := size;
+    akTop: comp.Width   := size;
+    end;
+end;
+
+procedure TBCExpandPanels.WriteRelevantOrthogonalAbove(comp: TBCExpandPanel; size: integer);
+begin
+  case FArrangeKind of
+    akLeft: comp.Top := size;
+    akTop: comp.Left := size;
+    end;
+end;
+
+
+procedure TBCExpandPanels.setArrangeKind(Value: TAnchorKind);
+begin
+  case Value of  //that is mean, but I haven't implemented the bottom and right yet....
+    akRight: Value  := akLeft;
+    akBottom: Value := akTop;
+    end;
+
+  if FArrangeKind = Value then
+    exit;
+  FArrangeKind := Value;
+
+  ArrangePanels;
+end;
+
+procedure TBCExpandPanels.setButtonPosition(Value: TAnchorKind);
+var
+  i: integer;
+begin
+  if FButtonPosition = Value then
+    exit;
+  FButtonPosition := Value;
+
+  for i := 0 to PanelArray.Count - 1 do
+    Panel(i).ButtonPosition := Value;
+end;
+
+procedure TBCExpandPanels.setCollapseKind(Value: TAnchorKind);
+var
+  i: integer;
+begin
+  if FCollapseKind = Value then
+    exit;
+  FCollapseKind := Value;
+
+  for i := 0 to PanelArray.Count - 1 do
+    Panel(i).CollapseKind := Value;
+end;
+
+procedure TBCExpandPanels.setUseClientSize(Value: boolean);
+begin
+  FUseClientSize := Value;
+
+  ArrangePanels;
+end;
+
+procedure TBCExpandPanels.setUseFixedSize(Value: boolean);
+begin
+  if FUseFixedSize = Value then
+    exit;
+  FUseFixedSize := Value;
+
+  ArrangePanels;
+end;
+
+procedure TBCExpandPanels.setAutoCollapseIfTooHigh(Value: boolean);
+begin
+  if FAutoCollapseIfTooHigh = Value then
+    exit;
+  FAutoCollapseIfTooHigh := Value;
+
+  if FAutoCollapseIfTooHigh then
+    CollapseIfTooHigh;
+end;
+
+
+procedure TBCExpandPanels.setFixedSize(Value: integer);
+var
+  r: real;
+begin
+  if FFixedSize = Value then
+    exit;
+
+  r := Value;
+  korrigiere(r, 20, 10000);
+  FFixedSize := round(r);
+
+  ArrangePanels;
+end;
+
+
+
+procedure TBCExpandPanels.setOrthogonalAbove(Value: integer);
+begin
+  if FOrthogonalAbove = Value then
+    exit;
+  FOrthogonalAbove := Value;
+
+  ArrangePanels;
+end;
+
+
+procedure TBCExpandPanels.setAbove(Value: integer);
+begin
+  if FAbove = Value then
+    exit;
+  FAbove := Value;
+
+  ArrangePanels;
+end;
+
+
+procedure TBCExpandPanels.setOrthogonalSize(Value: integer);
+var
+  i: integer;
+begin
+  FOrthogonalSize := Value;
+
+  for I := 0 to PanelArray.Count - 1 do
+    WriteRelevantOrthogonalSize(TBCExpandPanel(PanelArray[i]), FOrthogonalSize);
+end;
+
+
+
+
+procedure TBCExpandPanels.setBehaviour(Value: TBCExpandPanelsBehaviour);
+var
+  i: integer;
+  isAlreadyOneExpand: boolean;
+begin
+  isAlreadyOneExpand := False;
+  FBehaviour := Value;
+
+  MakeCorrectButtonClickPointers;
+
+  // look if more then one is open
+  for I := 0 to PanelArray.Count - 1 do
+    with TBCExpandPanel(PanelArray[i]) do
+      if (Behaviour <> EPMultipanel) and not Collapsed then   //leave only the first open, if it is not MultiPanel
+        if not isAlreadyOneExpand then
+          isAlreadyOneExpand := True
+        else
+          Collapsed := True;
+end;
+
+procedure TBCExpandPanels.MakeCorrectButtonClickPointers;
+var
+  i: integer;
+begin
+  // set correct pointers
+  for I := 0 to PanelArray.Count - 1 do
+    with TBCExpandPanel(PanelArray[i]) do
+      if FBehaviour <> EPMultipanel then
+        EPManagesCollapsing := @RollOutClick
+      else
+        EPManagesCollapsing := nil;
+end;
+
+
+
+procedure TBCExpandPanels.CollapseIfTooHigh;
+var
+  i, h, max:    integer;
+  tempanimated: boolean;
+begin
+  if Count <= 1 then
+    exit;
+
+
+  h   := RelevantAbove(Panel(0));
+  max := RelevantSize(Panel(0).Parent);
+
+  for i := 0 to Count - 1 do
+    if h + RelevantSize(Panel(i)) > max then
+      with Panel(i) do
+        begin
+        tempanimated := Animated;
+        Animated     := False;
+        Collapsed    := True;
+        Animated     := tempanimated;
+
+        h := h + TBCExpandPanel(Panel(i)).ButtonSize;
+        end
+    else
+      h := h + RelevantSize(Panel(i));
+end;
+
+
+
+procedure TBCExpandPanels.RollOutOnAnimate(Sender: TObject; deltaLeft, deltaTop, deltaWidth, deltaHeight: integer);
+var
+  idx, i, size: integer;
+begin
+  idx := PanelArray.IndexOf(Sender);
+
+  for i := idx + 1 to PanelArray.Count - 1 do
+    begin
+    size := RelevantAbove(TBCExpandPanel(PanelArray[i]));
+    case FArrangeKind of
+      akTop: size  := size + deltaTop + deltaHeight;
+      akLeft: size := size + deltaLeft + deltaWidth;
+      end;
+
+    WriteRelevantAbove(TBCExpandPanel(PanelArray[i]), size);
+
+    end;
+end;
+
+
+
+
+ //procedure TBCExpandPanels.SetCorrectSize;
+ //const plus=1;   //extra Anstand
+ //var
+ //    i, exSize,
+ //    countexpanded,
+ //    SumSize, closedSize:Integer;
+ //begin
+ //  if PanelArray.Count<=0 then
+ //    exit;
+
+ //  SumSize:=FFixedSize;
+ //  if FUseClientSize then
+ //    SumSize:=TBCExpandPanel(PanelArray[0]).Parent.Height;
+
+
+ //  countexpanded:=0;
+ //  closedSize:=0;
+ //  for I := 0 to PanelArray.count-1 do
+ //    with TBCExpandPanel(PanelArray[i]) do
+ //      begin
+//      if not Collapsed and not Animating         //error producer!!!   animating does not neccessairily mean that it is expanding
+ //       or Collapsed and Animating then
+ //        inc(countexpanded)
+ //      else
+ //        closedSize:=closedSize+Height;
+ //      end;
+
+//  exSize:=SumSize- FTop- closedSize;
+
+ //  case Behaviour of
+ //    EPMultipanel:
+ //      if countexpanded>0 then
+ //        exSize:=trunc(exSize/countexpanded)
+ //      else
+ //        exSize:=400;
+ //  end;
+
+ //  for I := 0 to PanelArray.count-1 do
+ //    with TBCExpandPanel(PanelArray[i]) do
+ //      begin
+ //      if not FUseFixedSize and not FUseClientSize then
+ //        ExpandedSize:=200
+ //      else
+ //        ExpandedSize:=exSize;
+ //      end;
+ //end;
+
+
+
+{==============================================================================
+  Procedure:    ArrangePanels
+  Belongs to:   TBCExpandPanels
+  Result:       None
+  Parameters:
+
+  Description:
+==============================================================================}
+procedure TBCExpandPanels.ArrangePanels;
+const
+  plus = 1;   //extra Anstand
+var
+  i, t: integer;
+begin
+  if Count <= 0 then
+    exit;
+
+
+  //left setzen!!!
+  //  SetCorrectSize;
+
+  t := FAbove + plus;
+
+  for I := 0 to PanelArray.Count - 1 do
+    begin
+    if not TBCExpandPanel(PanelArray[i]).Visible then
+      continue;
+
+    WriteRelevantAbove(TBCExpandPanel(PanelArray[i]), t);
+    WriteRelevantOrthogonalAbove(TBCExpandPanel(PanelArray[i]), OrthogonalAbove);
+    t := t + plus + self.RelevantSize(TBCExpandPanel(PanelArray[i]));
+    end;
+
+  if FAutoCollapseIfTooHigh then
+    CollapseIfTooHigh;
+
+  if Assigned(FOnArrangePanels) then
+    FOnArrangePanels(Self);
+end;
+
+
+
+function TBCExpandPanels.Count: integer;
+begin
+  Result := PanelArray.Count;
+end;
+
+function TBCExpandPanels.Panel(idx: integer): TBCExpandPanel;
+begin
+  if idx < Count then
+    Result := TBCExpandPanel(PanelArray.Items[idx])
+  else
+    Result := nil;
+end;
+
+
+
+
+{==============================================================================
+  Procedure:    RollOutClick
+  Belongs to:   TBCExpandPanels
+  Result:       None
+  Parameters:
+                  Sender : TObject  =
+
+  Description:
+==============================================================================}
+procedure TBCExpandPanels.RollOutClick(Sender: TObject);
+begin
+  if (Behaviour <> EPMultipanel) then
+    HotTrackSetActivePanel(TBCBoundButton(Sender).Tag);
+end;
+
+
+
+
+procedure TBCExpandPanels.HotTrackSetActivePanel(Value: integer);
+var
+  i: integer;
+begin
+  for I := PanelArray.Count - 1 downto 0 do
+    TBCExpandPanel(PanelArray[i]).Collapsed := Value <> i;
+end;
+
+
+
+
+procedure TBCExpandPanels.RollOut1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: integer);
+begin
+  if (Behaviour = EPHotMouse) and (TBCExpandPanel(PanelArray[TBCBoundButton(Sender).Tag]).Collapsed) then
+    HotTrackSetActivePanel(TBCBoundButton(Sender).Tag);
+end;
+
+
+function TBCExpandPanels.IdxOfPanel(aname: string): integer;
+var
+  i: integer;
+begin
+  Result := -1;      // is not here
+  for i := 0 to PanelArray.Count - 1 do
+    if TBCExpandPanel(PanelArray[i]).Name = aname then
+      begin
+      Result := i;
+      break;
+      end;
+end;
+
+
+
+
+{ TBCExpandPanel }
+
+
+procedure TBCExpandPanel.setCollapsed(Value: boolean);
+begin
+{$IFDEF DebugInfo}
+  debugln('TBCExpandPanel.setCollapsed '+BoolToStr(Collapsed, True));
+{$ENDIF}
+
+  if FCollapsed = Value then
+    exit;
+
+  FCollapsed := Value;
+
+  if not(csLoading in ComponentState)
+  then if Value
+       then DoCollapse
+       else DoExpand;
+end;
+
+procedure TBCExpandPanel.SetRelevantSize(comp: TControl; AKind: TAnchorKind; ASize: Integer);
+begin
+  case AKind of
+    akTop, akBottom: comp.Height :=ASize;
+    akLeft, akRight: comp.Width :=ASize;
+  end;
+end;
+
+function TBCExpandPanel.RelevantSize(comp: TControl; akind: TAnchorKind): integer;
+begin
+  case akind of
+    akTop, akBottom: Result := comp.Height;
+    akLeft, akRight: Result := comp.Width;
+    end;
+end;
+
+function TBCExpandPanel.RelevantOrthogonalSize(comp: TControl; akind: TAnchorKind): integer;
+begin
+  case akind of
+    akTop, akBottom: Result := comp.Width;
+    akLeft, akRight: Result := comp.Height;
+    end;
+end;
+
+function TBCExpandPanel.DeltaCoordinates(deltaMove, deltaSize: integer): TRect;
+begin
+  Result := Rect(0, 0, 0, 0);
+
+  case FCollapseKind of
+    akTop: Result    := Rect(0, 0, 0, deltaSize);
+    akLeft: Result   := Rect(0, 0, deltaSize, 0);
+    akBottom: Result := Rect(0, deltaMove, 0, deltaSize);
+    akRight: Result  := Rect(deltaMove, 0, deltaSize, 0);
+    end;
+end;
+
+
+
+procedure TBCExpandPanel.TimerAnimateSize(Sender: TObject);
+var
+  step:  real;
+  originalsize, size: integer;
+  deltaMove, deltaSize: integer;
+  delta: TRect;
+  vorzeichen: integer;
+begin
+  deltaMove := 0;
+  deltaSize := 0;
+  StopCircleActions := False;
+  FAnimating := True;
+  step := FAnimationSpeed;
+
+
+  Size := RelevantSize(Self, FCollapseKind);
+
+  vorzeichen   := Sign(TargetAnimationSize - RelevantSize(self, FCollapseKind));  // muss ich delta addieren oder muss ich delta abziehen
+  originalsize := ExpandedSize;
+
+
+  //One huge step if not animated
+  if not FAnimated or not (ComponentState * [csLoading, csDesigning] = []) then
+    step := abs(Size - TargetAnimationSize);
+
+  //small steps if animated
+  if FAnimated and (ComponentState * [csLoading, csDesigning] = []) then
+    begin
+    step := step * originalsize / 200;
+    if step < 3 then
+      step := 3;
+    end;
+
+
+  //now actually do something
+
+  if Abs(Size - TargetAnimationSize) > 0 then
+    begin
+    if Abs(Size - TargetAnimationSize) < abs(step) then  // if there is just a little bit left to go, set delta so it can go directly to the end size
+      deltaSize := TargetAnimationSize - Size
+    else
+      deltaSize := vorzeichen * round(step);
+
+    if (CollapseKind = akBottom) or (CollapseKind = akRight) then
+      deltaMove := -deltaSize;
+
+
+    delta := DeltaCoordinates(deltaMove, deltaSize);
+
+    SetBounds(Left + delta.Left, Top + delta.Top, Width + delta.Right, Height + delta.Bottom);
+
+    if assigned(FInternalOnAnimate) then
+      FInternalOnAnimate(self, delta.Left, delta.Top, delta.Right, delta.Bottom);
+    if assigned(FOnAnimate) then
+      FOnAnimate(self, delta.Left, delta.Top, delta.Right, delta.Bottom);
+    end;
+
+
+  if Abs(Size - TargetAnimationSize) = 0 then        //it's finished  ( executes it NEXT time the timer activates!)
+    begin
+    Timer.Enabled := False;
+
+    FAnimating := False;
+
+    StopCircleActions := False;
+
+    if assigned(EndProcedureOfAnimation) then
+      EndProcedureOfAnimation;
+    end;
+end;
+
+
+
+procedure TBCExpandPanel.EndTimerCollapse;
+begin
+  if assigned(OnCollapse) then
+    OnCollapse(self);
+
+  UpdateAll;
+end;
+
+procedure TBCExpandPanel.EndTimerExpand;
+begin
+  if assigned(OnExpand) then
+    OnExpand(self);
+
+  UpdateAll;
+end;
+
+
+
+procedure TBCExpandPanel.UpdateAll;
+begin
+  Update;
+  //FButton.Update;
+end;
+
+
+
+
+procedure TBCExpandPanel.setExpandedSize(Value: integer);
+begin
+  {$IFDEF DebugInfo}
+  debugln('TBCExpandPanel.setExpandedSize');
+  debugln(IntToStr(Value));
+  {$ENDIF}
+
+  if (FExpandedSize = Value) then
+    exit;
+
+  FExpandedSize := Value;
+
+  if not(csLoading in ComponentState) and not(FCollapsed)
+  then Animate(FExpandedSize);
+end;
+
+function TBCExpandPanel.GetEnabled: Boolean;
+begin
+     Result :=inherited Enabled;
+     if (FButton.Enabled <> Result) //Paranoic Think
+     then FButton.Enabled :=Result;
+end;
+
+procedure TBCExpandPanel.SetBevelColorHighlight(AValue: TColor);
+begin
+  if (rBevelColorHighlight <> AValue) then
+  begin
+    rBevelColorHighlight := AValue;
+
+    if not(csLoading in ComponentState)
+    then Invalidate;
+  end;
+end;
+
+procedure TBCExpandPanel.SetBevelColorShadow(AValue: TColor);
+begin
+  if (rBevelColorShadow <> AValue) then
+  begin
+    rBevelColorShadow := AValue;
+
+    if not(csLoading in ComponentState)
+    then Invalidate;
+  end;
+end;
+
+procedure TBCExpandPanel.SetBevelRounded(AValue: Boolean);
+begin
+  if (rBevelRounded <> AValue) then
+  begin
+    rBevelRounded := AValue;
+
+    if not(csLoading in ComponentState)
+    then Invalidate;
+   end;
+end;
+
+procedure TBCExpandPanel.SetEnabled(AValue: Boolean);
+begin
+     inherited Enabled :=AValue;
+     FButton.Enabled :=AValue;
+end;
+
+procedure TBCExpandPanel.setButtonSize(Value: integer);
+begin
+  if FButtonSize = Value then
+    exit;
+
+  FButtonSize := Value;
+
+  PositionButton;
+end;
+
+procedure TBCExpandPanel.SetBounds(ALeft, ATop, AWidth, AHeight: integer);
+begin
+  inherited SetBounds(ALeft, ATop, AWidth, AHeight);
+
+  if not Collapsed and not Animating and (ComponentState * [csLoading] = []) then
+    FExpandedSize := RelevantSize(self, FCollapseKind);
+end;
+
+
+procedure TBCExpandPanel.setButtonPosition(Value: TAnchorKind);
+var
+  wasanimated, wascollpased: boolean;
+begin
+  if FButtonPosition = Value then
+    exit;
+
+  wasanimated  := Animated;
+  wascollpased := Collapsed;
+  Animated     := False;
+  if Collapsed then
+    Collapsed := False;
+
+  FButtonPosition := Value;
+  PositionButton;
+
+  Collapsed := wascollpased;
+  Animated  := wasanimated;
+
+  Invalidate;
+end;
+
+
+procedure TBCExpandPanel.setCollapseKind(Value: TAnchorKind);
+var
+  wasanimated, wascollpased: boolean;
+begin
+  if FCollapseKind = Value then
+    exit;
+
+  wasanimated  := Animated;
+  wascollpased := Collapsed;
+  Animated     := False;
+
+  if Collapsed then
+    Collapsed := False;
+
+  FCollapseKind := Value;
+
+
+  //switsch sizes
+
+  case FCollapseKind of
+    akLeft, akRight: FExpandedSize := Width;
+    akTop, akBottom: FExpandedSize := Height;
+    end;
+
+  if not(csLoading in ComponentState) then
+  begin
+       FButton.BuildGlyphs;
+       FButton.Invalidate;
+  end;
+
+  Collapsed := wascollpased;
+
+  Animated := wasanimated;
+end;
+
+procedure TBCExpandPanel.setAnimationSpeed(Value: real);
+begin
+  korrigiere(Value, 3, 1000);
+  FAnimationSpeed := Value;
+end;
+
+procedure TBCExpandPanel.PositionButton;
+
+  function ButtonRect: TRect;
+  begin
+    case FButtonPosition of
+      akBottom, akTop: Result := Rect(0, 0, RelevantOrthogonalSize(self, FButtonPosition), FButtonSize);
+      akLeft, akRight: Result := Rect(0, 0, FButtonSize, RelevantOrthogonalSize(self, FButtonPosition));
+      end;
+
+    //this must come after the thing above!!!
+    // this moves the button to the bottom, or the right
+    case FButtonPosition of
+      akBottom: Result.Top := Result.Top + RelevantSize(self, FButtonPosition) - FButtonSize;
+      akRight: Result.Left := Result.Left + RelevantSize(self, FButtonPosition) - FButtonSize;
+      end;
+  end;
+
+var
+  new: TRect;
+begin
+  if StopCircleActions or not(Assigned(FButton)) or (csLoading in ComponentState)
+  then exit;
+  StopCircleActions := True;
+
+
+  new := ButtonRect;
+  FButton.SetBounds(new.Left, new.Top, new.Right, new.Bottom);
+
+
+  //set anchors
+  case FButtonPosition of
+    akBottom: FButton.Anchors := [akTop, akLeft, akBottom, akRight] - [akTop];
+    akLeft: FButton.Anchors   := [akTop, akLeft, akBottom, akRight] - [akRight];
+    akTop: FButton.Anchors    := [akTop, akLeft, akBottom, akRight] - [akBottom];
+    akRight: FButton.Anchors  := [akTop, akLeft, akBottom, akRight] - [akLeft];
+    end;
+
+  Invalidate;
+
+  StopCircleActions := False;
+end;
+
+procedure TBCExpandPanel.ButtonClick(Sender: TObject);
+begin
+  if Assigned(FEPManagesCollapsing) then
+    FEPManagesCollapsing(self)
+  else
+    Collapsed := not Collapsed;
+
+  if Assigned(OnButtonClick) then
+    OnButtonClick(self);
+end;
+
+procedure TBCExpandPanel.Animate(aTargetSize: integer);
+var
+  storAnimated: boolean;
+begin
+  if (FAnimating) then
+  begin
+    //  FinishLastAnimationFast
+    storAnimated := FAnimated;
+    FAnimated     := False;
+    TimerAnimateSize(self);
+    FAnimated := storAnimated;
+  end;
+
+  // Now do animation
+  TargetAnimationSize := aTargetSize;
+
+  if (ComponentState * [csLoading, csDesigning] = []) and FAnimated then
+    begin
+    Timer.Enabled := True;
+    Timer.OnTimer := @TimerAnimateSize;
+    //EndProcedureOfAnimation := nil; //On Collapse then EndTimerCollapse never Executed
+    end
+  else
+    begin
+    TimerAnimateSize(self);
+    TimerAnimateSize(self);
+    end;
+end;
+
+procedure TBCExpandPanel.SetTextAlignment(AValue: TAlignment);
+begin
+  if FTextAlignment=AValue then Exit;
+  FTextAlignment:=AValue;
+  Invalidate;
+end;
+
+procedure TBCExpandPanel.DoCollapse;
+var
+   i :Integer;
+   curControl: TControl;
+
+begin
+  (* may work but is irrilevant because TSpeedButton is always on Bottom ????why?
+  i :=0;
+  while (i < ControlCount) do
+  begin
+    curControl :=Controls[i];
+
+    if not(curControl is TBCBoundButton) then
+    begin
+      Self.SetChildZPosition(curControl, 0);
+     end;
+
+    inc(i)
+  end;*)
+
+  if assigned(OnPreCollapse) then
+    OnPreCollapse(self);
+
+  //FButton.Color := FCollapsedButtonColor;
+
+  EndProcedureOfAnimation := @EndTimerCollapse;
+
+
+  Animate(FButtonSize);
+
+{$IFDEF DebugInfo}
+  debugln('TBCExpandPanel.DoCollapse');
+  debugln('FButtonSize ' + IntToStr(FButtonSize));
+{$ENDIF}
+
+end;
+
+procedure TBCExpandPanel.DoExpand;
+begin
+  if assigned(OnPreExpand) then
+    OnPreExpand(self);
+
+  //  FButton.ControlStyle := FButton.ControlStyle + [csNoFocus, csNoDesignSelectable];
+  //  FButton.Parent:=self;
+
+  //FButton.Color := FExpandedButtonColor;
+
+  EndProcedureOfAnimation := @EndTimerExpand;
+
+  Animate(FExpandedSize);
+
+{$IFDEF DebugInfo}
+  debugln('TBCExpandPanel.DoExpand');
+  debugln('FExpandedSize ' + IntToStr(FExpandedSize));
+{$ENDIF}
+
+end;
+
+procedure TBCExpandPanel.AdjustClientRect(var ARect: TRect);
+begin
+  inherited AdjustClientRect(ARect);
+
+  if Assigned(FButton) then
+    case ButtonPosition of
+      akTop:
+        ARect.Top    := ARect.Top + fButton.Height;
+      akBottom:
+        ARect.Bottom := ARect.Bottom - fButton.Height;
+      akLeft:
+        ARect.Left   := ARect.Left + fButton.Width;
+      akRight:
+        ARect.Right  := ARect.Right - fButton.Width;
+      end;
+end;
+
+procedure TBCExpandPanel.Loaded;
+begin
+     inherited Loaded;
+end;
+
+procedure TBCExpandPanel.CreateWnd;
+begin
+  inherited CreateWnd;
+
+  FButton.BuildGlyphs; //Button Loaded is called Before Self.Loaded and cannot Build Glyphs
+
+(*  if (FCollapsed)
+  then SetRelevantSize(Self, FButtonPosition, FButtonSize)
+  else SetRelevantSize(Self, FButtonPosition, FExpandedSize); *)
+
+  PositionButton;
+end;
+
+procedure TBCExpandPanel.Paint;
+var
+  ARect: TRect;
+  TS: TTextStyle;
+
+begin
+  if not(FCollapsed) then
+  begin
+    ARect := GetClientRect;
+    Case FButtonPosition of
+    akTop: inc(ARect.Top, FButtonSize);
+    akBottom: dec(ARect.Bottom, FButtonSize);
+    akLeft: inc(ARect.Left, FButtonSize);
+    akRight: dec(ARect.Right, FButtonSize);
+    end;
+
+    {$ifdef DEBUG_PAINT}
+      Canvas.Brush.Color:=clRed;
+      Canvas.Brush.Style:=bsSolid;
+      Canvas.FillRect(ARect);
+    {$endif}
+
+    // if BevelOuter is set then draw a frame with BevelWidth
+    if (BevelOuter <> bvNone)
+    then if rBevelRounded
+         then Frame3d_Rounded(Self.Canvas, ARect, BevelWidth, 5, 5, BevelOuter,
+                              rBevelColorShadow, rBevelColorHighlight, Color)
+         else Self.Canvas.Frame3d(ARect, BevelWidth, BevelOuter);
+
+    InflateRect(ARect, -BorderWidth, -BorderWidth);
+
+    // if BevelInner is set then skip the BorderWidth and draw a frame with BevelWidth
+    if (BevelInner <> bvNone)
+    then if rBevelRounded
+         then Frame3d_Rounded(Self.Canvas, ARect, BevelWidth, 5, 5, BevelInner,
+                              rBevelColorShadow, rBevelColorHighlight, Color)
+         else Self.Canvas.Frame3d(ARect, BevelWidth, BevelInner);
+
+    if (Self.Caption <> '') then
+    begin
+      TS := Canvas.TextStyle;
+      TS.Alignment := BidiFlipAlignment(Self.TextAlignment, UseRightToLeftAlignment);
+      if (BiDiMode <> bdLeftToRight)
+      then TS.RightToLeft:= True;
+      TS.Layout:= Graphics.tlCenter;
+      TS.Opaque:= false;
+      TS.Clipping:= false;
+      TS.SystemFont:=Canvas.Font.IsDefault;
+      if not(Enabled) then
+      begin
+        Canvas.Font.Color := clBtnHighlight;
+        Types.OffsetRect(ARect, 1, 1);
+        Self.Canvas.TextRect(ARect, ARect.Left, ARect.Top, Self.Caption, TS);
+        Self.Canvas.Font.Color := clBtnShadow;
+        Types.OffsetRect(ARect, -1, -1);
+       end
+      else Self.Canvas.Font.Color := Font.Color;
+
+      Self.Canvas.TextRect(ARect,ARect.Left,ARect.Top, Self.Caption, TS);
+    end;
+  end;
+end;
+
+constructor TBCExpandPanel.Create(TheOwner: TComponent);
+begin
+  StopCircleActions := True;
+
+  inherited;
+
+  FButtonSize := 27;
+  FAnimated := True;
+  FCollapseKind := akTop;
+  FVisibleTotal := True;
+  FCollapsed := False;
+  FButtonPosition := akTop;
+  FCollapsedButtonColor := clSkyBlue;
+  FExpandedButtonColor := RGBToColor(23, 136, 248);
+  rBevelColorHighlight:=clBtnHighlight;
+  rBevelColorShadow:=clBtnShadow;
+  rBevelRounded:=True;
+  FExpandedSize := 200;
+  Height  := FExpandedSize;
+  Width   := 200;
+  FAnimationSpeed := 20;
+  Caption := '';
+
+  Timer      := TTimer.Create(self);
+  Timer.Enabled := False;
+  Timer.Name := 'Animationtimer';
+  Timer.Interval := 20;
+
+  FButton := TBCBoundButton.Create(self);
+  with FButton do
+    begin
+    Parent  := self;
+    Name    := 'Button';
+    Caption := 'Caption';
+    ControlStyle := ControlStyle + [csNoFocus, csNoDesignSelectable];
+    FButton.OnClick := @self.ButtonClick;
+    end;
+
+  StopCircleActions := False;
+
+  //may be only in CreateWnd but the button is greater by some pixels
+  PositionButton;
+end;
+
+
+
+destructor TBCExpandPanel.Destroy;
+begin
+  timer.Enabled := False;
+
+  Timer.Free;
+
+  if (ComponentState * [csLoading, csDesigning] = []) then
+    FButton.Free;  // bringt einen Fehler in der Designtime wenn ich das hier mache
+
+  //  FButton.Free;  // bringt einen Fehler in der Designtime wenn ich das hier mache
+
+  inherited Destroy;
+end;
+
+
+{$IFDEF FPC}
+procedure Register;
+begin
+  RegisterComponents('BGRA Controls', [TBCExpandPanel, TBCExpandPanels]);
+end;
+{$ENDIF}
+
+initialization
+   {$i BCExpandPanels.lrs}
+
+end.

+ 7 - 2
bgracontrols.lpk

@@ -15,8 +15,8 @@
           <SyntaxMode Value="Delphi"/>
           <CStyleOperator Value="False"/>
           <AllowLabel Value="False"/>
-          <CPPInline Value="False"/>
           <UseAnsiStrings Value="False"/>
+          <CPPInline Value="False"/>
         </SyntaxOptions>
       </Parsing>
       <CodeGeneration>
@@ -34,7 +34,7 @@
     <Description Value="BGRA Controls is a set of graphical UI elements that you can use with Lazarus LCL applications."/>
     <License Value="Modified LGPL"/>
     <Version Major="8"/>
-    <Files Count="68">
+    <Files Count="69">
       <Item1>
         <Filename Value="atshapelinebgra.pas"/>
         <HasRegisterProc Value="True"/>
@@ -365,6 +365,11 @@
         <Filename Value="bgrasvgimagelistform/bgrasvgimagelistform.pas"/>
         <UnitName Value="bgrasvgimagelistform"/>
       </Item68>
+      <Item69>
+        <Filename Value="BCExpandPanels.pas"/>
+        <HasRegisterProc Value="True"/>
+        <UnitName Value="BCExpandPanels"/>
+      </Item69>
     </Files>
     <CompatibilityMode Value="True"/>
     <LazDoc Paths="fpdoc"/>

+ 12 - 17
bgracontrols.pas

@@ -8,21 +8,16 @@ unit bgracontrols;
 interface
 
 uses
-  atshapelinebgra, BCButton, BCButtonFocus, BCCheckComboBox, BCComboBox, 
-  BCEffect, bcfilters, BCFluentProgressRing, BCGameGrid, BCGradientButton, 
-  BCImageButton, BCLabel, BCListBox, BCListBoxEx, BCMaterialDesignButton, 
-  BCMaterialEdit, BCMaterialFloatSpinEdit, BCMaterialProgressBarMarquee, 
-  BCMaterialSpinEdit, BCMDButton, BCMDButtonFocus, BCPanel, 
-  BCRadialProgressBar, BCRoundedImage, BCRTTI, BCSamples, BCStylesForm, 
-  BCSVGButton, BCSVGViewer, BCToolBar, BCTrackbarUpdown, BGRAColorTheme, 
-  bgracontrolsinfo, BGRACustomDrawn, BGRADrawerFlashProgressBar, 
-  BGRAFlashProgressBar, BGRAGraphicControl, BGRAImageList, 
-  BGRAImageManipulation, BGRAImageTheme, BGRAKnob, BGRAResizeSpeedButton, 
-  BGRAShape, BGRASpeedButton, BGRASpriteAnimation, BGRASVGImageList, 
-  BGRASVGTheme, BGRATheme, BGRAThemeButton, BGRAThemeCheckBox, 
-  BGRAThemeRadioButton, BGRAVirtualScreen, ColorSpeedButton, DTAnalogClock, 
-  DTAnalogCommon, DTAnalogGauge, dtthemedclock, dtthemedgauge, MaterialColors, 
-  bgrasvgimagelistform, LazarusPackageIntf;
+  atshapelinebgra, BCButton, BCButtonFocus, BCCheckComboBox, BCComboBox, BCEffect, bcfilters, BCFluentProgressRing, 
+  BCGameGrid, BCGradientButton, BCImageButton, BCLabel, BCListBox, BCListBoxEx, BCMaterialDesignButton, 
+  BCMaterialEdit, BCMaterialFloatSpinEdit, BCMaterialProgressBarMarquee, BCMaterialSpinEdit, BCMDButton, 
+  BCMDButtonFocus, BCPanel, BCRadialProgressBar, BCRoundedImage, BCRTTI, BCSamples, BCStylesForm, BCSVGButton, 
+  BCSVGViewer, BCToolBar, BCTrackbarUpdown, BGRAColorTheme, bgracontrolsinfo, BGRACustomDrawn, 
+  BGRADrawerFlashProgressBar, BGRAFlashProgressBar, BGRAGraphicControl, BGRAImageList, BGRAImageManipulation, 
+  BGRAImageTheme, BGRAKnob, BGRAResizeSpeedButton, BGRAShape, BGRASpeedButton, BGRASpriteAnimation, BGRASVGImageList, 
+  BGRASVGTheme, BGRATheme, BGRAThemeButton, BGRAThemeCheckBox, BGRAThemeRadioButton, BGRAVirtualScreen, 
+  ColorSpeedButton, DTAnalogClock, DTAnalogCommon, DTAnalogGauge, dtthemedclock, dtthemedgauge, MaterialColors, 
+  bgrasvgimagelistform, BCExpandPanels, LazarusPackageIntf;
 
 implementation
 
@@ -42,8 +37,7 @@ begin
   RegisterUnit('BCMaterialDesignButton', @BCMaterialDesignButton.Register);
   RegisterUnit('BCMaterialEdit', @BCMaterialEdit.Register);
   RegisterUnit('BCMaterialFloatSpinEdit', @BCMaterialFloatSpinEdit.Register);
-  RegisterUnit('BCMaterialProgressBarMarquee', 
-    @BCMaterialProgressBarMarquee.Register);
+  RegisterUnit('BCMaterialProgressBarMarquee', @BCMaterialProgressBarMarquee.Register);
   RegisterUnit('BCMaterialSpinEdit', @BCMaterialSpinEdit.Register);
   RegisterUnit('BCMDButton', @BCMDButton.Register);
   RegisterUnit('BCMDButtonFocus', @BCMDButtonFocus.Register);
@@ -77,6 +71,7 @@ begin
   RegisterUnit('DTAnalogGauge', @DTAnalogGauge.Register);
   RegisterUnit('dtthemedclock', @dtthemedclock.Register);
   RegisterUnit('dtthemedgauge', @dtthemedgauge.Register);
+  RegisterUnit('BCExpandPanels', @BCExpandPanels.Register);
 end;
 
 initialization