Repository navigation
Expand file tree
/
Copy pathSCDateTimeControls.pas
More file actions
6830 lines (5785 loc) · 171 KB
/
Copy pathSCDateTimeControls.pas
File metadata and controls
6830 lines (5785 loc) · 171 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
{*******************************************************}
{ }
{ CA SweetControls Component Library }
{ }
{ Copyright (c) 1996,2004 CodeAccelerate Corporation }
{ }
{*******************************************************}
unit SCDateTimeControls;
{$I SweetControls.inc}
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Extctrls, ImgList, StdActns, ActnList, Menus, SCCommon, SCConsts, SCResStrs,
SCControl, SCAdvEdits;
type
TSCCalendarOption = (sccoDayCaptions, sccoWeekNumbers, sccoWeekendDays,
sccoHolidays, sccoSpecialDays, sccoPastDays, sccoPastDaysGrayed, sccoMonthPopup,
sccoNavigator, sccoNavButtons, sccoNavYear, sccoNavMonth, sccoFocusRect,
sccoTodayBtn, sccoClearBtn, sccoTodayRect, sccoHighlight);
TSCCalendarOptions = set of TSCCalendarOption;
TSCWeekDayName = (scwdMonday, scwdTuesday, scwdWednesday, scwdThursday,
scwdFriday, scwdSaturday, scwdSunday);
TSCWeekDayNames = set of TSCWeekDayName;
const
SCCalendarDefOptions = [sccoDayCaptions, sccoWeekendDays, sccoHolidays,
sccoSpecialDays, sccoPastDays, sccoPastDaysGrayed, sccoNavigator, sccoMonthPopup,
sccoNavButtons, sccoNavMonth, sccoNavYear, sccoFocusRect, sccoTodayBtn,
sccoClearBtn, sccoTodayRect, sccoHighlight];
SCWeekendDays = [scwdSaturday, scwdSunday];
type
TSCCustomCalendar = class;
TSCHoliday = class(TCollectionItem)
private
FDay: Integer;
FMonth: TSCMonth;
FYear: Integer;
FName: String;
FBackColor: TColor;
FFontColor: TColor;
FFontStyles: TFontStyles;
procedure SetBackColor(Value: TColor);
procedure SetFontColor(Value: TColor);
procedure SetFontStyles(Value: TFontStyles);
procedure SetDay(Value: Integer);
procedure SetYear(Value: Integer);
procedure SetMonth(Value: TSCMonth);
procedure SetName(const Value: String);
protected
function GetDisplayName: string; override;
public
constructor Create(Collection: TCollection); override;
procedure Assign(Source: TPersistent); override;
published
property Day: Integer read FDay write SetDay default 1;
property Month: TSCMonth read FMonth write SetMonth default scmJanuary;
property Year: Integer read FYear write SetYear default -1;
property Name: String read FName write SetName;
property BackColor: TColor read FBackColor write SetBackColor default clNone;
property FontColor: TColor read FFontColor write SetFontColor default clNone;
property FontStyles: TFontStyles read FFontStyles write SetFontStyles default [];
end;
TSCHolidays = class(TCollection)
private
FOwner: TSCCustomControl;
function GetItem(Index: Integer): TSCHoliday;
procedure SetItem(Index: Integer; Value: TSCHoliday);
protected
function GetOwner: TPersistent; override;
procedure Update(Item: TCollectionItem); override;
public
constructor Create(AOwner: TSCCustomControl);
function Add: TSCHoliday;
property Items[Index: Integer]: TSCHoliday read GetItem write SetItem; default;
{$IFDEF SC_DELPHI5_AND_EARLY}
property Owner: TSCCustomControl read FOwner;
{$ENDIF}
end;
TSCSpecialDay = class(TCollectionItem)
private
FDay: Integer;
FMonth: TSCMonth;
FYear: Integer;
FName: String;
FBackColor: TColor;
FFontColor: TColor;
FFontStyles: TFontStyles;
procedure SetBackColor(Value: TColor);
procedure SetFontColor(Value: TColor);
procedure SetFontStyles(Value: TFontStyles);
procedure SetDay(Value: Integer);
procedure SetMonth(Value: TSCMonth);
procedure SetYear(Value: Integer);
procedure SetName(const Value: String);
protected
function GetDisplayName: string; override;
public
constructor Create(Collection: TCollection); override;
procedure Assign(Source: TPersistent); override;
published
property Day: Integer read FDay write SetDay default 1;
property Month: TSCMonth read FMonth write SetMonth default scmJanuary;
property Year: Integer read FYear write SetYear default -1;
property Name: String read FName write SetName;
property BackColor: TColor read FBackColor write SetBackColor default clNone;
property FontColor: TColor read FFontColor write SetFontColor default clNone;
property FontStyles: TFontStyles read FFontStyles write SetFontStyles default [];
end;
TSCSpecialDays = class(TCollection)
private
FOwner: TSCCustomControl;
function GetItem(Index: Integer): TSCSpecialDay;
procedure SetItem(Index: Integer; Value: TSCSpecialDay);
protected
function GetOwner: TPersistent; override;
procedure Update(Item: TCollectionItem); override;
public
constructor Create(AOwner: TSCCustomControl);
function Add: TSCSpecialDay;
property Items[Index: Integer]: TSCSpecialDay read GetItem write SetItem; default;
{$IFDEF SC_DELPHI5_AND_EARLY}
property Owner: TSCCustomControl read FOwner;
{$ENDIF}
end;
TSCGetDateStyleEvent = procedure(Sender: TObject; Day, Month: Word; Year: Integer;
var BkColor, ForeColor: TColor; var FontStyle: TFontStyles) of object;
TSCCalendarColors = class(TPersistent)
private
FOwner: TControl;
FDayCaptions: TColor;
FDaysBackground: TColor;
FGrayedText: TColor;
FGrayed: TColor;
FHideSelection: TColor;
FHideSelectionText: TColor;
FHighlight: TColor;
FHighlightText: TColor;
FHolidays: TColor;
FHolidaysText: TColor;
FLines: TColor;
FNavigator: TColor;
FNavigatorEnd: TColor;
FNavigatorButtons: TColor;
FNavigatorLine: TColor;
FPopup: TColor;
FPopupHighlight: TColor;
FPopupHighlightText: TColor;
FSelection: TColor;
FSelectionText: TColor;
FSpecialDay: TColor;
FSpecialDayText: TColor;
FTodayClearBtn: TColor;
FTodayRect: TColor;
FWeekendDays: TColor;
FWeekendDaysText: TColor;
FWeekNumbers: TColor;
FOnChange: TNotifyEvent;
procedure SetDayCaptions(Value: TColor);
procedure SetDaysBackground(Value: TColor);
procedure SetGrayed(Value: TColor);
procedure SetGrayedText(Value: TColor);
procedure SetHideSelection(Value: TColor);
procedure SetHideSelectionText(Value: TColor);
procedure SetHighlight(Value: TColor);
procedure SetHighlightText(Value: TColor);
procedure SetHolidays(Value: TColor);
procedure SetHolidaysText(Value: TColor);
procedure SetLines(Value: TColor);
procedure SetNavigator(Value: TColor);
procedure SetNavigatorEnd(Value: TColor);
procedure SetNavigatorButtons(Value: TColor);
procedure SetNavigatorLine(Value: TColor);
procedure SetSelection(Value: TColor);
procedure SetSelectionText(Value: TColor);
procedure SetSpecialDay(Value: TColor);
procedure SetSpecialDayText(Value: TColor);
procedure SetTodayClearBtn(Value: TColor);
procedure SetTodayRect(Value: TColor);
procedure SetWeekendDays(Value: TColor);
procedure SetWeekendDaysText(Value: TColor);
procedure SetWeekNumbers(Value: TColor);
procedure DoChange;
protected
function GetOwner: TPersistent; override;
property OnChange: TNotifyEvent read FOnChange write FOnChange;
public
constructor Create(AOwner: TControl); virtual;
procedure Assign(Source: TPersistent); override;
property Owner: TControl read FOwner;
published
property DayCaptions: TColor read FDayCaptions write SetDayCaptions default clNone;
property DaysBackground: TColor read FDaysBackground write SetDaysBackground default clNone;
property Grayed: TColor read FGrayed write SetGrayed default clNone;
property GrayedText: TColor read FGrayedText write SetGrayedText default clGrayText;
property HideSelection: TColor read FHideSelection write SetHideSelection default clInactiveCaption;
property HideSelectionText: TColor read FHideSelectionText write SetHideSelectionText default clInactiveCaptionText;
property Highlight: TColor read FHighlight write SetHighlight default clHighlight;
property HighlightText: TColor read FHighlightText write SetHighlightText default clHighlightText;
property Holidays: TColor read FHolidays write SetHolidays default clNone;
property HolidaysText: TColor read FHolidaysText write SetHolidaysText default clRed;
property Lines: TColor read FLines write SetLines default clBtnShadow;
property Navigator: TColor read FNavigator write SetNavigator default clBtnFace;
property NavigatorEnd: TColor read FNavigatorEnd write SetNavigatorEnd default clBtnHighlight;
property NavigatorButtons: TColor read FNavigatorButtons write SetNavigatorButtons default clWindowText;
property NavigatorLine: TColor read FNavigatorLine write SetNavigatorLine default clNone;
property Popup: TColor read FPopup write FPopup default clWindow;
property PopupHighlight: TColor read FPopupHighlight write FPopupHighlight default clWindowText;
property PopupHighlightText: TColor read FPopupHighlightText write FPopupHighlightText default clWindow;
property Selection: TColor read FSelection write SetSelection default clPurple;
property SelectionText: TColor read FSelectionText write SetSelectionText default clWhite;
property SpecialDay: TColor read FSpecialDay write SetSpecialDay default clNone;
property SpecialDayText: TColor read FSpecialDayText write SetSpecialDayText default clBlue;
property TodayClearBtn: TColor read FTodayClearBtn write SetTodayClearBtn default clBtnFace;
property TodayRect: TColor read FTodayRect write SetTodayRect default clMaroon;
property WeekendDays: TColor read FWeekendDays write SetWeekendDays default clNone;
property WeekendDaysText: TColor read FWeekendDaysText write SetWeekendDaysText default clHighlight;
property WeekNumbers: TColor read FWeekNumbers write SetWeekNumbers default clNone;
end;
TSCStartOfWeek = (scswMonday, scswTuesday, scswWednesday, scswThursday,
scswFriday, scswSaturday, scswSunday, scswLocaleDefault);
TSCCalendarCell = record
Day: Word;
Month: Word;
Year: Word;
Visible: Boolean;
ARect: TRect;
IsHoliday: Boolean;
IsSpecial: Boolean;
Color: TColor;
FontColor: TColor;
FontStyles: TFontStyles;
DayName: TSCWeekDayName;
end;
PSCCalendarCell = ^TSCCalendarCell;
TSCNavigatorStyle = (scnFlat, scnFlatEx, scnFlatWithLine, scnMetal,
scnRaised, scnGradient, scnGradientEx);
TSCCalendarPart = (sccpNowhere, sccpClient, sccpDays, sccpDayCaptions,
sccpWeekNumbers, sccpTodayBtn, sccpClearBtn, sccpNavigator, sccpNavLeftBtn,
sccpNavRightBtn, sccpNavMonthYear);
TSCCalendarBorderProps = class(TSCControlBorderProps)
public
constructor Create(AOwner: TSCCustomControl); override;
published
property Border default sccbFlat;
property Color default clWindow;
property ExDraw;
property FlatColor;
property FlatInnerColor;
property InnerBorder;
property Width;
end;
TSCCalButtonType = (scbtToday, scbtClear);
TSCCalButtonStyle = (sccbsWin2k, sccbsCorel, sccbsFlat, sccbsFlatEx,
sccbsFlatHot, sccbsOfficeXP, sccbsOffice2003, sccbsMetal, sccbsNew,
sccbsXP);
TSCCalendarDayCaptions = (scdcFirst, scdcTwo, scdcThree, scdcShort, scdcLong);
TSCCalendarNavigateStyle = (sccnMonth, sccnYear, sccnBoth);
TSCCalendarNavigateEvent = procedure(Sender: TObject; Month, Year: Word;
NavStyle: TSCCalendarNavigateStyle) of object;
TSCCalendarPopupType = (sccpMonthYear, sccpYear);
TSCCustomCalendar = class(TSCCustomControl)
private
FAlignPopupText: Boolean;
FDaysList: TList;
FDayCaptionsList: TList;
FWeekNumbersList: TList;
FButtonFont: TFont;
FButtonClear: TCaption;
FButtonStyle: TSCCalButtonStyle;
FButtonToday: TCaption;
FCalColors: TSCCalendarColors;
FDate: TDateTime;
FDayCaptions: TSCCalendarDayCaptions;
FDayCaptionsFont: TFont;
FDisplayMonth: Word;
FDisplayYear: Word;
FHolidays: TSCHolidays;
FImageHighlight: TImageIndex;
FImageSelection: TImageIndex;
FImageToday: TImageIndex;
FNavigatorLeft: TImageIndex;
FNavigatorRight: TImageIndex;
FNavigatorFont: TFont;
FNavigatorGradient: TSCGradient;
FNavigatorHeight: Integer;
FNavigatorStyle: TSCNavigatorStyle;
FPopupBorder: TSCControlBorder;
FPopupType: TSCCalendarPopupType;
FSpecialDays: TSCSpecialDays;
FStartOfWeek: TSCStartOfWeek;
FWeekNumbersFont: TFont;
FWeekendDays: TSCWeekDayNames;
FOptions: TSCCalendarOptions;
FPopupFont: TFont;
FMonthOffset: Integer;
FFirstDate: TDateTime;
FForceDateChange: Boolean;
FFocusedDate: TDate;
FDownPart: TSCCalendarPart;
FHotPart: TSCCalendarPart;
FMousePressed: Boolean;
FTimer: LongInt;
FMonthPopup: TWinControl;
FOnClearClick: TNotifyEvent;
FOnGetDateStyle: TSCGetDateStyleEvent;
FOnDateClick: TNotifyEvent;
FOnNavigate: TSCCalendarNavigateEvent;
FDateClick: Boolean;
FScrollCount: Integer;
procedure SetAlignPopupText(Value: Boolean);
procedure SetButtonFont(Value: TFont);
procedure SetButtonClear(const Value: TCaption);
procedure SetButtonStyle(Value: TSCCalButtonStyle);
procedure SetButtonToday(const Value: TCaption);
procedure SetCalColors(Value: TSCCalendarColors);
procedure SetDate(Value: TDateTime);
procedure SetDayCaptions(Value: TSCCalendarDayCaptions);
procedure SetDayCaptionsFont(Value: TFont);
procedure SetHolidays(Value: TSCHolidays);
procedure SetImageHighlight(Value: TImageIndex);
procedure SetImageSelection(Value: TImageIndex);
procedure SetImageToday(Value: TImageIndex);
procedure SetNavigatorLeft(Value: TImageIndex);
procedure SetNavigatorRight(Value: TImageIndex);
procedure SetNavigatorFont(Value: TFont);
procedure SetNavigatorGradient(Value: TSCGradient);
procedure SetNavigatorHeight(Value: Integer);
procedure SetNavigatorStyle(Value: TSCNavigatorStyle);
procedure SetPopupBorder(Value: TSCControlBorder);
procedure SetPopupType(Value: TSCCalendarPopupType);
procedure SetSpecialDays(Value: TSCSpecialDays);
procedure SetWeekendDays(Value: TSCWeekDayNames);
procedure SetWeekNumbersFont(Value: TFont);
procedure SetOptions(Value: TSCCalendarOptions);
procedure SetPopupFont(Value: TFont);
procedure SetStartOfWeek(Value: TSCStartOfWeek);
procedure SetDisplayDate(Value: TDateTime);
procedure DisplayParameters(D: TDateTime; var MOffset: Integer;
var FirstDay: TDateTime; var DispYear, DispMonth: Word);
procedure UpdateDayRects;
procedure UpdateFontAndColors;
procedure UpdateHolidays;
procedure UpdateSpecialDays;
procedure FontsChanged(Sender: TObject);
procedure ColorsChanged(Sender: TObject);
procedure HolidaysChanged(Sender: TObject);
procedure SpecialDaysChanged(Sender: TObject);
procedure UpdateFocusDate(X, Y: Integer);
procedure ClearDays;
procedure UpdateDays;
procedure StartTimer;
procedure StopTimer;
procedure ScrollMonth;
procedure ClearDayCaptions;
procedure UpdateDayCaptions;
procedure ClearWeekNumbers;
procedure UpdateWeekNumbers;
procedure ClearClick;
procedure GetDateStyle(Day, Month: Word; Year: Integer;
var BkColor, ForeColor: TColor; var FontStyle: TFontStyles);
procedure CMFontChanged(var Message: TMessage); message CM_FONTCHANGED;
procedure CMColorChanged(var Message: TMessage); message CM_COLORCHANGED;
procedure CMBorderChanged(var Message: TMessage); message CM_BORDERCHANGED;
procedure WMGetDlgCode(var Message: TWMGetDlgCode); message WM_GETDLGCODE;
procedure WMSize(var Message: TWMSize); message WM_SIZE;
procedure WMWindowPosChanged(var Message: TWMWindowPosChanged); message WM_WINDOWPOSCHANGED;
procedure WMMouseWheel(var Message: TWMMouseWheel); message WM_MOUSEWHEEL;
procedure WMDestroy(var Message: TMessage); message WM_DESTROY;
procedure WMTimer(var Message: TWMTimer); message WM_TIMER;
procedure CNKeyDown(var Message: TWMKeyDown); message CN_KEYDOWN;
protected
procedure CreateParams(var Params: TCreateParams); override;
procedure CreateWnd; override;
procedure Loaded; override;
procedure Paint; override;
procedure ShowMonthPopup;
procedure HideMonthPopup;
function IsMonthPopupShowing: Boolean;
procedure SetIndent(Value: Integer); override;
procedure MouseInControlChanged; override;
procedure FocusChanged; override;
procedure StopTracking; override;
procedure IndentChanged; override;
procedure SystemColorsChanged; override;
procedure EnabledChanged; override;
function GetBorderPropsClass: TSCControlBorderPropsClass; override;
function GetPictureRect(P: TPicture): TRect; override;
procedure ConstrainedResize(var MinWidth, MinHeight, MaxWidth, MaxHeight: Integer); override;
function CanAutoSize(var NewWidth, NewHeight: Integer): Boolean; override;
procedure AdjustBounds; override;
procedure DrawDayCaptions(R: TRect); virtual;
procedure DrawDays(R: TRect); virtual;
procedure DrawNavigator(R: TRect); virtual;
procedure DrawWeekNumbers(R: TRect); virtual;
procedure DrawButtons(R: TRect); virtual;
function GetDayCaption(Index: Integer): String;
function GetClearCaption: String;
function GetTodayCaption: String;
function GetButtonsHeight: Integer;
procedure GetButtonSizeFor(S: String; var W, H: Integer);
procedure GetDaysSize(var H, W: Integer);
procedure GetDayCaptionsSize(var H, W: Integer);
function GetNavigatorHeight(Auto: Boolean = False): Integer;
procedure GetWeekNumbersSize(var H, W: Integer);
procedure GetMinBounds(var W, H: Integer);
function GetGridRect: TRect;
procedure GetButtonRects(var TodayR, ClearR: TRect);
function GetButtonRect(Btn: TSCCalButtonType): TRect;
function GetYearMonthRect(Auto: Boolean = False): TRect;
procedure FullUpdate;
function MonthPopupVisible: Boolean;
procedure DoClearClick; dynamic;
procedure DoDateClick; dynamic;
procedure DoGetDateStyle(Day, Month: Word; Year: Integer;
var BkColor, ForeColor: TColor; var FontStyle: TFontStyles); virtual;
function WeekNumberOf(D: TDateTime): Word;
procedure FirstRowColOfMonth(D: TDateTime; var Col, Row: Word);
function StartOfWeekAsInt: Integer;
function PosToDateTime(P: TPoint): TDateTime; virtual;
function DaysThisMonth: Integer; virtual;
function GetCellDate(ACol, ARow: Integer): TDateTime;
function GetCellRect(ACol, ARow: Integer): TRect;
procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
procedure KeyDown(var Key: Word; Shift: TShiftState); override;
property DownPart: TSCCalendarPart read FDownPart;
property HotPart: TSCCalendarPart read FHotPart;
property AutoSize default True;
property AlignPopupText: Boolean read FAlignPopupText write SetAlignPopupText default False;
property BlendColor default False;
property Border default sccbFlat;
property ButtonFont: TFont read FButtonFont write SetButtonFont;
property ButtonClear: TCaption read FButtonClear write SetButtonClear;
property ButtonStyle: TSCCalButtonStyle read FButtonStyle write SetButtonStyle default sccbsWin2k;
property ButtonToday: TCaption read FButtonToday write SetButtonToday;
property Color default clWindow;
property CalColors: TSCCalendarColors read FCalColors write SetCalColors;
property DayCaptions: TSCCalendarDayCaptions read FDayCaptions write SetDayCaptions default scdcFirst;
property DayCaptionsFont: TFont read FDayCaptionsFont write SetDayCaptionsFont;
property Holidays: TSCHolidays read FHolidays write SetHolidays;
property ImageHighlight: TImageIndex read FImageHighlight write SetImageHighlight default -1;
property ImageSelection: TImageIndex read FImageSelection write SetImageSelection default -1;
property ImageToday: TImageIndex read FImageToday write SetImageToday default -1;
property NavigatorLeft: TImageIndex read FNavigatorLeft write SetNavigatorLeft default -1;
property NavigatorRight: TImageIndex read FNavigatorRight write SetNavigatorRight default -1;
property NavigatorFont: TFont read FNavigatorFont write SetNavigatorFont;
property NavigatorGradient: TSCGradient read FNavigatorGradient write SetNavigatorGradient default scgBottomToTop;
property NavigatorHeight: Integer read FNavigatorHeight write SetNavigatorHeight default -1;
property NavigatorStyle: TSCNavigatorStyle read FNavigatorStyle write SetNavigatorStyle default scnFlat;
property Options: TSCCalendarOptions read FOptions write SetOptions default SCCalendarDefOptions;
property ParentColor default False;
property PopupBorder: TSCControlBorder read FPopupBorder write SetPopupBorder default sccbFlat;
property PopupFont: TFont read FPopupFont write SetPopupFont;
property PopupType: TSCCalendarPopupType read FPopupType write SetPopupType default sccpMonthYear;
property SpecialDays: TSCSpecialDays read FSpecialDays write SetSpecialDays;
property StartOfWeek: TSCStartOfWeek read FStartOfWeek write SetStartOfWeek default scswLocaleDefault;
property WeekendDays: TSCWeekDayNames read FWeekendDays write SetWeekendDays default SCWeekendDays;
property WeekNumbersFont: TFont read FWeekNumbersFont write SetWeekNumbersFont;
property OnClearClick: TNotifyEvent read FOnClearClick write FOnClearClick;
property OnDateClick: TNotifyEvent read FOnDateClick write FOnDateClick;
property OnGetDateStyle: TSCGetDateStyleEvent read FOnGetDateStyle write FOnGetDateStyle;
property OnNavigate: TSCCalendarNavigateEvent read FOnNavigate write FOnNavigate;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure Assign(Source: TPersistent); override;
procedure SetBounds(ALeft, ATop, AWidth, AHeight: Integer); override;
function GetDateAtPos(X, Y: Integer): TDateTime;
function GetDateIndexAtPos(X, Y: Integer): Integer;
function GetIndexOfDate(D: TDateTime): Integer;
function GetPartAtPos(X, Y: Integer): TSCCalendarPart;
property Date: TDateTime read FDate write SetDate;
property FirstDate: TDateTime read FFirstDate;
property FocusedDate: TDate read FFocusedDate;
property DisplayMonth: Word read FDisplayMonth;
property DisplayYear: Word read FDisplayYear;
end;
TSCCalendar = class(TSCCustomCalendar)
published
property Align;
property AlignPopupText;
property Anchors;
property AutoSize;
property BiDiMode;
property BorderProps;
property ButtonFont;
property ButtonClear;
property ButtonStyle;
property ButtonToday;
property CalColors;
property Color default clWindow;
property ClickFocus;
property Constraints;
property Cursor;
property Date;
property DayCaptions;
property DayCaptionsFont;
property DragCursor;
property DragKind;
property DragMode;
property Enabled;
property FlatColor;
property Font;
property Holidays;
property ImageHighlight;
property ImageSelection;
property ImageToday;
property Images;
property Indent;
property NavigatorLeft;
property NavigatorRight;
property NavigatorFont;
property NavigatorGradient;
property NavigatorHeight;
property NavigatorStyle;
property Options;
property ParentBiDiMode;
property ParentColor default False;
property ParentFont;
property ParentShowHint;
property Picture;
property PictureProps;
property PopupBorder;
property PopupFont;
property PopupType;
property ShowHint;
property SpecialDays;
property StartOfWeek;
property TabOrder;
property TabStop default True;
property Transparent;
property Visible;
property WeekendDays;
property WeekNumbersFont;
property OnCanResize;
property OnChange;
property OnClearClick;
property OnClick;
property OnContextPopup;
property OnDateClick;
property OnDblClick;
property OnDragDrop;
property OnDragOver;
property OnEndDock;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnGetDateStyle;
property OnKeyDown;
property OnKeyPress;
property OnKeyUp;
property OnMouseDown;
property OnMouseEnter;
property OnMouseLeave;
property OnMouseMove;
property OnMouseUp;
property OnNavigate;
property OnResize;
property OnStartDock;
property OnStartDrag;
end;
TSCCustomPopupCalendar = class;
TSCPopupCalendarProps = class(TPersistent)
private
FOwner: TSCCustomPopupCalendar;
FAlignPopupText: Boolean;
FBorderStyle: TSCEditStyle;
FButtonFont: TFont;
FButtonClear: TCaption;
FButtonStyle: TSCCalButtonStyle;
FButtonToday: TCaption;
FCalColors: TSCCalendarColors;
FDayCaptions: TSCCalendarDayCaptions;
FDayCaptionsFont: TFont;
FFont: TFont;
FHolidays: TSCHolidays;
FImageHighlight: TImageIndex;
FImageSelection: TImageIndex;
FImageToday: TImageIndex;
FIndent: Integer;
FNavigatorFont: TFont;
FNavigatorLeft: TImageIndex;
FNavigatorRight: TImageIndex;
FNavigatorGradient: TSCGradient;
FNavigatorHeight: Integer;
FNavigatorStyle: TSCNavigatorStyle;
FOptions: TSCCalendarOptions;
FPopupBorder: TSCControlBorder;
FPopupFont: TFont;
FPopupType: TSCCalendarPopupType;
FSpecialDays: TSCSpecialDays;
FStartOfWeek: TSCStartOfWeek;
FWeekendDays: TSCWeekDayNames;
FWeekNumbersFont: TFont;
procedure SetAlignPopupText(Value: Boolean);
procedure SetButtonFont(Value: TFont);
procedure SetCalColors(Value: TSCCalendarColors);
procedure SetDayCaptionsFont(Value: TFont);
procedure SetFont(Value: TFont);
procedure SetHolidays(Value: TSCHolidays);
procedure SetImageHighlight(Value: TImageIndex);
procedure SetImageSelection(Value: TImageIndex);
procedure SetImageToday(Value: TImageIndex);
procedure SetIndent(Value: Integer);
procedure SetNavigatorFont(Value: TFont);
procedure SetNavigatorLeft(Value: TImageIndex);
procedure SetNavigatorRight(Value: TImageIndex);
procedure SetNavigatorHeight(Value: Integer);
procedure SetPopupBorder(Value: TSCControlBorder);
procedure SetPopupFont(Value: TFont);
procedure SetPopupType(Value: TSCCalendarPopupType);
procedure SetSpecialDays(Value: TSCSpecialDays);
procedure SetWeekNumbersFont(Value: TFont);
protected
function GetOwner: TPersistent; override;
public
constructor Create(AOwner: TSCCustomPopupCalendar); virtual;
destructor Destroy; override;
procedure Assign(Source: TPersistent); override;
property Owner: TSCCustomPopupCalendar read FOwner;
published
property AlignPopupText: Boolean read FAlignPopupText write SetAlignPopupText default False;
property BorderStyle: TSCEditStyle read FBorderStyle write FBorderStyle default scesDefault;
property ButtonFont: TFont read FButtonFont write SetButtonFont;
property ButtonClear: TCaption read FButtonClear write FButtonClear;
property ButtonStyle: TSCCalButtonStyle read FButtonStyle write FButtonStyle default sccbsWin2k;
property ButtonToday: TCaption read FButtonToday write FButtonToday;
property CalColors: TSCCalendarColors read FCalColors write SetCalColors;
property DayCaptions: TSCCalendarDayCaptions read FDayCaptions write FDayCaptions default scdcFirst;
property DayCaptionsFont: TFont read FDayCaptionsFont write SetDayCaptionsFont;
property Font: TFont read FFont write SetFont;
property Holidays: TSCHolidays read FHolidays write SetHolidays;
property ImageHighlight: TImageIndex read FImageHighlight write SetImageHighlight default -1;
property ImageSelection: TImageIndex read FImageSelection write SetImageSelection default -1;
property ImageToday: TImageIndex read FImageToday write SetImageToday default -1;
property Indent: Integer read FIndent write SetIndent default 0;
property NavigatorFont: TFont read FNavigatorFont write SetNavigatorFont;
property NavigatorLeft: TImageIndex read FNavigatorLeft write SetNavigatorLeft default -1;
property NavigatorRight: TImageIndex read FNavigatorRight write SetNavigatorRight default -1;
property NavigatorGradient: TSCGradient read FNavigatorGradient write FNavigatorGradient default scgBottomToTop;
property NavigatorHeight: Integer read FNavigatorHeight write SetNavigatorHeight default -1;
property NavigatorStyle: TSCNavigatorStyle read FNavigatorStyle write FNavigatorStyle default scnFlat;
property Options: TSCCalendarOptions read FOptions write FOptions default SCCalendarDefOptions;
property PopupBorder: TSCControlBorder read FPopupBorder write SetPopupBorder default sccbFlat;
property PopupFont: TFont read FPopupFont write SetPopupFont;
property PopupType: TSCCalendarPopupType read FPopupType write SetPopupType default sccpMonthYear;
property SpecialDays: TSCSpecialDays read FSpecialDays write SetSpecialDays;
property StartOfWeek: TSCStartOfWeek read FStartOfWeek write FStartOfWeek default scswLocaleDefault;
property WeekendDays: TSCWeekDayNames read FWeekendDays write FWeekendDays default SCWeekendDays;
property WeekNumbersFont: TFont read FWeekNumbersFont write SetWeekNumbersFont;
end;
TSCDTValidationErrorEvent = procedure(Sender: TObject; var ADateTime: TDateTime; var ErrorText: String;
var RaiseError: Boolean) of object;
TSCCustomPopupCalendar = class(TSCCustomDropDown)
private
FCalendar: TSCCustomCalendar;
FCalendarProps: TSCPopupCalendarProps;
FDate: TDateTime;
FDateValidation: TSCDateValidation;
FDisplayFormat: TCaption;
FSaveTime: Boolean;
FTime: TDateTime;
FOnDateChange: TNotifyEvent;
FOnClearClick: TNotifyEvent;
FOnGetDateStyle: TSCGetDateStyleEvent;
FOnValidationError: TSCDTValidationErrorEvent;
procedure SetDate(Value: TDateTime);
procedure SetDisplayFormat(Value: TCaption);
procedure SetCalendarProps(Value: TSCPopupCalendarProps);
procedure DateChanged;
procedure PopupDateChanged(Sender: TObject);
procedure ClearButtonClick(Sender: TObject);
procedure GetDateStyle(Sender: TObject; Day, Month: Word; Year: Integer;
var BkColor, ForeColor: TColor; var FontStyle: TFontStyles);
procedure ValidationError(ErrorTxt: String);
procedure CMWinIniChange(var Message: TWMWinIniChange); message CM_WININICHANGE;
protected
procedure WndProc(var Message: TMessage); override;
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
procedure DoInternalChange; override;
procedure BeforeExit; override;
function IsDescription: Boolean; override;
function GetDescriptionText: String; override;
function GetDescriptionColor: TColor; override;
function GetButtonPropsClass: TSCCustomEditButtonPropsClass; override;
procedure UpdateDateFromText; dynamic;
procedure DoValidationError(var ADate: TDateTime; var ErrorText: String;
var RaiseError: Boolean); dynamic;
function GetPopupStyle: TSCEditStyle; override;
procedure DropDownPopupbox; override;
procedure CloseUp; override;
procedure PrepareDropWindow; override;
function CanDropDown: Boolean; override;
function GetDroppedDown: Boolean; override;
function GetDropDownWindow: TWinControl; override;
procedure DoDateChange; dynamic;
function DoWantKeyDown(var Key: Word; Shift: TShiftState): Boolean; override;
procedure KeyDown(var Key: Word; Shift: TShiftState); override;
procedure KeyPress(var Key: Char); override;
property CalendarProps: TSCPopupCalendarProps read FCalendarProps write SetCalendarProps;
property Date: TDateTime read FDate write SetDate;
property DateValidation: TSCDateValidation read FDateValidation write FDateValidation default scdvSetToNull;
property DisplayFormat: TCaption read FDisplayFormat write SetDisplayFormat;
property IsDropDown default False;
property SaveTime: Boolean read FSaveTime write FSaveTime default True;
property OnDateChange: TNotifyEvent read FOnDateChange write FOnDateChange;
property OnClearClick: TNotifyEvent read FOnClearClick write FOnClearClick;
property OnGetDateStyle: TSCGetDateStyleEvent read FOnGetDateStyle write FOnGetDateStyle;
property OnValidationError: TSCDTValidationErrorEvent read FOnValidationError write FOnValidationError;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure Assign(Source: TPersistent); override;
end;
TSCPopupCalendar = class(TSCCustomPopupCalendar)
public
property ShowPicture;
published
property Align;
property Alignment;
property Anchors;
property AutoComplete;
property AutoSelect;
property AutoSize;
property BorderProps;
property ButtonStyle;
property ButtonProps;
property CalendarProps;
property CanDragSelection;
property CanSelect;
property Checkbox;
property Colors;
property Constraints;
property Date;
property DateValidation;
property Description;
property DescriptionMode;
property DisplayFormat;
property DragCursor;
property DragKind;
property DragMode;
property DropDownKey;
property EditCursor;
property EditMode;
property Enabled;
property EnterAsTab;
property FocusExpandSize;
property Font;
property HideSelection;
property ImageIndex;
property Images;
property InsertChangesEditMode;
property IsDropDown;
property Layout;
property Picture;
property PictureProps;
property ReadOnly;
property SaveTime;
property ShowHint;
property Style;
property TabOrder;
property TabStop;
property Transparent;
property UndoLimit;
property UseCaret;
property UseDefaultMenu;
property UseImage;
property UseUndo;
property Visible;
property OnAutoComplete;
property OnCanResize;
property OnCaretMove;
property OnChange;
property OnCheckboxChange;
property OnClearClick;
property OnClick;
property OnCloseUp;
property OnConstrainedResize;
property OnContextPopup;
property OnDateChange;
property OnDblClick;
property OnDragDrop;
property OnDragOver;
property OnDropDown;
property OnEditModeChange;
property OnEndDock;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnGetDateStyle;
property OnKeyDown;
property OnKeyPress;
property OnKeyUp;
property OnMouseDown;
property OnMouseEnter;
property OnMouseLeave;
property OnMouseMove;
property OnMouseUp;
property OnResize;
property OnStartDock;
property OnStartDrag;
property OnValidationError;
end;
TSCCustomTimeEdit = class(TSCCustomFrameEdit)
private
FTime: TTime;
FTimeValidation: TSCTimeValidation;
FDisplayFormat: TCaption;
FOnTimeChange: TNotifyEvent;
FOnValidationError: TSCDTValidationErrorEvent;
procedure SetDisplayFormat(Value: TCaption);
procedure SetTime(Value: TTime);
procedure TimeChanged;
procedure ValidationError(ErrorTxt: String);
procedure CMWinIniChange(var Message: TWMWinIniChange); message CM_WININICHANGE;
protected
procedure Loaded; override;
procedure BeforeExit; override;
function IsDescription: Boolean; override;
function GetDescriptionText: String; override;
function GetDescriptionColor: TColor; override;
procedure UpdateTimeFromText; dynamic;
procedure DoValidationError(var ATime: TTime; var ErrorText: String;
var RaiseError: Boolean); dynamic;
procedure DoTimeChange; dynamic;
procedure KeyDown(var Key: Word; Shift: TShiftState); override;
procedure KeyPress(var Key: Char); override;
property DisplayFormat: TCaption read FDisplayFormat write SetDisplayFormat;
property Time: TTime read FTime write SetTime;
property TimeValidation: TSCTimeValidation read FTimeValidation write FTimeValidation default sctvSetToNow;
property OnTimeChange: TNotifyEvent read FOnTimeChange write FOnTimeChange;
property OnValidationError: TSCDTValidationErrorEvent read FOnValidationError write FOnValidationError;
public
constructor Create(AOwner: TComponent); override;
procedure AfterConstruction; override;
procedure Assign(Source: TPersistent); override;
end;
TSCTimeEdit = class(TSCCustomTimeEdit)
public
property ShowPicture;
published
property Align;
property Alignment;
property Anchors;
property AutoComplete;
property AutoSelect;
property AutoSize;
property BorderProps;
property Checkbox;
property CanSelect;
property Colors;
property Constraints;
property Description;
property DescriptionMode;
property DisplayFormat;
property DragCursor;
property DragKind;
property DragMode;
property EditCursor;
property EditMode;
property Enabled;
property EnterAsTab;
property Font;
property HideSelection;
property ImageIndex;
property Images;
property InsertChangesEditMode;
property Layout;
property Picture;
property PictureProps;
property ReadOnly;
property ShowHint;
property Style;
property TabOrder;
property TabStop;
property Time;
property TimeValidation;
property Transparent;
property UndoLimit;
property UseCaret;
property UseDefaultMenu;
property UseImage;
property UseUndo;
property Visible;
property OnAutoComplete;
property OnCanResize;
property OnCaretMove;
property OnChange;
property OnCheckboxChange;
property OnClick;
property OnConstrainedResize;
property OnContextPopup;
property OnDblClick;
property OnDragDrop;
property OnDragOver;
property OnEditModeChange;
property OnEndDock;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnKeyDown;
property OnKeyPress;
property OnKeyUp;
property OnMouseDown;
property OnMouseEnter;
property OnMouseLeave;
property OnMouseMove;
property OnMouseUp;
property OnResize;
property OnStartDock;