sptbxlib icon indicating copy to clipboard operation
sptbxlib copied to clipboard

Add support for TSVGIconImageList

Open skamradt opened this issue 1 year ago • 7 comments

One of the SVG options that is available via GetIt in the more recent versions of Delphi contains the TSVGIconImageList. Using this list for SVG images mostly works, however the disabled drawing is broken, which is extremely visible if you use a dark theme. I made the following changes to TB2Common in the SpIsVirtualImageList procedure. The code change is towards the bottom of this procedure. I believe the patch file would need to be updated to include this change.

    // special case for TSVGIconImageList (also uses RTTI)
    else
      if (ImageList.ClassName = 'TSVGIconImageList') then begin
        if enabled then
          ImageList.Draw(ACanvas, ARect.Left, ARect.Top, ImageIndex)
        else
          begin
            RttiC := TRttiContext.Create;
            // Paint disabled
            RTTIC.GetType(ImageList.ClassType).GetMethod('PaintTo').Invoke(
              ImageList,[ACanvas,ImageIndex,ARect.Left,ARect.Top,ARect.Width,aRect.Height,False]);
          end;
      end
    else
   // end special case
    {$IFEND}
     // For older versions of Delphi

skamradt avatar Nov 24 '23 14:11 skamradt