From 6408cfff3a9f6d8d5886095c4f2b8b2081a68249 Mon Sep 17 00:00:00 2001 From: blikblum Date: Fri, 15 May 2015 09:40:47 +0000 Subject: [PATCH] * Create check image lists git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4129 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- .../trunk/VirtualTrees.pas | 38 +++++++++++++------ 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/components/virtualtreeview-new/trunk/VirtualTrees.pas b/components/virtualtreeview-new/trunk/VirtualTrees.pas index a1ee247ba..f126f884d 100644 --- a/components/virtualtreeview-new/trunk/VirtualTrees.pas +++ b/components/virtualtreeview-new/trunk/VirtualTrees.pas @@ -5124,6 +5124,23 @@ begin end; end; +//---------------------------------------------------------------------------------------------------------------------- + +function CreateCheckImageList(CheckKind: TCheckImageKind): TImageList; +begin + Result := TImageList.Create(nil); + Result.Height := 16; + Result.Width := 16; + Result.AddLazarusResource(CheckImagesStrings[CheckKind], clFuchsia); +end; + +function GetCheckImageList(var ImageList: TImageList; CheckKind: TCheckImageKind): TImageList; +begin + if ImageList = nil then + ImageList := CreateCheckImageList(CheckKind); + Result := ImageList; +end; + //---------------------------------------------------------------------------------------------------------------------- {$ifdef CPU64} @@ -5291,6 +5308,8 @@ begin UtilityImages.Transparent := True; UtilityImages.LoadFromLazarusResource('VT_UTILITIES'); + SystemCheckImages := CreateCheckImageList(ckSystemDefault); + // Delphi (at least version 6 and lower) does not provide a standard split cursor. // Hence we have to load our own. Screen.Cursors[crHeaderSplit] := LoadCursorFromLazarusResource('VT_HEADERSPLIT'); @@ -12051,9 +12070,6 @@ begin FOptions.Free; FreeAndNil(FHeader); - - if FCheckImages <> FCustomCheckImages then - FCheckImages.Free; FreeMem(FRoot); @@ -21408,21 +21424,21 @@ class function TBaseVirtualTree.GetCheckImageListFor(Kind: TCheckImageKind): TCu begin case Kind of ckDarkCheck: - Result := DarkCheckImages; + Result := GetCheckImageList(DarkCheckImages, ckDarkCheck); ckLightTick: - Result := LightTickImages; + Result := GetCheckImageList(LightTickImages, ckLightTick); ckDarkTick: - Result := DarkTickImages; + Result := GetCheckImageList(DarkTickImages, ckDarkTick); ckLightCheck: - Result := LightCheckImages; + Result := GetCheckImageList(LightCheckImages, ckLightCheck); ckFlat: - Result := FlatImages; + Result := GetCheckImageList(FlatImages, ckFlat); ckXP: - Result := XPImages; + Result := GetCheckImageList(XPImages, ckXP); ckSystemDefault: - Result := SystemCheckImages; + Result := GetCheckImageList(SystemCheckImages, ckSystemDefault); ckSystemFlat: - Result := SystemFlatCheckImages; + Result := GetCheckImageList(SystemFlatCheckImages, ckSystemFlat); else Result := nil; end;