-
Notifications
You must be signed in to change notification settings - Fork 3
/
lclcalendarwrapper.pas
74 lines (55 loc) · 1.73 KB
/
lclcalendarwrapper.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
{
LCLCalendarWrapper
- - - - - - - - - - - - - - - - -
Author: Zoran Vučenović
Зоран Вученовић
This unit is part of ZVDateTimeCtrls package for Lazarus.
TLCLCalendarWrapper is the default implementation of TCalendarControlWrapper
abstract class, used by ZVDateTimePicker. Wraps LCL's TCalendar.
-----------------------------------------------------------
LICENCE
- - - -
Modified LGPL -- see the file COPYING.modifiedLGPL.
-----------------------------------------------------------
NO WARRANTY
- - - - - -
There is no warranty whatsoever.
-----------------------------------------------------------
BEST REGARDS TO LAZARUS COMMUNITY!
- - - - - - - - - - - - - - - - - -
I do hope the ZVDateTimeCtrls package will be useful.
}
unit LCLCalendarWrapper;
{$mode objfpc}{$H+}
interface
uses
Classes, Controls, Calendar, CalendarControlWrapper;
type
{ TLCLCalendarWrapper }
TLCLCalendarWrapper = class(TCalendarControlWrapper)
public
class function GetCalendarControlClass: TControlClass; override;
procedure SetDate(Date: TDate); override;
function GetDate: TDate; override;
function AreCoordinatesOnDate(X, Y: Integer): Boolean; override;
end;
implementation
{ TLCLCalendarWrapper }
class function TLCLCalendarWrapper.GetCalendarControlClass: TControlClass;
begin
Result := TCalendar;
end;
procedure TLCLCalendarWrapper.SetDate(Date: TDate);
begin
TCalendar(GetCalendarControl).DateTime := Date;
end;
function TLCLCalendarWrapper.GetDate: TDate;
begin
Result := TCalendar(GetCalendarControl).DateTime;
end;
function TLCLCalendarWrapper.AreCoordinatesOnDate(X, Y: Integer): Boolean;
begin
Result :=
TCalendar(GetCalendarControl).HitTest(Point(X, Y)) in [cpDate, cpNoWhere];
end;
end.