Large patch from Giuliano Colla: Adds pallete images to CD controls, improves TCDButton to be more similar to TBitBtn, improves the speed of mouse/resize message handling in LCL-CustomDrawn-X11 and starts implementing MessageDlg in LazDialogs

git-svn-id: trunk@38612 -
This commit is contained in:
sekelsenmat 2012-09-11 08:04:30 +00:00
parent c410493ade
commit b6fd6f59e1
8 changed files with 517 additions and 20 deletions

1
.gitattributes vendored
View File

@ -855,6 +855,7 @@ components/customdrawn/customdrawnimages/android.lrs svneol=native#text/plain
components/customdrawn/customdrawnimages/android_checkbox.bmp -text
components/customdrawn/customdrawnimages/android_checkbox_checked.bmp -text
components/customdrawn/customdrawnlcldrawers.pas svneol=native#text/plain
components/customdrawn/paletteimg.lrs svneol=native#text/plain
components/customform/custforms.pp svneol=native#text/plain
components/customform/demo/appform.pas svneol=native#text/plain
components/customform/demo/appforms.lpk svneol=native#text/plain

View File

@ -16,7 +16,7 @@ interface
uses
Classes, SysUtils, Graphics, Controls, LCLType, LCLIntf, IntfGraphics,
Math, types, contnrs, componenteditors, LMessages, Messages,
LCLProc, PropEdits, ExtCtrls, ImgList, Forms, Menus,
LCLProc, PropEdits, ExtCtrls, ImgList, Forms, Menus, LResources,
customdrawncontrols,
// fpimage
fpcanvas, fpimgcanv, fpimage
@ -182,6 +182,7 @@ resourcestring
procedure Register;
begin
{$i paletteimg.lrs}
RegisterComponents('Custom Drawn', [
// Standard tab
TCDButton, TCDEdit, TCDCheckBox, TCDRadioButton, TCDComboBox, TCDScrollBar, TCDGroupBox,

View File

@ -0,0 +1,212 @@
LazarusResources.Add('tcdbutton','PNG',[
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#24#0#0#0#24#8#6#0#0#0#224'w='#248#0
+#0#2#139'IDATx^'#237'UMKUQ'#20']'#251#156#243#204#7#129#137'QA!'#4'Q'#163#168
+'h'#212#160#31#208'/'#136#192#240'Q'#208#208'FE'#10'j'#13#210'A$(AR'#8'ZH'
+#244#23'$h\'#163#160#6'FI5'#9'"'#164#30#154#239#189's'#207'G{'#159'{'#159#151
+#135#209' q'#16#184'`s'#246#217#251#222#181#246#199#133'K!'#4#16#17'v'#10#20
+'c'#196'NB'#177#253#223#2#244'y'#229'}|'#246#226#13#222'}'#252#6'e4"'#254'>'
+#178#224'='#144#158'!t"'#130'H%'#211'F'#225#202#133#179'8v'#228#16#204#212
+#243'W'#168#238#239#199#169's'#199#209#180#0#169'm,<F("8'#31#176#248'r'#25'7'
+'.'#246#193','#255#168'`'#186'v'#30#7'{'#21#164'8'#218#202'/'#241#4#165#242
+'|'#8#226#255#145#31#129#173#186#7#184#245#240'''V'#190#214'a'#26'6'#162#167
+#219#161#183'[!'#132#188#2#160#156'B`6'#165#187'J'#18#159#129't'#5#8'n'#203
+#148'b'#16#1#15'm'#12'|'#8')o'#132#192'zp@'#161#229'B)'#0'J'#21'U'#187#12#6
+'.'#215' Xx:'#15'0'#249' '#223#31#207#205'q'#158#197#203'V'#248#30'Y@'#161
+#170'u'#26#19#17#193'd'#158#131'b'#25#224'l'#217#186#247#14'Zk'#12'\'#173'av'
+'v'#14#2'!^X'#152#135#192'('#13#197#182#177#225#249'$!g'#203#199'G]'#128#11
+'QJ'#132#241'B'#30#1#199#167'sqS '#203#188#200'@'#208'hX'#180'Q'#175#231#254
+#218#154#197#208#208'5'#204#204'<'#130'@:'#137#16#129#184#185'''q'#140#4'dL'
+#205'V'#147'MZ'#166'B C'#129#148'k#sI '#145#223#159'z'#144#238'!'#148#31#135
+'s'#30#177#167#146#132' '#29#132#162#173#204':'#180'Z'#30#186#16#176#165#0
+#199'K'#191#177#209'b'#146#0'cT'#242#11'l'#238'"c'#129#224#9'9?'#193#200'h<'
+#223'l'#203'v'#8'DV'#21#140#141'N'#226#246#248#205#220#31#155#132#181'6'#145
+'OLLcd'#228'z'#138#181'A'#164#184's'''#11#22#206'|'#201'^.b'#200'w'#16#21#18
+#8'RE'#132'`x'#248'.'#156#188#232#0#163'5'#147#222#227#234#155',0'#137#204#6
+'h'#163#145#30'-8'#130#7#188#11'il&*'#5'c4'#236#175'&l'#217'A'#199#167'G'#28
+'#"'#206'7'#145#17#229#177#246#169#20#147#150'#'#228#209#138#12#200#152#180#7
+#179#175#210#192#147#165'O8'#176#247#176'tR,'#139#240'o'#136'I'#244#245#23
+#139#213#239#171#232#235'='#10'3~'#233'$'#238',.'#225#237#135'u'#217#20#182
+#11#18#163#136#209#193#211'8s'#162#159'v'#127'8'#187#2#219#199'o''+w'#167#205
+#252#27#230#0#0#0#0'IEND'#174'B`'#130
]);
LazarusResources.Add('tcdcheckbox','PNG',[
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#24#0#0#0#24#8#6#0#0#0#224'w='#248#0
+#0#0'xIDATx^'#237#213#177#13#128'@'#8#5'P'#207#184#138#179'P'#187#0#133'kX'
+#187#134#197'-`'#205','#238#130#14#240'#'#209'|M4'#225'w4'#255#21#23#184#226
+#238#205#155'i'#201#130#4#248'tg'#128#136#236'w'#1'3+'#8#4#169'u'#185#12#168
+#142'?|'#131'a'#222#8#128'.G .'#195#153#4#16#1'l'#157#250#199#128#160#156#0
+#160#12'f'#6'@'#4'0'#30'@'#228#243#183#8#215#159'M'#254'h'#9#240'9'#0'G@#G1'
+#129'7'#157#0#0#0#0'IEND'#174'B`'#130
]);
LazarusResources.Add('tcdedit','PNG',[
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#24#0#0#0#24#8#6#0#0#0#224'w='#248#0
+#0#1#9'IDATx^'#237#149'OJ41'#16#197#223'K2'#227#31#188#144#203#239#28'2.f'
+#239#21'dN'#240'!'#184#20'f'#225'E\'#184'p/'#222#192#11#136#155#145'n'#187
+#202#4#9'%'#136#20#193#14'('#248#131#7'M5'#225#165'R'#149#10'E'#4'$'#209#11
+#170'*z'#18#178'~'#183'ABf'#187#189'Vt`'#189'>e'#170#129#135#251'['#204#201
+'fs^30'#254'_\a.'#158#159#30#231#169#1'I'#132#172'B'#140#241'S'#203'''4p|v'
+#131#194#221#229'?Tj'#155'''.0'#233#212#175#139#20#132'a$g'#183#182'c'''#19
+#129'6'#221#131#178#184#200#204#140'/'#226#210#158'A'#11#203#195#3''''#3#167
+#152#30#195#203#174#239#168'`'#130'c'#224#156#177#219#174'SC'#13#204#196#143
+'1'#18' '#160#175#138#16#9#21#187#27'f'#240#13'tRT'#196#190#205#0'6'#156#202
+#252#232'3'#174'W'#171#19'FD'#139#178'h'#4'4d'#197',@'#179#24#178#226#128'a'
+#220'aoy'#4#224#253#223'8('#22#251#196'GD'#228#135'<'#153#127#6'o'#158#205'h'
+'8"'#248'.'#169#0#0#0#0'IEND'#174'B`'#130
]);
LazarusResources.Add('tcdradiobutton','PNG',[
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#24#0#0#0#24#8#6#0#0#0#224'w='#248#0
+#0#1'~IDATx^'#237'U=k'#194'P'#20'='#175'?'#160'K'#167'.'#29#132'*Rh'#193#207
+':'#8'J'#29'T'#226#210#205#159#224#208'Ip'#234'"-'#248#3':'#132#14#14#10#173
+'[;H2'#4#186'd*A:'#8'UL!'#216'R'#232#212#165'cAS'#238#133#4#164'dxb6'#15#132
+#203'I'#14#231'<'#30#231#18#177'X, '#132'@X'#16#203#229#18'ab'#7#155#194'6`0'
+#24#184#205'f'#211'U'#20#133''''#241#141#4#12#135'C'#183'Z'#173#186#182'm'
+#163'T*'#161#219#189'E'#185'\'#134#227'8'#160#247#244'}'#221#22#177#185'i'
+#154'('#22#139'H&O'#254#9#166#211'7'#24#134#129'\.'#135'Z'#173'&'#164'['#164
+#170'j'#144'9#'#30'?D'#165'R!'#157't'#139#248#206#179#217#236#138#249#235#207
+#30#174#30#127'yz'#136'F#('#20#10#172#151#10#24#141'F'#200'd2+'#230#15'O_L.o'
+#158'WB'#242#249'<'#235#165#2'f'#179#25#18#137'c'#159#179#185#15#14#241'I$r@'
+'z'#185#128'X,'#134#241'x'#226#243#243#179'}'#188'L'#222#249'!\_'#156#194#195
+'|'#254'Iz'#185#128'T*'#5#203#178'|~'#180#251#237#153#210'd'#238#129#154'Fz'
+#217#154'r'#207'['#173#22#183'%'#0'|'#250'v'#187#13']'#215#229'k'#218'h4'#184
+#231#182#237#4#154'k'#154'F'#186#181'6'#153#151#135#150#168#211#233#160#215
+#187#131#227'|'#248#198#253#254'='#159'<'#157'N'#179'Nb'#147#131#247#130#170
+'Hm'#161#2#208#157#215#235'u'#177#253#225#132#31#176#13#248#3'L'#164#177'A'
+#222#235#132'C'#0#0#0#0'IEND'#174'B`'#130
]);
LazarusResources.Add('tcdcombobox','PNG',[
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#24#0#0#0#24#8#6#0#0#0#224'w='#248#0
+#0#0#243'IDATx^'#221#149'='#170#194'@'#16#128'gM'#250'4)<'#131#133#162#188'R'
+#20'RD<'#131'g'#176#19#19'o'#16#197#206'3x'#5#133' !'#254#148#242#130#22'9'
+#131#151'p'#247#145'<'#194' '#146'd]'#29#17#191'b'#187#217'ovf'#150'a'#156's'
+'`'#140#1#21'L'#8#1#148#232#201#225#186#139#151'Y<o'#200#238#4#255#146#129
+#194'e'#203#155#184#211'9N'#147'M%(@,'#203#6'Y'#130#192#135#12#211'4'#225#202
+#5#132#225#30#18#182#187#131#232'v'#218#12#5#24#4'*8'#206#4#12#195#200#233
+#129'2X'#22#187#215'/j2'#214'3C'#211'. G'#21#214#171#168'l'#138#176#243#217
+'D%'#25')'#130#194#162#18'5'#234'5B'#193#243'S%/'#192' u*@@'#233#11'~'#143#17
+#165#0#25#141#29#144'e>'#155'> '#192' '#154#23#180'~'#154#160#138#191#137#201
+#155#252'e'#255'@'#207'Y$'#20'%'#194#149#151','#140'O^'#250#239#157#162'?EtU'
+';'#244#164#221#245#0#0#0#0'IEND'#174'B`'#130
]);
LazarusResources.Add('tcdscrollbar','PNG',[
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#24#0#0#0#24#8#6#0#0#0#224'w='#248#0
+#0#0#218'IDATx^'#237#148'['#10#194'0'#16'E'''#226'&'#186#7#197#5#248#0#149
+#166#221#140#223#237#18#250#173#139#177#15#234#163#186#1#209'mHw'#144'q'#18
+#152'*'#134#226#143#253')'#185#16#14#183't'#238'-I'#137'PJ'#129#16#2#186#146
+'@D'#232'R'#3'B'#207#11'\'#193#240#211#196#241#14#225#15'J'#146#141'h'#12'"'
+#154#21'E['#172'Ng'#172#235'g'#179#244'3'#173'}Z'#182#178'm'#142's'#173'-'
+#186#223#30#224'y'#158#161'V'#154#29' '#12'V'#134#254#23#3'"'#139'g~'#158#129
+#12'}'#200#211#2#198#147#145#182#28'nX'#16#231#179#165#166#9#207#136','#154
+#209#179'\b'#21#180#190#200#225#204#203#245#8'RR'#184#241'S`'#249'r'#253#254
+'0'#251#144#237#18#22#135'7'#148#196'\'#251#5#249#10'XE^'#242#22'[wQ'''#127
+'Q'#159'.;W'#224#10'\'#193#11'-'#185#180#181#16#168':'#194#0#0#0#0'IEND'#174
+'B`'#130
]);
LazarusResources.Add('tcdgroupbox','PNG',[
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#24#0#0#0#24#8#6#0#0#0#224'w='#248#0
+#0#0#147'IDATx^'#237#149'A'#10#131'0'#16'E'#255#4#239'!x'#27#233'IJqY'#152'#'
+#184#15#226'yl'#175'!'#146'R'#232'1'#18'i'#23#14#136'#t1'#144'E'#30#204'*C'
+#222'$'#129'|'#138'1'#130#136'`'#5#165#148'`I'#133#3'n'#227'rj'#29#174#13#253
+'-`'#246#178'i}'#129#134#244#234#244'}'#183#13#224'v'#11#191'R'#145'>'#181
+#190'<'#167'GR'#175'('#132#25#247#22#10#210's'#196#251#245#193#30#7#3'r'#19
+#20'A'#17#20'A'#17'T'#202#143'h#`'#246#22''''#144#20#146#160#200' '#244#179
+'y'#228#21'V%6WL'#253#171#160#0#0#0#0'IEND'#174'B`'#130
]);
LazarusResources.Add('tcdstatictext','PNG',[
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#24#0#0#0#24#8#6#0#0#0#224'w='#248#0
+#0#0#169'IDATx^'#237#149'A'#10#194'0'#20'D'#253#210'K'#185't'#227'A'#220'{'
+#135#220#161']{'#16'7.='#214'H'#16'y'#11#135'D$'#31'E:'#16'~'#249#229#243'&'
+#19#210#134#164'M'#166#182'4'#254#21#176#2#166'Z'#202#249#162#209#128'r<'#196
+#19'@c'#132'0'#252'~D'#187#211'Uu'#253#230#25#188#186#197#233'm'#222#135'{G'
+#159#158#153#241#17#213#225#186#252'0}*36'#162'O'#243#142#192#168'w'#15#192
+'G'#144#127#209'p'#218#23#6#155#0#151#189'$'#187'Cj;'#214#201#231#136#251'X'
+#30#143#14#8#4'u'#0#8#247#192'$%_4`'#212#142'BR'#234#199#238#251#255#228#21
+'p'#7'V'#181'`/'#219#165'Qi'#0#0#0#0'IEND'#174'B`'#130
]);
LazarusResources.Add('tcdtrackbar','PNG',[
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#24#0#0#0#24#8#6#0#0#0#224'w='#248#0
+#0#0#222'IDATx^'#237#149#177#10#194'0'#16#134#255'H'#223#195'R'#156'\'#10'n'
+#14#234'\|'#145#138't'#239'#t/b_'#193#173#131#210#209#209'M'#16#196'I'#165'E'
+#240'5b)'#220#160'G '#164#173'('#244'[J'#142'$'#127'r'#215#251'#'#164#148'h'
+#147#30#128#255#22#176#160'`'#185#190#179#220#173#22#142'hL'#224'x)'#192'q'
+#154#185'A'#24#198#242#16#7#200#243'+'#136'4'#221#150#241#179#140#162'@'#252
+'V'#13#232#196#208'@w'#238#220's1'#153'M'#197'['#138'|'#223#3#145'$'#25#24'l'
+#158#154'G'#241#4'a'#177#160#254'b'#253#20'}'#22'n'#151#157'$'#20#208#213#141
+#139'L'#130#227'`'#15#219#30#208#31#132#205#205#173#226#141'u'#242'h'#216#7
+#137#148#155'W'#227#154'V'#193#187#150'D'#202'o5'#134#1#220'M'#193'-'#131'67'
+#161'}'#187'V5'#143'i'#252#235'V'#209#189'h'#157'@}^s'#235'W'#197'hN+'#192#0
+#0#0#0'IEND'#174'B`'#130
]);
LazarusResources.Add('tcdprogressbar','PNG',[
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#24#0#0#0#24#8#6#0#0#0#224'w='#248#0
+#0#0#174'IDATx^'#237#149#191#14#130'0'#16#198#239#12#155#207#225#194#130#179
+#179'10'#241#6'>'#129#238'$'#134#137#144#176#243'$'#14#198'''p3'#26'w}'#11
+#231#150'?'#201#209'.'#208#146#180#3#208'o'#250#190#229'~'#201#245#238#138
+#140'1@D'#176'%'#228#156#131'M'#173#200#204#23#224#0#30#153'$)'#141#142'SQ'
+#156#177#5'P'#241#195#222#7'S'#162#154#13#196#147#169#151#171#232#216'='#11
+' J?'#131#185'O'#175#231'[n'#145'Pz'#220'J'#137'+'#179#254#27#16#249#247#239
+#252'n'#179'V'#229#241#128#219#227#219#249'S'#24#168#242#146#246#128#148#199
+'L'#158#132':'#195'P'#214'>'#215#214#22'm"'#255#129#3'8@'#5#154#11'I'#254'U'
+#188#163'/'#0#0#0#0'IEND'#174'B`'#130
]);
LazarusResources.Add('tcdlistview','PNG',[
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#24#0#0#0#24#8#6#0#0#0#224'w='#248#0
+#0#0#145'IDATx^'#237#214'1'#10#196' '#20#4#208#249#146#243#164'O%)'#131'g'
+#177#247#8#233'='#139'u'#176#202#173't'#217'"'#16#144'e'#22#241'C'#138'<'#176
+#25#196'_L'#241#149'R'#10'D'#4'Z'#164#214#138#16'b'#197'`'#219'6'#195'Z+'#6
+'D'#239#227#151#9'7'#251#238'1B'#206#25#23#3#29'|'#192#226#143#239#233#200
+#154#1#186'&'#252'p'#198#181'7'#227#3#156's'#184'K)'#253#157#241#1#237'E'#158
+#189'%'#243#236'-'#153'{r'#201#220#152#146';'#241#146#159#223'A'#179#137#6'3'
+#205#30#213#248'Uh'#250#0#150'*WZ.'#194'('#148#0#0#0#0'IEND'#174'B`'#130
]);
LazarusResources.Add('tcdpagecontrol','PNG',[
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#24#0#0#0#24#8#6#0#0#0#224'w='#248#0
+#0#0#1'sRGB'#0#174#206#28#233#0#0#0#6'bKGD'#0#255#0#255#0#255#160#189#167#147
+#0#0#0#9'pHYs'#0#0#11#18#0#0#11#18#1#210#221'~'#252#0#0#0#7'tIME'#7#216#2#27
+#8#14#17'5A'#235#216#0#0#0#235'IDATH'#199'c'#252#255#255'?'#3'-'#1#19#3#141#1
+#11#3#3#3#195#234#163#15#254'O^}'#28#167#162#220'PK'#134'Pk'#5'Fr,`'#252#255
+#255'?'#131']'#193#242#255#135'&D'#226'TdW'#176#28#167#197#216#28#134#236' '
+#22'd'#137'O'#159#255#224#180#4#155#3#236#10#150#227#20#15#181'V`'#192#176
+#224#203#215#239'x'#189#251#236#197'g'#162#196'0'#226#0#6#190'~'#249#134'W16'
+'yBz'#24#255#255#255#207'PQ1'#249#191#153#153')NE'#19#14#221''')b'#173'8'#222
+'0x{'#234'3'#216#218#219'1'#194'}'#16#20'd'#129'S'#3'>9l'#160#162'b2'#246' z'
+#240#224#14#197#233#254#241#195'g'#244#205'h'#163#22#140'Z0j'#1'ZNF'#207#133
+#212#0#140#176':'#185#162'b2'#213'*goO}'#6#6#6#6#6'[{;F'#184#5#135#15#30#162
+'j'#237'oko'#199#136#226#131'!'#27#201#0#223#150'X'#226#23#233'FP'#0#0#0#0'I'
+'END'#174'B`'#130
]);
LazarusResources.Add('tcdtabcontrol','PNG',[
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#24#0#0#0#24#8#6#0#0#0#224'w='#248#0
+#0#0#1'sRGB'#0#174#206#28#233#0#0#0#6'bKGD'#0#255#0#255#0#255#160#189#167#147
+#0#0#0#9'pHYs'#0#0#11#18#0#0#11#18#1#210#221'~'#252#0#0#0#7'tIME'#7#216#2#27
+#8#14'.'#131''''#198#229#0#0#0#232'IDATH'#199'c'#252#255#255'?'#3'-'#1#19#3
+#141#1#11#3#3#3#195#234#163#15#254'O^}'#28#167#162#220'PK'#134'Pk'#5'Fr,`'
+#252#255#255'?'#131']'#193#242#255#135'&D'#226'TdW'#176#28#167#197#216#28#134
+#236' '#22#152#224#167#207#127#240#186#4#155#3#236#10#150#227#20#15#181'V`@'
+#177#224#229#203#183'x-'#184'}'#231'%I'#226'(q'#192#192#192#192#240#237#235
+'w'#188#10'q'#201#19#210#199#194#192#192#192'`'#197#241#134#225#238#221#23'x'
+#21#230#206'?N'#180#184#21#199#27#134#195#7#15#253#183#181#183'c'#132#251' ('
+#200#2#167#225#248#228#176#129#138#138#201#152'A'#196#192#192#192#240#224#193
+#29#138#211#253#227#135#207#232#155#209#232#147#147#25#24#24#24#14#31'<D['#11
+#182'n'#191'H'#19#11#24'a'#165#233#225#131#135#168'^'#172#218#218#219'12'#14
+#249#226'z'#212#130'Q'#11#134#128#5#0#30#11'U'#17'h'#218#26#28#0#0#0#0'IEND'
+#174'B`'#130
]);
LazarusResources.Add('tcdspinedit','PNG',[
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#24#0#0#0#24#8#6#0#0#0#224'w='#248#0
+#0#1'VIDATx^'#237#213#177'J'#3'A'#20#134#209'of'#199#237'| '#139#128#190#136
+'Ej'#163#141#129#20#178#132'`'#161'DDH)'#164#240#21'l'#5#145#20#246#226#27'X'
+'EA'#146#152#16']ww'#228#130#195#192#144'dY0'#149'9'#205#238'Lq'#255'a'#238
+'eWYkY''M'#137'M'#128#1#232#247'o,kP'#175#239'+'#195#175#231#167#1#127#169
+#221'N'#16#6#143#203#171'k'#202#164'iJ'#28#199#136'<'#207'1'#187'-Bv'#208'e2'
+'zq'#1#213'HqkA)'#164'8'#249#195'9!Uk2'#190'=\'#16#240#13'l!'#216'i'#220#19
+'z'#236#237'!'#10#11#145'B0|'#155'!'#154#199#13#186#23'='#2'A@'#4'd'#128'v'
+#197#22#135'E'#26#135#143#201#140'N'#167#229'BH'#146#179#21#1'*'#220'q'#197
+'}`h'#252'>'#229#232#224#4#252#186'$'#160#2'i'#166#220#247#170'&k<r'#202'N_'
+#157#193#195'R'#137#156#190#226#20'YH'#129'XQ'#14'?E'#210'\'''#156'$'#141#135
+'R'#21#138#251')r'#147'#OY/o'#178'&#w['#133#191#251#12#1'E'#6'Z'#129#137#8
+#167'F&I'#222'Kz`'#11' EY'#141#214#134'\'#150'*C'#169'9'#17#219#225#133#146
+#13':'#152'ZB'#232#243#238#148#175#249#171#11#240#31#167#233'x'#200'r#'#22
+#145'f'#134#164#184#243#15'~'#153#155#128#31#139#147#145#180#140#215#223#17#0
+#0#0#0'IEND'#174'B`'#130
]);

View File

@ -433,11 +433,6 @@ function dbgs(Kind: TBitBtnKind): string; overload;
procedure Register;
implementation
uses
WSButtons;
const
BitBtnModalResults: array[TBitBtnKind] of TModalResult = (
0, mrOK, mrCancel, 0, mrYes, mrNo,
@ -465,6 +460,11 @@ const
{idButtonNoToAll } 'btn_no'
);
implementation
uses
WSButtons;
function GetLCLDefaultBtnGlyph(Kind: TBitBtnKind): TGraphic;
begin
Result := GetDefaultButtonIcon(BitBtnImages[Kind]);

View File

@ -26,7 +26,7 @@ uses
Graphics, Controls, LCLType, LCLIntf, LCLMessageGlue,
LMessages, Messages, LCLProc, Forms,
// Other LCL units are only for types
StdCtrls, ExtCtrls, ComCtrls,
StdCtrls, ExtCtrls, ComCtrls, Buttons,
//
customdrawndrawers;
@ -131,10 +131,17 @@ type
TCDButton = class(TCDButtonControl)
private
FShortCut: TShortcut;
FShortCutKey2: TShortcut;
FGlyph: TBitmap;
FKind: TBitBtnKind;
FModalResult: TModalResult;
procedure SetModalResult(const AValue: TModalResult);
procedure SetGlyph(AValue: TBitmap);
protected
procedure SetKind(AKind: TBitBtnKind);
protected
FBState: TCDButtonStateEx;
procedure Click; override;
function GetControlId: TCDControlID; override;
procedure CreateControlStateEx; override;
procedure PrepareControlStateEx; override;
@ -153,7 +160,9 @@ type
property Enabled;
property Font;
property Glyph: TBitmap read FGlyph write SetGlyph;
property Kind: TBitBtnKind read FKind write SetKind default bkCustom;
// property IsToggleBox: Boolean read FGlyph write SetGlyph;
property ModalResult: TModalResult read FModalResult write SetModalResult default mrNone;
property OnChangeBounds;
property OnClick;
property OnContextPopup;
@ -2021,6 +2030,12 @@ end;
{ TCDButton }
procedure TCDButton.SetModalResult(const AValue: TModalResult);
begin
if AValue=FModalResult then exit;
FModalResult:=AValue;
end;
procedure TCDButton.SetGlyph(AValue: TBitmap);
begin
if FGlyph=AValue then Exit;
@ -2028,6 +2043,68 @@ begin
Invalidate;
end;
procedure TCDButton.SetKind(AKind: TBitBtnKind);
var
ACaption: string;
Shortcutpos: Integer;
ShortcutVal: char;
BitBtnImage: Integer;
C: TCustomBitmap;
begin
if AKind <> FKind then begin
FKind:= AKind;
if FKind = bkCustom then exit; // if changed to custom, don't touch other settings
ModalResult:= BitBtnModalResults[AKind];
ACaption:= GetButtonCaption(BitBtnImages[AKind]);
Shortcutpos:= DeleteAmpersands(ACaption);
Caption:= ACaption;
if Shortcutpos > 0 then begin
ShortcutVal:= ACaption[Shortcutpos];
end;
BitBtnImage:= BitBtnImages[AKind];
if BitBtnImage <> idButtonBase then begin
C := CreateBitmapFromLazarusResource(BitBtnResNames[BitBtnImage]);
try
Glyph.Assign(C);
finally
C.Free;
end;
end;
end;
end;
procedure TCDButton.Click;
var
Form : TCustomForm;
begin
Form := GetParentForm(Self);
{ First we mimic the TBitBtn behavior
A TBitBtn with Kind = bkClose should
- Close the ParentForm if ModalResult = mrNone.
It should not set ParentForm.ModalResult in this case
- Close a non-modal ParentForm if ModalResult in [mrNone, mrClose]
- In all other cases it should behave like any other TBitBtn
}
if (FKind = bkClose) then
begin
if (Form <> nil) then
begin
if (FModalResult = mrNone) or
((FModalResult = mrClose) and not (fsModal in Form.FormState)) then
begin
Form.Close;
Exit;
end;
end;
end;
if ModalResult <> mrNone
then begin
if Form <> nil then Form.ModalResult := ModalResult;
end;
inherited Click;
end;
function TCDButton.GetControlId: TCDControlID;
begin
Result := cidButton;

View File

@ -455,7 +455,9 @@ begin
end;
X.MotionNotify:
begin
TCDWSCustomForm.EvMouseMove(WindowEntry, CurWindowInfo, XEvent.xmotion);
repeat
until not XCheckTypedWindowEvent(FDisplay, XEvent.xmotion.window, X.MotionNotify, @XEvent);
TCDWSCustomForm.EvMouseMove(WindowEntry, CurWindowInfo, XEvent.xmotion);
end;
X.FocusIn:
begin
@ -499,7 +501,9 @@ begin
end;
X.ConfigureNotify:
begin
TCDWSCustomForm.EvConfigureNotify(WindowEntry, CurWindowInfo, XEvent.xconfigure);
repeat
until not XCheckTypedWindowEvent(FDisplay, XEvent.xconfigure.window, X.NotifyPointer, @XEvent);
TCDWSCustomForm.EvConfigureNotify(WindowEntry, CurWindowInfo, XEvent.xconfigure);
end;
X.ClientMessage:
begin

View File

@ -34,7 +34,8 @@ uses
SysUtils, Classes, types, ctypes,
{$ifdef CD_Windows}Windows, customdrawn_WinProc,{$endif}
{$ifdef CD_Cocoa}MacOSAll, CocoaAll, customdrawn_cocoaproc, CocoaUtils, CocoaGDIObjects,{$endif}
{$ifdef CD_X11}XShm, X, XLib, XUtil, XAtom, customdrawn_x11proc,{unitxft, Xft font support}{$endif}
{$ifdef CD_X11}XShm, X, XLib, XUtil, XAtom, customdrawn_x11proc,
{$ifdef CD_X11_UseATK}atk, {$endif} {unitxft, Xft font support}{$endif}
{$ifdef CD_Android}customdrawn_androidproc,{$endif}
// LazUtils
lazutf8sysutils,

View File

@ -1,15 +1,15 @@
unit lazdialogs;
{$mode delphi}
{$mode objfpc}{$H+}
interface
uses
// RTL
Classes, SysUtils,
Classes, SysUtils, math,
// LCL
Forms, ShellCtrls, Buttons, StdCtrls, ExtCtrls, FileCtrl, ComCtrls,
Dialogs, ButtonPanel, lclstrconsts, FileUtil, Controls;
Dialogs, ButtonPanel, LCLStrConsts, FileUtil, Controls;
type
TLazFileDialogKind = (
@ -71,8 +71,29 @@ type
procedure DoInitialize; override;
end;
{ TLazMessageDialog }
TLazMessageDialog = class(TForm)
private
Image1: TImage;
Label1: TStaticText;
btnList: array [0..11] of TBitBtn;
NumButtons: Integer;
public
constructor CreateNew(TheOwner: TComponent; Num: Integer = 0); override;
end;
function LazMessageDlg(const aCaption, aMsg: string; DlgType: TMsgDlgType;
Buttons: TMsgDlgButtons; HelpCtx: Longint): Integer;
function LazMessageDlg(const aMsg: string; DlgType: TMsgDlgType;
Buttons: TMsgDlgButtons; HelpCtx: Longint): Integer;
implementation
var
{ Declared here for the time being to make it possibly work with LCLCustodrawn}
LazMessageDialog: TLazMessageDialog;
{ TLazarusFileDialogForm }
procedure TLazarusFileDialogForm.SetFilter(AFilter: string);
@ -107,8 +128,8 @@ begin
ButtonPanel.Width := Width;
ButtonPanel.Align := alBottom;
ButtonPanel.ShowButtons := [pbOK, pbCancel];
ButtonPanel.OKButton.OnClick := HandleOkClick;
ButtonPanel.CancelButton.OnClick := HandleCancelClick;
ButtonPanel.OKButton.OnClick := @HandleOkClick;
ButtonPanel.CancelButton.OnClick := @HandleCancelClick;
if AKind in [ldkOpenDesktop, ldkSaveDesktop, ldkOpenPDA, ldkSavePDA] then
begin
@ -131,7 +152,7 @@ begin
ShellListView.Align := alClient;
ShellListView.ShellTreeView := ShellTreeView;
ShellListView.ScrollBars := ssVertical;
ShellListView.OnSelectItem := HandleSelectItem;
ShellListView.OnSelectItem := @HandleSelectItem;
// TEdit for save dialog
if AKind in [ldkSaveDesktop, ldkSavePDA] then
@ -144,7 +165,7 @@ begin
SaveEdit.Width := Width;
SaveEdit.Align := alBottom;
SaveEdit.Text := SysUtils.ExtractFileName(FileName);
SaveEdit.OnChange := HandleEditChange;
SaveEdit.OnChange := @HandleEditChange;
end;
// TFilterComboBox
@ -175,13 +196,13 @@ begin
ShellTreeView.Left := 0;
ShellTreeView.Top := 0;
ShellTreeView.Align := alClient;
ShellTreeView.OnSelectionChanged := HandleTreeViewSelectionChanged;
ShellTreeView.OnSelectionChanged := @HandleTreeViewSelectionChanged;
ButtonPanel.OKButton.Enabled := False;
end;
// Form events
OnCloseQuery := HandleCloseQuery;
OnCloseQuery := @HandleCloseQuery;
end;
// The Ok button code should be only a simple mrOk,
@ -305,6 +326,186 @@ procedure TLazSelectDirectoryDialog.DoInitialize;
begin
FForm.Initialize(ldkSelectDirectory);
end;
{ Dialog Functions }
function LazMessageDlg(const aCaption, aMsg: string; DlgType: TMsgDlgType;
Buttons: TMsgDlgButtons; HelpCtx: Longint): Integer;
Var
I: Integer;
textWidth: Integer;
ButtonPos: Integer;
RequiredWidth: Integer;
begin
{$ifdef LCLCustomdrawn} if not assigned(LazMessageDialog) then {$endif}
LazMessageDialog:= TLazMessageDialog.CreateNew(Application);
with LazMessageDialog do begin
Label1.Caption:= aMsg;
Label1.Parent:= LazMessageDialog;
{Select Image (and Caption) from DlgType}
case DlgType of
mtWarning: begin
Caption:= rsMtWarning;
image1.Picture.LoadFromLazarusResource('dialog_warning');
end;
mtError: begin
Caption:= rsMtError;
image1.Picture.LoadFromLazarusResource('dialog_error');
end;
mtConfirmation: begin
Caption:= rsMtConfirmation;
image1.Picture.LoadFromLazarusResource('dialog_confirmation');
end;
mtInformation: begin
Caption:= rsMtInformation;
image1.Picture.LoadFromLazarusResource('dialog_information');
end;
mtCustom: begin
Caption:= ApplicationName;
Image1.Width:= 8;
Image1.Hide;
end;
end;
Image1.Parent := LazMessageDialog;
if aCaption <> '' then //A custom dialog caption has been required
Caption:= aCaption;
Label1.Left:= Image1.Left + Image1.Width + 8;
{Select Buttons from Buttons}
if (Buttons = []) or (Buttons = [mbHelp]) then
Buttons:= Buttons + [mbOK]; // the dialog must provide a modal result
NumButtons:= 0;
{ The order of Buttons is the same as in Qt - Totally different from GTK2}
if mbHelp in Buttons then begin
btnList[NumButtons] := TBitBtn.Create(LazMessageDialog);
btnList[NumButtons].Parent := LazMessageDialog;
btnList[NumButtons].Kind:= bkHelp;
inc(NumButtons);
end;
if mbYes in Buttons then begin
btnList[NumButtons] := TBitBtn.Create(LazMessageDialog);
btnList[NumButtons].Parent := LazMessageDialog;
btnList[NumButtons].Kind:= bkYes;
inc(NumButtons);
end;
if mbYesToAll in Buttons then begin
btnList[NumButtons] := TBitBtn.Create(LazMessageDialog);
btnList[NumButtons].Parent := LazMessageDialog;
btnList[NumButtons].Kind:= bkYesToAll;
inc(NumButtons);
end;
if mbNo in Buttons then begin
btnList[NumButtons] := TBitBtn.Create(LazMessageDialog);
btnList[NumButtons].Parent := LazMessageDialog;
btnList[NumButtons].Kind:= bkNo;
inc(NumButtons);
end;
if mbNoToAll in Buttons then begin
btnList[NumButtons] := TBitBtn.Create(LazMessageDialog);
btnList[NumButtons].Parent := LazMessageDialog;
btnList[NumButtons].Kind:= bkNoToAll;
inc(NumButtons);
end;
if mbAll in Buttons then begin
btnList[NumButtons] := TBitBtn.Create(LazMessageDialog);
btnList[NumButtons].Parent := LazMessageDialog;
btnList[NumButtons].Kind:= bkAll;
inc(NumButtons);
end;
if mbOK in Buttons then begin
btnList[NumButtons] := TBitBtn.Create(LazMessageDialog);
btnList[NumButtons].Parent := LazMessageDialog;
btnList[NumButtons].Kind:= bkOK;
inc(NumButtons);
end;
if mbRetry in Buttons then begin
btnList[NumButtons] := TBitBtn.Create(LazMessageDialog);
btnList[NumButtons].Parent := LazMessageDialog;
btnList[NumButtons].Kind:= bkRetry;
inc(NumButtons);
end;
if mbIgnore in Buttons then begin
btnList[NumButtons] := TBitBtn.Create(LazMessageDialog);
btnList[NumButtons].Parent := LazMessageDialog;
btnList[NumButtons].Kind:= bkIgnore;
inc(NumButtons);
end;
if mbCancel in Buttons then begin
btnList[NumButtons] := TBitBtn.Create(LazMessageDialog);
btnList[NumButtons].Parent := LazMessageDialog;
btnList[NumButtons].Kind:= bkCancel;
inc(NumButtons);
end;
if mbAbort in Buttons then begin
btnList[NumButtons] := TBitBtn.Create(LazMessageDialog);
btnList[NumButtons].Parent := LazMessageDialog;
btnList[NumButtons].Kind:= bkAbort;
inc(NumButtons);
end;
if mbClose in Buttons then begin
btnList[NumButtons] := TBitBtn.Create(LazMessageDialog);
btnList[NumButtons].Parent := LazMessageDialog;
btnList[NumButtons].Kind:= bkClose;
inc(NumButtons);
end;
ButtonPos:= Image1.Left;
for I:= 0 to NumButtons -1 do begin
btnList[I].Constraints.MinHeight:= 25;
btnList[I].Constraints.MinWidth:= 75;
//btnList[I].DefaultCaption:= True;
//btnList[I].AutoSize:= True;
btnList[I].Left:= ButtonPos;
btnList[I].Top:= Image1.Top + Image1.Height + 10;
// next line is required until Autosize is implemented
{btnList[I].Width:= label1.Canvas.TextExtent(btnList[I].Caption).cx
+ btnList[I].Glyph.Width + 16;}
btnList[I].AutoSize := True;
btnList[I].Visible:= True;
//Application.ProcessMessages; currently not required. It may become
//necessary if Autosize is set, and width computed automagically. Maybe
//outside the loop (run just once)
ButtonPos:= ButtonPos + btnList[I].Width + 8;
end;
//textWidth:= label1.Canvas.TextExtent(Label1.Caption).cx;
//Label1.Width:= textWidth;
label1.AutoSize := True;
textWidth:= label1.Left + label1.Width;
RequiredWidth:= Max(textWidth,ButtonPos);
Width := RequiredWidth + 10;
Height:= btnList[0].Top + btnList[0].Height + 10;
end;
result := LazMessageDialog.ShowModal;
{$ifndef LCLCustomdrawn}LazMessageDialog.Release;{$endif}
end;
function LazMessageDlg(const aMsg: string; DlgType: TMsgDlgType;
Buttons: TMsgDlgButtons; HelpCtx: Longint): Integer;
begin
result := LazMessageDlg('',aMsg,DlgType,Buttons,HelpCtx);
end;
{ TLazMessageDialog }
constructor TLazMessageDialog.CreateNew(TheOwner: TComponent; Num: Integer = 0);
begin
inherited CreateNew(TheOwner);
FormStyle:= fsStayOnTop;
Position:= poMainFormCenter;
Image1 := TImage.Create(Self);
Image1.Top:= 10;
Image1.Left:= 10;
Image1.Width:= 48;
Image1.Height:= 48;
Label1 := TStaticText.Create(Self);
Label1.Top:= Image1.Top;
Label1.Left:= Image1.Left + Image1.Width + 10;
Label1.Caption:= 'Label1';
Width:= Image1.Width + Label1.Width + 20;
Height:= Image1.Height + 20;
end;
end.