From d25b6c6317163e6e6cdf17292609d38fd130e0ae Mon Sep 17 00:00:00 2001 From: juha Date: Thu, 20 Aug 2015 07:39:54 +0000 Subject: [PATCH] LCL: Use BitBtn in Calculator dialog on Windows. Allows colors. Issue #28413, patch from Alexey Torgashin. git-svn-id: trunk@49696 - --- lcl/calcform.pas | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/lcl/calcform.pas b/lcl/calcform.pas index 6acb7ab637..69c957b710 100644 --- a/lcl/calcform.pas +++ b/lcl/calcform.pas @@ -155,8 +155,18 @@ type cbAdd, cbSqrt, cbSquare, cbPcnt, cbRev, cbEql, cbBck, cbClr, cbMP, cbMS, cbMR, cbMC, cbOk, cbCancel); +{$IFDEF Windows} +// Windows: use BitBtn to enable font color on button +{$define CalcBitButtons} +{$ENDIF} + type - TCalcButton = class(TCustomSpeedButton) + + { TCalcButton } + + TCalcButton = class( + {$IFDEF CalcBitButtons} TCustomBitBtn {$ELSE} TCustomSpeedButton {$ENDIF} + ) private FKind: TCalcBtnKind; public @@ -180,7 +190,7 @@ const CalcBtnSizes: array[TCalculatorLayout, 1..2] of Integer = ((36,22), (25,21)); CalcBtnCaptions: array[cbSgn..cbCancel] of String = - ('±', ',', '/', '*', '-', '+', '√', 'x²', '%', '1/x', '=', '«', 'C', + ('±', ',', '/', '*', '-', '+', '√ ', 'x²', '%', '1/x', '=', '«', 'C', 'MP','MS','MR','MC', 'ok', 'x'); CalcBtnPos: array[TCalculatorLayout, TCalcBtnKind] of TPoint = (( @@ -784,6 +794,9 @@ end; constructor TCalcButton.CreateKind(AOwner: TComponent; AKind: TCalcBtnKind); begin inherited Create(AOwner); + {$IFDEF CalcBitButtons} + TabStop:=false; + {$ENDIF} FKind:=AKind; if FKind in [cbNum0..cbClr] then Tag:=Ord(Kind) - 1 @@ -791,6 +804,5 @@ begin Tag:=-1; end; - end.