diff --git a/components/exctrls/examples/ImageListEx/ImgListEx_Demo.lpi b/components/exctrls/examples/ImageListEx/ImgListEx_Demo.lpi new file mode 100644 index 000000000..1d186b008 --- /dev/null +++ b/components/exctrls/examples/ImageListEx/ImgListEx_Demo.lpi @@ -0,0 +1,83 @@ + + + + + + + + + <Scaled Value="True"/> + <ResourceType Value="res"/> + <UseXPManifest Value="True"/> + <XPManifest> + <DpiAware Value="True"/> + </XPManifest> + <Icon Value="0"/> + </General> + <BuildModes> + <Item Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <UseFileFilters Value="True"/> + </PublishOptions> + <RunParams> + <FormatVersion Value="2"/> + </RunParams> + <RequiredPackages> + <Item> + <PackageName Value="ExCtrlsPkg"/> + </Item> + <Item> + <PackageName Value="LCL"/> + </Item> + </RequiredPackages> + <Units> + <Unit> + <Filename Value="ImgListEx_Demo.lpr"/> + <IsPartOfProject Value="True"/> + </Unit> + <Unit> + <Filename Value="main.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="MainForm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + </Unit> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <Target> + <Filename Value="ImgListEx_Demo"/> + </Target> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <Linking> + <Debugging> + <DebugInfoType Value="dsDwarf3"/> + </Debugging> + <Options> + <Win32> + <GraphicApplication Value="True"/> + </Win32> + </Options> + </Linking> + </CompilerOptions> + <Debugging> + <Exceptions> + <Item> + <Name Value="EAbort"/> + </Item> + <Item> + <Name Value="ECodetoolError"/> + </Item> + <Item> + <Name Value="EFOpenError"/> + </Item> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/components/exctrls/examples/ImageListEx/ImgListEx_Demo.lpr b/components/exctrls/examples/ImageListEx/ImgListEx_Demo.lpr new file mode 100644 index 000000000..87fd6f44e --- /dev/null +++ b/components/exctrls/examples/ImageListEx/ImgListEx_Demo.lpr @@ -0,0 +1,25 @@ +program ImgListEx_Demo; + +{$mode objfpc}{$H+} + +uses + {$IFDEF UNIX} + cthreads, + {$ENDIF} + {$IFDEF HASAMIGA} + athreads, + {$ENDIF} + Interfaces, // this includes the LCL widgetset + Forms, main + { you can add units after this }; + +{$R *.res} + +begin + RequireDerivedFormResource:=True; + Application.Scaled:=True; + Application.Initialize; + Application.CreateForm(TMainForm, MainForm); + Application.Run; +end. + diff --git a/components/exctrls/examples/ImageListEx/main.lfm b/components/exctrls/examples/ImageListEx/main.lfm new file mode 100644 index 000000000..11b32a13e --- /dev/null +++ b/components/exctrls/examples/ImageListEx/main.lfm @@ -0,0 +1,410 @@ +object MainForm: TMainForm + Left = 331 + Height = 135 + Top = 132 + Width = 488 + Caption = 'ImgListEx Demo' + ClientHeight = 135 + ClientWidth = 488 + OnCreate = FormCreate + LCLVersion = '2.3.0.0' + object ToolBar0: TToolBar + Left = 0 + Height = 30 + Top = 0 + Width = 488 + AutoSize = True + ButtonHeight = 28 + ButtonWidth = 28 + Caption = 'ToolBar0' + Images = ImageList1 + TabOrder = 0 + object ToolButton1: TToolButton + Left = 201 + Top = 2 + Caption = 'ToolButton1' + ImageIndex = 0 + end + object ToolButton2: TToolButton + Left = 229 + Top = 2 + Caption = 'ToolButton2' + ImageIndex = 1 + end + object ToolButton3: TToolButton + Left = 257 + Height = 28 + Top = 2 + Caption = 'ToolButton3' + Style = tbsDivider + end + object ToolButton4: TToolButton + Left = 262 + Top = 2 + Caption = 'ToolButton4' + ImageIndex = 2 + end + object ToolButton5: TToolButton + Left = 290 + Top = 2 + Caption = 'ToolButton5' + ImageIndex = 3 + end + object ToolButton6: TToolButton + Left = 318 + Top = 2 + Caption = 'ToolButton6' + ImageIndex = 4 + end + object ToolButton7: TToolButton + Left = 346 + Height = 28 + Top = 2 + Caption = 'ToolButton7' + Style = tbsDivider + end + object ToolButton8: TToolButton + Left = 351 + Top = 2 + Caption = 'ToolButton8' + ImageIndex = 5 + end + object Label1: TLabel + Left = 1 + Height = 15 + Top = 2 + Width = 200 + Caption = ' Normal' + Constraints.MinWidth = 200 + end + end + object ToolBar1: TToolBar + Left = 0 + Height = 30 + Top = 30 + Width = 488 + AutoSize = True + ButtonHeight = 28 + ButtonWidth = 28 + Caption = 'ToolBar1' + Images = ImageList1 + TabOrder = 1 + object ToolButton11: TToolButton + Left = 201 + Top = 2 + Caption = 'ToolButton1' + ImageIndex = 0 + end + object ToolButton12: TToolButton + Left = 229 + Top = 2 + Caption = 'ToolButton2' + ImageIndex = 1 + end + object ToolButton13: TToolButton + Left = 257 + Height = 28 + Top = 2 + Caption = 'ToolButton3' + Style = tbsDivider + end + object ToolButton14: TToolButton + Left = 262 + Top = 2 + Caption = 'ToolButton4' + ImageIndex = 2 + end + object ToolButton15: TToolButton + Left = 290 + Top = 2 + Caption = 'ToolButton5' + ImageIndex = 3 + end + object ToolButton16: TToolButton + Left = 318 + Top = 2 + Caption = 'ToolButton6' + ImageIndex = 4 + end + object ToolButton17: TToolButton + Left = 346 + Height = 28 + Top = 2 + Caption = 'ToolButton7' + Style = tbsDivider + end + object ToolButton18: TToolButton + Left = 351 + Top = 2 + Caption = 'ToolButton8' + ImageIndex = 5 + end + object Label2: TLabel + Left = 1 + Height = 15 + Top = 2 + Width = 200 + Caption = ' CreateDisabledImages ' + Constraints.MinWidth = 200 + end + end + object ToolBar2: TToolBar + Left = 0 + Top = 60 + Width = 488 + AutoSize = True + ButtonHeight = 28 + ButtonWidth = 28 + Caption = 'ToolBar2' + EdgeBorders = [ebTop, ebBottom] + TabOrder = 2 + object ToolButton21: TToolButton + Left = 201 + Top = 2 + Caption = 'ToolButton1' + ImageIndex = 0 + end + object ToolButton22: TToolButton + Left = 229 + Top = 2 + Caption = 'ToolButton2' + ImageIndex = 1 + end + object ToolButton23: TToolButton + Left = 257 + Height = 28 + Top = 2 + Caption = 'ToolButton3' + Style = tbsDivider + end + object ToolButton24: TToolButton + Left = 262 + Top = 2 + Caption = 'ToolButton4' + ImageIndex = 2 + end + object ToolButton25: TToolButton + Left = 290 + Top = 2 + Caption = 'ToolButton5' + ImageIndex = 3 + end + object ToolButton26: TToolButton + Left = 318 + Top = 2 + Caption = 'ToolButton6' + ImageIndex = 4 + end + object ToolButton27: TToolButton + Left = 346 + Height = 28 + Top = 2 + Caption = 'ToolButton7' + Style = tbsDivider + end + object ToolButton28: TToolButton + Left = 351 + Top = 2 + Caption = 'ToolButton8' + ImageIndex = 5 + end + object Label3: TLabel + Left = 1 + Height = 15 + Top = 2 + Width = 200 + Caption = ' Recolored ImageList' + Constraints.MinWidth = 200 + end + object ColorButton1: TColorButton + Left = 379 + Height = 28 + Top = 2 + Width = 101 + BorderWidth = 2 + ButtonColorAutoSize = False + ButtonColorSize = 16 + ButtonColor = 4227327 + Caption = 'New Color' + OnColorChanged = ColorButton1ColorChanged + end + end + object CheckBox1: TCheckBox + Left = 8 + Height = 19 + Top = 96 + Width = 104 + Caption = 'Buttons enabled' + Checked = True + OnChange = CheckBox1Change + State = cbChecked + TabOrder = 3 + end + object ImageList1: TImageList + Scaled = True + Left = 424 + Top = 8 + Bitmap = { + 4C7A060000001000000010000000E70300000000000078DAED584B6B1441102E + 5FD19BF8BA880741F4A288822082E00B0F4645898A0A3E0E8AA20703C6C7FAC2 + FC030F2A28060425666766A32B181F880405E36A82B099EC6E44456F2A1E1695 + 4840CDF855DBB30EB33DBBDDB360503C14DDD35D5F55754D7575757B9E47DE30 + 53CEA1D37D360D823C49833CA68B17FC364D2CC9431F63C5803C15150378CFD4 + E620A6163CDA8F55ECAC448C7D9D4FD14C53FD8524CD02F615E86EDEA27A53BC + 6BD36A60EFF439740EFDC618F846E0CFFAADB1FFA45EDF8E18FE17EBF6FD1003 + 2FFCDE7391C668C49A32FE183BDC7B2FA6EDEDD86375AAD80F7F17DA68BA6B51 + 33B73CC738B46996A183771D5ACA637E2BF7775D60FF18E343FBCFC87E0D7CD1 + 24E7C4C91D2ABCC17F2C46E0BD987AFFE387175F8C797614953A9A6924E753EC + B1E5259D162D133916731A797D25B049F03B019B1D908D337D8506FE30E765B4 + 1DFD6D349589FBD8BF6B806FD23817F6837F33F81B60F72926D9DF8AF17DD5F0 + F924CD01EFA5CE4E1ADD6B538689FB58534B2E45B335FFD1831E9BC643CEF95C + 925AB80FDD0F0DCEB61DD07730DB4ED320EB26F2CF21D0365DBC3C931EB3DD90 + 95CE3BD4EDE76B83FCE2C0E65DF0F92690658265FDF079376CEE62BDA02E9DB3 + 0EFCC7A1F73DE82D745E80FFCE60EC40CE421F633C075989881A722FE63FC1E6 + EDA0FB725F6430FE08ED67F8E01EFB95FB68772BD6DB07DE6352D63A7C7F7353 + 34D74DD20CE8FC0E5BD6FA3642BE5BA6DFA6AF251E9B4E047914B2BF28E2FE09 + E80664ECE479F67D40F61E6937DB9F667F96E94FD17CCC6541EFC07744615F42 + FA368BFEBC6A39A602A5ABC552542E13E730D6C8FBF9E56D1A1B071FA81FD271 + F041AA65BD3AF57FA5F5EAE2A3D6AB8B57AD37CEFDE55FC057FAFFA6FA75E7FE + 145E87347464439821C45F7F95F3BAA3928EE01CF39AEE23C379BECF0E8574BA + BAF838FF206EFD5EE37F1DE0FB4CDCB8C23F5D8CB90F5CE3E9E0557124EF5303 + B5C475B5B88CD21F1EFF9BF5E31FDCAA243F6EECE8E6856AEF7226EF704CA897 + 97F86F7190DFC9E4BFC9F15CA42EAE131DBA2AEC420D1FC6F398F4D715552D89 + B956DEFB5C9FD9368D0AE3790C324E8A9C063DA1378206293B119259C2876A54 + 0F7794F501BE0C2817BE1FA9F0C20E9B0A5C9FF3F78B6B3459E6D984624D6578 + BFBEC4F88FDE569A80BA6FA1B4A75E718FD8C254368E3A55E4C6142DF0F1F0C9 + 2AEDB73BDCC57C7CE13A4D1239D7A2A3DAEFBDBF6AD1A1409C64449ED6B85F4A + FFE5B85E0EC8DB28ECC13D495337BF0735FC1EA711F8B6D8A77CFF54D921F462 + 8DCCC3B1169E7F7399C64919E2CC6139EC5326AEC7D96611DB16B555AA7DF9BE + 05BE67A1738CFB4F81DDA0EBE3E7364DC17E5BC4C4FD28BE9F7365247B + } + BitmapAdv = { + 4C69020000004C7A060000001800000018000000190700000000000078DAED9A + 596C954514C70F2E448D1B98B83D206A341A12B707E342401323C628AE215171 + 4934516222C495982835B16AB4119707C30371A185FB7DF7D2B248DDC0AB5217 + 4C6DE9BDED2D855414976240A1D4170AF57AFE5FCFDC4EEFFDD6F9BE5B7DB80F + 277732DFDCDFCC9C393373E6CC148B452AD6C457B6ADA233BB6D5ACB32C452D4 + 64386F533E9FA6EBE3F0853DD86DD1D2EE34BD324E6CEA64D9B7A3914E8CC11F + CA5BD4E0FACDA239657D0A2BFD1ABFC8FC3A37FECE77E918FEF66C45BFFCC4A6 + 3630C3F04D04AC89E2434F86FA0D35062C7FB1FCD493A67722E9D8471C163385 + 5D60FBB6929E53CCB5597A583EE739F46515F85FB16CE2FEACE4DFBE2AF0B7B3 + 34397396E76E15F807B8EDAFF7D8B41863DDBE9E8E4B8AFD8D4DC73AF663D133 + CC7F00E92E9BCE4E8A9F5B4DE708FF7EE6DF8074CEA62B139B5F69BA4AF87398 + 7F89337F6DBA2D41FEED0E3F451733FF74996B19E82B11018B9960DB361DC9E9 + 5D55581B76815DDBBF03E75992EB7396C7F4F8327ED1D9CF2AF7B843FC9B0DB1 + 1E675196F794B79CFFD8B459AFC36BEFF2CACFA7E85C677FB2E8B9F2BD8AB977 + 4A1D9B8CF9EC0B29DFC86DAF851F1266EF8DC1AFFB5FF37DF41F996FD367416B + 8D53C68CDF6FE20B4EA46F35D1FC986B457F08BEFB5A11C15F0EE29BE84A67D6 + F8357E8D5FC657EB30EF192CAD06FE60ABF35F97F5BA4AE7C7FE30FD16DFB70F + 3EBC47DCA037BF924E335D6BF99CB902B10DEEF3860A9D731EBE713DEF1BB16D + 9A8C3354C1A21BF9F760EF2A9AAEBE218D3CDEEB6FC2D9AD7D191D6DC0C7B963 + 1F2727715B5BB82FF55ABFEA91876FE0E7337451649BE3FFE0FC2D75E10CB51B + 7D425B39FD1BF42FF631D893A11951F985D57406F30E77B6D0C9C53A3A0236C1 + B63D0FE2D807E7E59A680ACAC00E0C7DEB6EF894D287C5CE799CCFFBB073994B + F3383F1763AF7E89FFDF8C7457339D8A3185202D7536A38C299F7574966327EC + B3497F36F2D87EA79D710FA24CDC3808B7F30D8769D36CD814CEFA5CCF9B49C4 + 5D70EEC63C68B7E9A4D29858F408ECA690A22B12F1996CFA96FBF0B8A4174AEC + E8FB047DB2C7983790CDD251B057B69F61D6CF13099E019731EF006221327F97 + 230696041B6735E83A97A2E739FDAB33B6365D8E98AC514C1773354D0F61DE30 + E30F962D6C2739E4B3EEBB589E129DE531062883B29CFF20CA84D075833AFFB0 + EC91FD6D7F3BAF179CFE13EDE63198CECCFD526E8F942DB2CE5EF3D5B345D7AA + D8442143E7C91ADD29791D98AFDCB7F7242EA8F226A32CA77F71DA92A66B7CEC + B045DA714BA9CE343D2D2CAC9F53B7ADA513F8FBEFE20B3C599AEB16DD2A3199 + 661F3B419C661876A8ADF54B2456B448AB7391B46389CAC37FE46CFDB35F9C1E + 827D6334CFD93FB6AA5854A91CA7A54F9DE3ECC2A6BFFD6291FCED6BE9E35C89 + 3BBDACE2162E76FB85F4A11E65957E107FF0B1F5B9C23FCCBF7B95DEB1567AC4 + 08774B99BDF21FC4F46E0E586BEEE5723B5876F2F835FAC52DA58E2694C57FB8 + FC7C83B521D09FE2B6E771CF61B8F6F89FF946BFFFC3F2B1491D413EAF7CCF88 + FE3F895A47487E9DC49947A2D611860F5B15BF7C8DE8AA2B49BE9B54CB4ECACF + 1749DB891F3F093B89C90FB49338FC307612871FC64E4CF9613935FEC4F283E2 + ADB1F911D69F24F463BA4ED6F8E1E2F1417612C70F09632721FBDEE8C11B198D + 6BC43E6F79DD89B5456D33CE812EEF72DCEF5EDCE7D4903ABB7AB475B0A2AD41 + FCCA3E0D46B14B89638C788CC140143B75E3B32F3FCBCB8FC0B7B8FC38F72D49 + F3B93FD7A15FD5E227B9EE849CD303B90C5D1083DF16709734A0D711951F54B6 + 3745E73BF14BC4253234C3948FDF0A91D800DAAEFA61CA77D3BDCED1D79224F5 + 9314DF553F2249F083F69C9A7E42EB6730C86FE0FD69A6A97EB0B7B9ED8F6E76 + 6DC28FBC1686F491A2FA47A63E5294B82BEBF203489838AA419C789A16279816 + 8F4793F0F60EEF6E555BE5CECBE197EEC21033C6DB5C2E3B16730CB84F68A229 + CCF848B10A29BACC8B8F6F9AAE5B9DBB267F1D4CE571FFA1A487342D576FD8DC + F8F886329ADEDAD13E4F9DD8B4BE14DBB6E8AE71FB929B7EC67CCC7B548C1B6F + B5DD74A5DE514A3BEEAED8F77CF8329FE6977495A6FBF46FB8F363E68FA29315 + AEFB6A005FE2D22BD5FDAF1EC3566F9E10DB718BD586E5E39E4CF9ADF0BBB479 + F9B6CC7DCF77BE61F8C2DA2CE7EEA55A5E56DAFFA227BF994E91F8FB21A43DF9 + CABFE7F547E3F78AEE1F0EF0356795FBCF2EF1EB05D2CF1E8DDF23752E88ED6F + 5AF4A8F0BB35FE46D1CFAB09DCC53508EBD3F23CDC0326719728FB5083768739 + 5BC53775DF37323B45174ADCAF386E9C46EF4EB64B1D6B62F8FAEB84D157BE46 + F0B8DC519ADF3C468677A045BFB7CEDAFC1E41F9083A5FA8E62DCEFE5EE57077 + 29EFEA553B36E01D84E77A9EA14BF5BD02F157BC3D0F7C9B3ED60F251D78FF8A + B33E44DEC2769495698A72AF803B42C47F43F8085B83EEA402F6B499CC7841DE + B3E03E760BE77D883CE65EFD5FBF7FFE17F89EECD64C7A060000002000000020 + 000000690800000000000078DAED5C698C1455102E34E22DDEE091683C31266A + 3C8846D4A089FAC31F468D685430205163040C6822318AC18822A0880644C325 + 2E333DB38B04252A47242BB0C0C2C2DEC80F8E75D7004230846B6159AB7AAAC7 + DADEEE9DD7DDEFF56497FE51999EEED7EFAB57AFAADE55D5EDEDEDD09ED0294F + 9605A7D766E0BD5A0B7621B5FBD02E2A436575E33376BB126159EDF84EBBD3F0 + 986F197CE6C8C100BEDD36D57211A93C027EB90E1EC2E29B92F3A98AAFAB3FC3 + EA619D05078A85CFD855F6FF14DC1397AF45DC01CCC326A452BAAEB160705CF8 + E83F9F63FC6C5D063EB365918177E3C2AF49C33896FF246CF7EBEC77BF8D51FE + DFD9324FC36BC2A7AF884DFE16ACB4F133F0687D166E64FCED31E2EF60F9DF50 + F90D9C81BF27987A9BC6F6C293FC98C6F792B7EC0FE3B2F7D037A98FC66DCFC3 + DEA43D1AB73D0F7F23FD510CBADFC9DF4A7F1C037EA7F1666B095C1AF7D84798 + 26E67561E79F091587E2EA77B4B1CA2D6570B9A1F58C12A1CDD7B8792834EF0E + 3B2F97EF6DB2E0326C7F35DF6BA82F852B74E2A3FF1E9F6F235E7BBD47EDA6F6 + F3FDF571E33B3C78AC3F62C3F759FF24F8DD1C3FCA3A5B15DFD43E87027EB9C9 + 7D9EB8F61DBA0BBEA1F1B03C00BE91B12F287E8CF24EF013FC043FC14FF013FC + A2E1C74D453E7F09BCFF526DC15DB886DD539381277CD701F88CCAD4A7E04E9D + 73B62DF3E15CE47927F3BEB2D0BE3AEDED562E817334EE998EE27A69EFF0E416 + 0B6EEEC423DEA367587611EFAFBEA1117F15D6B981D7CFC76A3330D5E34C672A + 3DE332555DC929840DEDC7FABFE2FDEB85F87FDF1A0BCE769ED335DDA3675CE6 + 6BFAAF11BF0DE943D6C38758BE43C59EFA50BA47CF783FF723FC7F5CE379D181 + BA0C4CCBFD875E58773DF6C95AF17C0DDDA367CCEF749DEDA7BD33AC6FB95B1F + F1FE1DB529B89DF7B646B9EC60BD46FC2FB0BE436487761FFC0017D17F94C90C + 22BAA67B5CF63CA4C3786F8AC6338307786FE145B1E7301BFBFD20DE3F48D742 + 362FB17EDCAFCF07412F6C5323F5B3C79901F5C30021FB0D5217349E998EB465 + 9085BB05D6566CE75EB79CF0F755DDEBE6C6C5703ED6FDAF9435E1101EFAFB7B + 592665A4F73A7DAFEBEC8CFCCA11670F97748D7842DF34B761215C4B678A5866 + 82A9BD83EA52B8CE8D413C91BED7A56126F2D2BAD982AB6238BFDA476DB7F522 + 0BB7B1BE1F419A1757EC02F6FD9BE25E2D525B7DA9DE71DF470706B1BFDBBD6D + 299CE9B2F941C6CF4F3390B6752E1787369AEE111F34EF414A19C52E81BE34C6 + A30D4EC6DF5F91F6565AD087F5620AE95FE342B852E3BC83E4BA0EE9285233E2 + FE41739C8614DCC4E34E1B8DB576D9145C4FCF90A84C33BF53217D76107F4BE7 + D39EE74819384CF2E6F38C26B23DD4BB6BB6CF81B36C1BF09AEFDA67DDEAFE18 + 313E10BEBD91E61E3CC63B75D2FF943D17A3F1C78265A80B13C4F3D55406E94F + 51CFFB2AD8E43FA81F9D731A67CCA53916D6D1C2BA7F80C7C37188FB0A973DC8 + 38CD240BC73F62D98DFCFC988A6E60B9895CFE647516FABB6C6F9E384B5B948B + 03C5B13103DF8BD8CCB91D6499855B592F88DF8F15F02BB8FE551E63E04C7E76 + 58CE3FA9BDA417AC1F337CE6CFC45F8502FEEE30F5A8F08DF4B702FE3F61E428 + FB0D6DF11697CF9ECFBAB147C1BFFFC6F5343932E6B17F53577AE4D2DB0DCEF8 + 447301BCFE8BEFFF1260AD45B25C4B632D5E6F53B12369B7B6EDE5DEAD106753 + 230BE1936FB171BDE38E6729C4D6CDF25973AF568DAF229B671FDF6CCFB3C9F7 + A4E1F900FEEB05F65787A80E8AB971FC48D47D14453AA97B0E1A628FA34DAE11 + 8B149FAD8D87A0F828FF31791E3230246E7CF67B63D9664F44E5210CBE9B079A + CFC48DCF3EEDEDA83CE8CA0F201E8A9D9F502C1F63E0AC3F907DEB8A7508CB83 + 6EFCA03E46377E501F63023F888F3185AFEA630CE99FB28F890BDFAF0E53B146 + AA7524F8F1E147197F7A027EDCEF26F8097E4FC13791DFDA1DF05D7B565FF2FE + 66212CDAF3996EE09CA335C83C3CC279C6E3F99C9C1072EC82A7CD54B7C2FB4D + 51FAB1805C7685B5972873D11EF27E5B00FD6BD58D1FC0FE8ED1F9BC6EFC62EC + 17F524FC38C7BC62E0871C973AE43E1501BF530E98EEFC123FF2CB018B0BDF8F + 075DF8AAF311998726F2D162C377E7A1C529FFAEF4B7BBE387CD43E929F849FF + 27FDDF4DFBBF49471E5968FCDCF730AA8A851FE379B4D6757AB1F1EDD8225CA3 + 1039B11E7192130FAB1AD76100BF53CEB3A16F350DC179D2CFF5697852159FCA + D23B51CEDCE9FB20F95C861CED57C5B7F305FE3F0B2A6B28834B02EA563F7CB7 + CE356F5FA68A6FC7E375D4738A4FEDA7887DB11D57DDF19C799A8C372B846FC7 + EAE13B4EBC961347E8C4C87719F768C18F726D8FFEF1E9B0FA8798CFC87D34EA + 8B02B157C365BB6B32F05454FD671EA41C5EF68BBB92DF9EA4F8275DF68732FC + 5CB46B87571C9688A3246A71F777147C8A81A3D83FA1CBC33DFCF9721167365A + B7FF4119BCE5674BACF3C7F3E7C725D057373EAF359D3DB5D6AA4570A1F0570F + 0AD9AF0B1CA38BD78AF1CC1B851E0E14B21921F0E728E23F92FF8E195E2B8E19 + 0B84CC8609DD7B47E04F54CE47C8427F778C6E011DF854E08F75C72FB0EE7D62 + 70CC9CECA5E34E1E09F335DB60EEC03C31EF1C21F47FA0B08D8DC6BFFD95CB55 + BB2FEF1F2CE8236CE3B88AFD8598AFF5736C9CB0B62D800B5CBCAD08E27F42E4 + 708D113ABEDC43378689E7CD51E355DD73D55A8E9D77E70EBA7C7493F00F938C + E8BD053BFDC6169AAFC9F1D76FEC0F88FDAC1C7FBBCCC7180FA76199258287A3 + F47E84FC91C1AE338CC585F230D816B676886FB3604A909C323B5F3837E6CB33 + 9C06B7CEFBBE5F0A57D39CD17D96463156EEEFE6B9F757D99737B9E2A1AA83E6 + E5708EE552CF9843F22319984B71DDB66EE135FB96368F58AC9FE4581B3207A8 + 25C4DAB285E2D035D96F6F5E07AD2A7026466761BF13CFA6BE654ABA45E33DF9 + 10F269B65F43DE10EF6153798F26E93FCAE766D5 + } + end +end diff --git a/components/exctrls/examples/ImageListEx/main.pas b/components/exctrls/examples/ImageListEx/main.pas new file mode 100644 index 000000000..731391775 --- /dev/null +++ b/components/exctrls/examples/ImageListEx/main.pas @@ -0,0 +1,110 @@ +unit main; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ComCtrls, ExtCtrls, + StdCtrls, + ExImgList; + +type + + { TMainForm } + + TMainForm = class(TForm) + CheckBox1: TCheckBox; + ColorButton1: TColorButton; + ImageList1: TImageList; + Label1: TLabel; + Label2: TLabel; + Label3: TLabel; + ToolBar0: TToolBar; + ToolBar1: TToolBar; + ToolBar2: TToolBar; + ToolButton1: TToolButton; + ToolButton11: TToolButton; + ToolButton12: TToolButton; + ToolButton13: TToolButton; + ToolButton14: TToolButton; + ToolButton15: TToolButton; + ToolButton16: TToolButton; + ToolButton17: TToolButton; + ToolButton18: TToolButton; + ToolButton2: TToolButton; + ToolButton21: TToolButton; + ToolButton22: TToolButton; + ToolButton23: TToolButton; + ToolButton24: TToolButton; + ToolButton25: TToolButton; + ToolButton26: TToolButton; + ToolButton27: TToolButton; + ToolButton28: TToolButton; + ToolButton3: TToolButton; + ToolButton4: TToolButton; + ToolButton5: TToolButton; + ToolButton6: TToolButton; + ToolButton7: TToolButton; + ToolButton8: TToolButton; + procedure CheckBox1Change(Sender: TObject); + procedure ColorButton1ColorChanged(Sender: TObject); + procedure FormCreate(Sender: TObject); + private + FImageList1: TImageList; + FImageList2: TImageList; + + public + + end; + +var + MainForm: TMainForm; + +implementation + +{$R *.lfm} + +uses + ImgList; + +{ TMainForm } + +procedure TMainForm.CheckBox1Change(Sender: TObject); +var + i: Integer; +begin + for i := 0 to ToolBar0.ButtonCount - 1 do + begin + ToolBar0.Buttons[i].Enabled := Checkbox1.Checked; + ToolBar1.Buttons[i].Enabled := Checkbox1.Checked; + ToolBar2.Buttons[i].Enabled := Checkbox1.Checked; + end; +end; + +procedure TMainForm.ColorButton1ColorChanged(Sender: TObject); +begin + SetImageListColor(FImageList2, ColorButton1.ButtonColor); + Toolbar2.Invalidate; +end; + +procedure TMainForm.FormCreate(Sender: TObject); +begin + // Toolbar0 uses for Images the image list populated at designtime, and + // no dedicated imagelist for DisabledImages, i.e. it creates the disabled + // icons by the built-in routines. + + // Toolbar1 uses for Images the image list populated at designtime, + // and for DisabledImages the one created by CreateDisabledImageList. + FImageList1 := CreateDisabledImageList(ImageList1, self); + Toolbar1.DisabledImages := FImageList1; + + // Toolbar2 uses for Images a recolored copy of the image list populated at + // designtime, and for DisabledImages the same one as Toolbar1 + FImageList2 := CreateRecoloredImageList(ImageList1, ColorButton1.ButtonColor, self); + Toolbar2.Images := FImageList2; + Toolbar2.DisabledImages := FImageList1; +end; + +end. + diff --git a/components/exctrls/exctrlspkg.lpk b/components/exctrls/exctrlspkg.lpk index 18596ec56..c03d408fe 100644 --- a/components/exctrls/exctrlspkg.lpk +++ b/components/exctrls/exctrlspkg.lpk @@ -18,7 +18,7 @@ - TRadioButton, TCheckbox, TRadioGroup and TCheckGroup: drawn by ThemeServices/Canvas, not by widgetset, button/text layout, wordwrap, user-provided check images - TColumnComboBoxEx"/> <License Value="LGPL with linking exception (like Lazarus LCL)."/> - <Files Count="7"> + <Files Count="8"> <Item1> <Filename Value="source\excheckctrls.pas"/> <UnitName Value="ExCheckCtrls"/> @@ -47,6 +47,10 @@ <Filename Value="source\exshape.pas"/> <UnitName Value="ExShape"/> </Item7> + <Item8> + <Filename Value="source\eximglist.pas"/> + <UnitName Value="ExImgList"/> + </Item8> </Files> <CompatibilityMode Value="True"/> <LazDoc Paths="fpdoc"/> diff --git a/components/exctrls/exctrlspkg.pas b/components/exctrls/exctrlspkg.pas index 6d2ab2940..4e3a8e6f3 100644 --- a/components/exctrls/exctrlspkg.pas +++ b/components/exctrls/exctrlspkg.pas @@ -9,7 +9,7 @@ interface uses ExCheckCtrls, ExEditCtrls, ExButtons, ExCombo, ExCheckCombo, ExQuestionDlg, - ExShape; + ExShape, ExImgList; implementation diff --git a/components/exctrls/exctrlspkg_dsgn.lpk b/components/exctrls/exctrlspkg_dsgn.lpk index 318d3eb73..e814495e7 100644 --- a/components/exctrls/exctrlspkg_dsgn.lpk +++ b/components/exctrls/exctrlspkg_dsgn.lpk @@ -2,7 +2,7 @@ <CONFIG> <Package Version="5"> <PathDelim Value="\"/> - <Name Value="exctrlspkg_dsgn"/> + <Name Value="ExCtrlsPkg_dsgn"/> <Type Value="DesignTime"/> <Author Value="Lazarus team"/> <CompilerOptions> diff --git a/components/exctrls/source/exctrlsreg.pas b/components/exctrls/source/exctrlsreg.pas index e31a895ad..2e8513011 100644 --- a/components/exctrls/source/exctrlsreg.pas +++ b/components/exctrls/source/exctrlsreg.pas @@ -22,7 +22,7 @@ implementation {$R exctrlsreg.res} uses - ExButtons, ExCheckCtrls, ExEditCtrls, ExCombo, ExCheckCombo, ExShape; //, ExImgList; + ExButtons, ExCheckCtrls, ExEditCtrls, ExCombo, ExCheckCombo, ExShape; function TFloatSIPropertyEditor.GetValue: ansistring; begin diff --git a/components/exctrls/source/eximglist.pas b/components/exctrls/source/eximglist.pas new file mode 100644 index 000000000..8e311cd8f --- /dev/null +++ b/components/exctrls/source/eximglist.pas @@ -0,0 +1,171 @@ +unit ExImgList; + +{$mode objfpc}{$H+} + +interface + +uses + LCLVersion, Classes, SysUtils, Graphics, GraphUtil, Controls, ImgList; + +{$IF LCL_FullVersion < 2030000} +procedure BitmapGrayscale(ABitmap: TCustomBitmap; RedFilter, GreenFilter, BlueFilter: Single); +{$IFEND} + +function CreateDisabledImageList(AImageList: TCustomImageList; AOwner: TComponent): TImageList; + +function CreateRecoloredImageList(AImageList: TCustomImageList; ANewColor: TColor; + AOwner: TComponent): TImageList; +procedure SetImageListColor(AImageList: TCustomImageList; ANewColor: TColor); + +implementation + +uses + fpImage, fpCanvas, IntfGraphics; + +{$IF LCL_FullVersion < 2030000} +procedure BitmapGrayscale(ABitmap: TCustomBitmap; RedFilter, GreenFilter, BlueFilter: Single); +var + IntfImg: TLazIntfImage = nil; + x, y: Integer; + TempColor: TFPColor; + Gray: Word; + sum: Single; +begin + // Normalize filter factors to avoid word overflow. + sum := RedFilter + GreenFilter + BlueFilter; + if sum = 0.0 then + exit; + RedFilter := RedFilter / sum; + GreenFilter := GreenFilter / sum; + BlueFilter := BlueFilter / sum; + + IntfImg := ABitmap.CreateIntfImage; + try + IntfImg.BeginUpdate; + try + for y := 0 to IntfImg.Height - 1 do + for x := 0 to IntfImg.Width - 1 do + begin + TempColor := IntfImg.Colors[x, y]; + Gray := word(Round(TempColor.Red * RedFilter + TempColor.Green * GreenFilter + TempColor.Blue * BlueFilter)); + TempColor.Red := Gray; + TempColor.Green := Gray; + TempColor.Blue := Gray; + IntfImg.Colors[x, y] := TempColor; + end; + finally + IntfImg.EndUpdate; + end; + ABitmap.LoadFromIntfImage(IntfImg); + finally + IntfImg.Free; + end; +end; +{$IFEND} + +{ Creates a new image list as copy of AImageList and converts its images to + grayscale. Intended to be used by TToolbar.DisabledImages. Avoids some + drawing artefacts in the auto-generated disabled images due to poorly + supported alpha channel in the built-in routines. } +function CreateDisabledImageList(AImageList: TCustomImageList; AOwner: TComponent): TImageList; +var + i: Integer; + bmp: TCustomBitmap; + Resolution: TCustomImageListResolution; +begin + if AImageList = nil then + begin + Result := nil; + exit; + end; + + Result := TImageList.Create(AOwner); + AImageList.AssignTo(Result); + Result.Scaled := AImageList.Scaled; + + bmp := TBitmap.Create; + Result.BeginUpdate; + try + for i := 0 to Result.Count - 1 do + begin + for Resolution in Result.Resolutions do + begin + Resolution.GetBitmap(i, bmp); + BitmapGrayScale(bmp, 0.30, 0.59, 0.11); + Resolution.ImageList.Replace(i, bmp, nil, False); + end; + end; + finally + Result.EndUpdate; + bmp.Free; + end; +end; + +{ Creates a new images list as copy of AImagelist and changes all non-transparent + pixels to the specified new color. Primarily useful for monochrome outline icons. } +function CreateRecoloredImageList(AImageList: TCustomImageList; ANewColor: TColor; + AOwner: TComponent): TImageList; +begin + Result := TImageList.Create(AOwner); + AImageList.AssignTo(Result); + Result.Scaled := AImageList.Scaled; + SetImagelistColor(Result, ANewColor); +end; + +{ Replaces the color of all non-transparent pixels by the given new color. + Intended to change the color of monochrome outline icons. } +procedure SetImageListColor(AImageList: TCustomImageList; ANewColor: TColor); +var + i, x, y: Integer; + IntfImg: TLazIntfImage = nil; + newColor: TFPColor; + tmpColor: TFPColor; + bmp: TCustomBitmap; + Resolution: TCustomImageListResolution; +begin + if AImageList = nil then + exit; + + bmp := TBitmap.Create; + AImageList.BeginUpdate; + try + newColor := TColorToFPColor(ANewColor); + for i := 0 to AImageList.Count - 1 do + begin + for Resolution in AImageList.Resolutions do + begin + Resolution.GetBitmap(i, bmp); + IntfImg := bmp.CreateIntfImage; + try + IntfImg.BeginUpdate; + try + for y := 0 to IntfImg.Height - 1 do + for x := 0 to IntfImg.Width - 1 do + begin + tmpColor := IntfImg.Colors[x, y]; + if tmpColor.Alpha > 0 then + begin + tmpColor.Red := newColor.Red; + tmpColor.Green := newColor.Green; + tmpColor.Blue := newColor.Blue; + IntfImg.Colors[x, y] := tmpColor; + end; + end; + finally + IntfImg.EndUpdate; + end; + bmp.LoadFromIntfImage(IntfImg); + Resolution.ImageList.Replace(i, bmp, nil, False); + finally + IntfImg.Free; + end; + end; + end; + finally + AImageList.EndUpdate; + bmp.Free; + end; +end; + +end. +