tvplanit: Add holiday support to TVpCalendar.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8553 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2022-10-13 15:00:41 +00:00
parent b7c534c59a
commit 23c4602593
2 changed files with 36 additions and 9 deletions

View File

@@ -32,6 +32,7 @@ type
DayColor: TColor;
RealColor: TColor;
WeekendColor: TColor;
HolidayColor: TColor;
protected
procedure DrawAllDays;
@@ -167,8 +168,10 @@ procedure TVpCalendarPainter.DrawDay(R, C, I: Integer; Grayed: Boolean);
var
clr: TColor;
day: Byte;
dt: TDate;
OldIdx: Integer;
NewIdx: Integer;
holiday: String;
S: string[10];
DrawRect: TRect;
TH: Integer;
@@ -185,9 +188,13 @@ begin
day := TVpCalendarOpener(FCalendar).clCalendar[I];
S := IntToStr(day);
dt := Encodedate(FCalendar.Year, FCalendar.Month, day);
if Grayed then
RenderCanvas.Font.Color := InactiveDayColor
else
if FCalendar.IsHoliday(dt, holiday) then
RenderCanvas.Font.Color := HolidayColor
else
if (day = FCalendar.Day) then
RenderCanvas.Font.Color := ActiveDayTextColor;
@@ -282,6 +289,7 @@ begin
DayColor := clBlack;
RealColor := clWhite;
WeekendColor := $5f5f5f;
HolidayColor := $5f5f5f;
end else begin
BevelHighlight := clBtnHighlight;
BevelShadow := clBtnShadow;
@@ -296,6 +304,7 @@ begin
DayColor := FCalendar.Colors.Days;
RealColor := FCalendar.Colors.Background;
WeekendColor := FCalendar.Colors.WeekEnd;
HolidayColor := FCalendar.Colors.Holidays;
end;
end;