mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-07 23:16:01 +02:00
LCL: Support custom font in calculator form. Issue #28653, patch from Alexey Torgashin.
git-svn-id: trunk@49844 -
This commit is contained in:
parent
e3b220009f
commit
2d80484e2d
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
calcform.pas
|
calcform.pas
|
||||||
-----------
|
------------
|
||||||
Calculator form
|
Calculator form
|
||||||
|
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ const
|
|||||||
type
|
type
|
||||||
TCalculatorCalcKeyEvent = procedure (var key: char) of object;
|
TCalculatorCalcKeyEvent = procedure (var key: char) of object;
|
||||||
TCalculatorDispChangeEvent = procedure of object;
|
TCalculatorDispChangeEvent = procedure of object;
|
||||||
TCalcState = (csFirst, csValid, csError);
|
TCalculatorState = (csFirst, csValid, csError);
|
||||||
|
|
||||||
TCalculatorLayout = (clNormal, clSimple);
|
TCalculatorLayout = (clNormal, clSimple);
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ type
|
|||||||
TCalculatorPanel = class(TPanel)
|
TCalculatorPanel = class(TPanel)
|
||||||
private
|
private
|
||||||
FText: string;
|
FText: string;
|
||||||
FStatus: TCalcState;
|
FStatus: TCalculatorState;
|
||||||
FOperator: Char;
|
FOperator: Char;
|
||||||
FOperand: Double;
|
FOperand: Double;
|
||||||
FMemory: Double;
|
FMemory: Double;
|
||||||
@ -82,7 +82,7 @@ type
|
|||||||
property Memory: Double read FMemory write FMemory;
|
property Memory: Double read FMemory write FMemory;
|
||||||
property Precision: byte read FPrecision write FPrecision;
|
property Precision: byte read FPrecision write FPrecision;
|
||||||
property BeepOnError: boolean read FBeepOnError write FBeepOnError;
|
property BeepOnError: boolean read FBeepOnError write FBeepOnError;
|
||||||
property Status: TCalcState read FStatus write FStatus;
|
property Status: TCalculatorState read FStatus write FStatus;
|
||||||
property OperatorChar: char read FOperator write FOperator;
|
property OperatorChar: char read FOperator write FOperator;
|
||||||
property Text: string read FText;
|
property Text: string read FText;
|
||||||
|
|
||||||
@ -144,6 +144,11 @@ var
|
|||||||
cColorDisplayText: TColor = clblack;
|
cColorDisplayText: TColor = clblack;
|
||||||
cColorDisplayBack: TColor = clwhite;
|
cColorDisplayBack: TColor = clwhite;
|
||||||
|
|
||||||
|
cCalculatorFontName: string = 'MS Sans Serif';
|
||||||
|
cCalculatorFontSize: integer = 8;
|
||||||
|
cCalculatorFontStyle: TFontStyles = [fsBold];
|
||||||
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
@ -228,13 +233,10 @@ const
|
|||||||
|
|
||||||
procedure SetDefaultFont(AFont: TFont; Layout: TCalculatorLayout);
|
procedure SetDefaultFont(AFont: TFont; Layout: TCalculatorLayout);
|
||||||
begin
|
begin
|
||||||
with AFont do
|
//AFont.Color:=cCalculatorFontColor; //all controls now have their custom colors
|
||||||
begin
|
AFont.Name:=cCalculatorFontName;
|
||||||
Color := clWindowText;
|
AFont.Size:=cCalculatorFontSize;
|
||||||
Name := 'MS Sans Serif';
|
AFont.Style:=cCalculatorFontStyle;
|
||||||
Size := 8;
|
|
||||||
Style := [fsBold];
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function CreateCalculatorForm(AOwner: TComponent; ALayout: TCalculatorLayout; AHelpContext: THelpContext): TCalculatorForm;
|
function CreateCalculatorForm(AOwner: TComponent; ALayout: TCalculatorLayout; AHelpContext: THelpContext): TCalculatorForm;
|
||||||
@ -345,6 +347,7 @@ begin
|
|||||||
Alignment:=taCenter;
|
Alignment:=taCenter;
|
||||||
AutoSize:=False;
|
AutoSize:=False;
|
||||||
Parent:=FMemoryPanel;
|
Parent:=FMemoryPanel;
|
||||||
|
Font.Color:=cColorDisplayText;
|
||||||
Font.Style:=[];
|
Font.Style:=[];
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user