summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graeme@mastermaths.co.za>2010-07-05 17:08:41 +0200
committerGraeme Geldenhuys <graeme@mastermaths.co.za>2010-07-05 17:08:41 +0200
commitc442e9abe68adffecac7f6960c0d6eba3efe8f53 (patch)
tree16f64409450a208e21a4acd8776dfb9b9aa81695 /src
parenta883f4386120a6434aba332fb099afb5fed09466 (diff)
downloadfpGUI-c442e9abe68adffecac7f6960c0d6eba3efe8f53.tar.xz
Extended TfpgButton to paint disabled images when needed.
Again, this uses the new grayscale filter to paint a disabled image when Enabled = False.
Diffstat (limited to 'src')
-rw-r--r--src/gui/fpg_button.pas16
1 files changed, 12 insertions, 4 deletions
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;