CalLite: Enforce redrawing of control when font changes.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6957 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2019-05-27 08:38:15 +00:00
parent ff899abd44
commit 99e1ca4940

View File

@ -268,6 +268,7 @@ type
const AXProportion, AYProportion: Double); override; const AXProportion, AYProportion: Double); override;
{$endif} {$endif}
procedure DblClick; override; procedure DblClick; override;
procedure FontChanged(Sender: TObject); override;
class function GetControlClassDefaultSize: TSize; override; class function GetControlClassDefaultSize: TSize; override;
procedure InternalClick; procedure InternalClick;
procedure KeyDown(var Key: Word; Shift: TShiftState); override; procedure KeyDown(var Key: Word; Shift: TShiftState); override;
@ -754,6 +755,7 @@ begin
if not Assigned(FCanvas) then Exit; if not Assigned(FCanvas) then Exit;
DecodeDate(FOwner.FDate, FThisYear, FThisMonth, FThisDay); DecodeDate(FOwner.FDate, FThisYear, FThisMonth, FThisDay);
CalcSettings; CalcSettings;
FCanvas.Font.Assign(FOwner.Font);
DrawBackground; DrawBackground;
DrawTopRow; DrawTopRow;
DrawDayLabels; DrawDayLabels;
@ -905,7 +907,7 @@ begin
begin begin
FCanvas.Font.Color := FOwner.Colors.HolidayColor; FCanvas.Font.Color := FOwner.Colors.HolidayColor;
if coBoldHolidays in FOwner.Options then if coBoldHolidays in FOwner.Options then
FCanvas.Font.Style := [fsBold]; FCanvas.Font.Style := FCanvas.Font.Style + [fsBold];
end else end else
{ Special case: override weekend } { Special case: override weekend }
if (coShowWeekend in FOwner.Options) and if (coShowWeekend in FOwner.Options) and
@ -913,7 +915,7 @@ begin
begin begin
FCanvas.Font.Color := FOwner.Colors.WeekendColor; FCanvas.Font.Color := FOwner.Colors.WeekendColor;
if coBoldWeekend in FOwner.Options then if coBoldWeekend in FOwner.Options then
FCanvas.Font.Style := [fsBold]; FCanvas.Font.Style := FCanvas.Font.Style + [fsBold];
end; end;
end else end else
begin begin
@ -993,9 +995,9 @@ var
begin begin
FCanvas.Font.Color:= FOwner.Colors.TextColor; FCanvas.Font.Color:= FOwner.Colors.TextColor;
if (coBoldDayNames in FOwner.Options) then if (coBoldDayNames in FOwner.Options) then
FCanvas.Font.Style := [fsBold] FCanvas.Font.Style := FCanvas.Font.Style + [fsBold]
else else
FCanvas.Font.Style := []; FCanvas.Font.Style := FCanvas.Font.Style - [fsBold];
map := Integer(FOwner.FStartingDayOfWeek); map := Integer(FOwner.FStartingDayOfWeek);
for c:= Low(TWeekNameArray) to High(TWeekNameArray) do for c:= Low(TWeekNameArray) to High(TWeekNameArray) do
begin begin
@ -1037,8 +1039,8 @@ begin
FCanvas.Font.Color:= FOwner.Colors.TextColor; FCanvas.Font.Color:= FOwner.Colors.TextColor;
if coBoldToday in FOwner.Options then if coBoldToday in FOwner.Options then
FCanvas.Font.Style := [fsBold] else FCanvas.Font.Style := FCanvas.Font.Style + [fsBold] else
FCanvas.Font.Style := []; FCanvas.Font.Style := FCanvas.Font.Style - [fsBold];
s:= FOwner.GetDisplayText(dtToday); s:= FOwner.GetDisplayText(dtToday);
if pos('%s', s) = 0 then begin if pos('%s', s) = 0 then begin
@ -1099,9 +1101,9 @@ begin
if (FCanvas.Font.Color <> FOwner.Colors.TextColor) then if (FCanvas.Font.Color <> FOwner.Colors.TextColor) then
FCanvas.Font.Color := FOwner.Colors.TextColor; FCanvas.Font.Color := FOwner.Colors.TextColor;
if (coBoldTopRow in FOwner.Options) then if (coBoldTopRow in FOwner.Options) then
FCanvas.Font.Style := [fsBold] FCanvas.Font.Style := FCanvas.Font.Style + [fsBold]
else else
FCanvas.Font.Style := []; FCanvas.Font.Style := FCanvas.Font.Style - [fsBold];
case (FOwner.BiDiMode = bdLeftToRight) of case (FOwner.BiDiMode = bdLeftToRight) of
False: begin False: begin
@ -1590,6 +1592,12 @@ begin
Invalidate; Invalidate;
end; end;
procedure TCalendarLite.FontChanged(Sender: TObject);
begin
inherited;
Draw;
end;
class function TCalendarLite.GetControlClassDefaultSize: TSize; class function TCalendarLite.GetControlClassDefaultSize: TSize;
begin begin
{$ifdef lcl_scaling} {$ifdef lcl_scaling}