From c442e9abe68adffecac7f6960c0d6eba3efe8f53 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Mon, 5 Jul 2010 17:08:41 +0200 Subject: Extended TfpgButton to paint disabled images when needed. Again, this uses the new grayscale filter to paint a disabled image when Enabled = False. --- src/gui/fpg_button.pas | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gui/fpg_button.pas b/src/gui/fpg_button.pas index 9dc9f7f2..19b31049 100644 --- a/src/gui/fpg_button.pas +++ b/src/gui/fpg_button.pas @@ -508,7 +508,7 @@ var pofs: integer; lBtnFlags: TFButtonFlags; clr: TfpgColor; - + img: TfpgImage; begin // inherited HandlePaint; Canvas.ClearClipRect; @@ -567,9 +567,17 @@ begin CalculatePositions (ix, iy, tx, ty); - if FShowImage and assigned (FImage) then - Canvas.DrawImage(ix + pofs, iy + pofs, FImage); - + if FShowImage and Assigned(FImage) then + begin + if Enabled then + Canvas.DrawImage(ix + pofs, iy + pofs, FImage) + else + begin + img := FImage.CreateDisabledImage; + Canvas.DrawImage(ix + pofs, iy + pofs, img); + img.Free; + end; + end; fpgStyle.DrawString(Canvas, tx+pofs, ty+pofs, Text, Enabled); end; -- cgit v1.2.3-70-g09d2