Repository navigation
Expand file tree
/
Copy pathSCSimpleListbox.pas
More file actions
7057 lines (5890 loc) · 174 KB
/
Copy pathSCSimpleListbox.pas
File metadata and controls
7057 lines (5890 loc) · 174 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 SCSimpleListbox;
{$I SweetControls.inc}
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ImgList, SCConsts, SCCommon, SCControl, SCEdits;
type
TSCCustomSimpleListbox = class;
TSCSimpleListState = set of (sclsChecked, sclsGrayed, sclsSelected, sclsFocused,
sclsHottrack, sclsDisabled, sclsEditing);
TSCDrawListItemEvent = procedure(Control: TWinControl; C: TCanvas;
Index: Integer; Rect: TRect; State: TSCSimpleListState;
UserData: Integer; var Done: Boolean) of object;
TSCMeasureListItemEvent = procedure(Control: TWinControl; Index: Integer;
var AWidth, AHeight, AIndent: Integer) of object;
TSCListItemEvent = procedure(Sender: TObject; Index: Integer) of object;
TSCValidateEditorEvent = procedure(Sender: TObject; Index: Integer;
var Text: String; var AcceptEdit: Boolean) of object;
TSCShowEditorEvent = procedure(Sender: TObject; Index: Integer; var AllowEdit: Boolean) of object;
TSCPrepareEditorEvent = procedure(Sender: TObject; var ABorder: TSCControlBorder;
var ABorderColor, AColor, AFontColor: TColor; var ATransparency: Boolean) of object;
TSCSizeEditorEvent = procedure(Sender: TObject; Index: Integer; var EditRect: TRect) of object;
TSCClickCheckEvent = procedure(Control: TWinControl; Index: Integer) of object;
TSCListPaintHint = procedure(Sender: TObject; Index: Integer; C: TCanvas;
R: TRect; HintText: String) of object;
TSCListHintEvent = procedure(Sender: TObject; Index: Integer; var R: TRect;
var HintText: String; var AllowShow: Boolean) of object;
TSCListboxScrollbar = class(TSCControlScrollbar)
published
property Background;
property ButtonColors;
property Icons;
property SlideLine;
property Thumb;
end;
{ ************************************************************************* }
{ }
{ item data map }
{ }
{ Data[Index, 0] is item height }
{ Data[Index, 1] is item width }
{ Data[Index, 2] is item selection flag }
{ Data[Index, 3] is item selection backup flag for mouse move with ssCtrl }
{ Data[Index, 4] is item check state }
{ Data[Index, 5] is item enabled state, if Data[Index, 5] = 0 then Enabled }
{ Data[Index, 6] is item indent level }
{ Data[Index, 7] is item image index }
{ Data[Index, 9] is external item data storage }
{ }
{ ************************************************************************* }
TSCListBorderProps = class(TSCControlBorderProps)
public
constructor Create(AOwner: TSCCustomControl); override;
published
property Border default sccb3DLowered;
property Color;
property ExDraw;
property FlatColor;
property FlatInnerColor;
property InnerBorder;
property Width;
end;
TSCListCustomColors = class(TPersistent)
private
FOwner: TSCCustomSimpleListbox;
function GetDisabledColor: TColor;
procedure SetDisabledColor(Value: TColor);
function GetDisabledTextColor: TColor;
procedure SetDisabledTextColor(Value: TColor);
function GetHideSelectionBorderColor: TColor;
procedure SetHideSelectionBorderColor(Value: TColor);
function GetHideSelectionColor: TColor;
procedure SetHideSelectionColor(Value: TColor);
function GetHideSelectionTextColor: TColor;
procedure SetHideSelectionTextColor(Value: TColor);
function GetHighlightBorderColor: TColor;
procedure SetHighlightBorderColor(Value: TColor);
function GetHighlightColor: TColor;
procedure SetHighlightColor(Value: TColor);
function GetHighlightTextColor: TColor;
procedure SetHighlightTextColor(Value: TColor);
function GetAlternateColor: TColor;
procedure SetAlternateColor(Value: TColor);
protected
function GetOwner: TPersistent; override;
property AlternateColor: TColor read GetAlternateColor write SetAlternateColor default clNone;
property DisabledColor: TColor read GetDisabledColor write SetDisabledColor default clBtnFace;
property DisabledTextColor: TColor read GetDisabledTextColor write SetDisabledTextColor default clGrayText;
property HideSelectionBorderColor: TColor read GetHideSelectionBorderColor write SetHideSelectionBorderColor default clNone;
property HideSelectionColor: TColor read GetHideSelectionColor write SetHideSelectionColor default clBtnFace;
property HideSelectionTextColor: TColor read GetHideSelectionTextColor write SetHideSelectionTextColor default clBtnText;
property HighlightBorderColor: TColor read GetHighlightBorderColor write SetHighlightBorderColor default clNone;
property HighlightColor: TColor read GetHighlightColor write SetHighlightColor default clHighlight;
property HighlightTextColor: TColor read GetHighlightTextColor write SetHighlightTextColor default clHighlightText;
public
constructor Create(AOwner: TSCCustomSimpleListbox); virtual;
procedure Assign(Source: TPersistent); override;
property Owner: TSCCustomSimpleListbox read FOwner;
end;
TSCListCustomColorsClass = class of TSCListCustomColors;
TSCListColors = class(TSCListCustomColors)
published
property AlternateColor;
property DisabledColor;
property DisabledTextColor;
property HideSelectionBorderColor;
property HideSelectionColor;
property HideSelectionTextColor;
property HighlightBorderColor;
property HighlightColor;
property HighlightTextColor;
end;
TSCListScrollbars = class(TSCControlScrollbars)
private
function GetShowHorizontal: Boolean;
procedure SetShowHorizontal(Value: Boolean);
function GetShowVertical: Boolean;
procedure SetShowVertical(Value: Boolean);
public
procedure Assign(Source: TPersistent); override;
published
property ShowHorizontal: Boolean read GetShowHorizontal write SetShowHorizontal default True;
property ShowVertical: Boolean read GetShowVertical write SetShowVertical;
end;
TSCListPictureProps = class(TSCPictureProps);
TSCCustomSimpleListbox = class(TSCCustomScrollControl)
private
FAllowEdit: Boolean;
FAllowMouseEdit: Boolean;
FAllowGrayed: Boolean;
FAlternateColor: TColor;
FCenterImages: Boolean;
FColors: TSCListCustomColors;
FColumns: Integer;
FContinuousKeySearch: Boolean;
FDisabledColor: TColor;
FDisabledTextColor: TColor;
FEndEllipsis: Boolean;
FExtendedSelect: Boolean;
FFlat: TSCSimpleCheckFlat;
FHideFocusRect: Boolean;
FHideSelection: Boolean;
FHideSelectionBorderColor: TColor;
FHideSelectionColor: TColor;
FHideSelectionTextColor: TColor;
FHighlightBorderColor: TColor;
FHighlightColor: TColor;
FHighlightTextColor: TColor;
FHottrack: Boolean;
FHottrackColor: TColor;
FHottrackUnderline: Boolean;
FStartIndex: Integer;
FItems: TStrings;
FItemHeight: Integer;
FItemIndex: Integer;
FLayout: TSCLayout;
FLineSelect: Boolean;
FMultiSelect: Boolean;
FScrollbarHorizontal: Boolean;
FScrollbarVertical: Boolean;
FScrollHeight: LongInt;
FScrollWidth: LongInt;
FShowCheckboxes: Boolean;
FShowItemHints: Boolean;
FShowItemImages: Boolean;
FShowItemOnSelect: Boolean;
FTopIndex: Integer;
FHotIndex: Integer;
FDefaultHeight: Integer;
FValues: TStrings;
FMouseDownIndex: Integer;
FMouseDownShift: TShiftState;
FSelectionClears: Boolean;
FHorizontalPos: Integer;
FSorted: Boolean;
FOnClickCheck: TSCClickCheckEvent;
FOnDrawItem: TSCDrawListItemEvent;
FOnHideEditor: TSCListItemEvent;
FOnHottrack: TSCListItemEvent;
FOnMeasureItem: TSCMeasureListItemEvent;
FOnPaintHint: TSCListPaintHint;
FOnPrepareEditor: TSCPrepareEditorEvent;
FOnShowEditor: TSCShowEditorEvent;
FOnShowItemHint: TSCListHintEvent;
FOnSizeEditor: TSCSizeEditorEvent;
FOnValidateEditor: TSCValidateEditorEvent;
FInplaceEditor: TSCCustomEdit;
FInplaceEditorClass: TSCCustomEditClass;
FEditSavedText: String;
FInplaceOldWndProc: TWndMethod;
FHintWnd: THintWindow;
FHintIndex: Integer;
FHintText: String;
FHintOldWndProc: TWndMethod;
FRevertable: Boolean;
FScrolling: Boolean;
FScrollTimer: Integer;
FItemHintLock: Integer;
FClickedIndex: Integer;
FClickTimer: LongInt;
FInEditShow: Boolean;
FBypassEditing: Boolean;
FSearchText: String;
FSearchTickCount: DWord;
FForceDropdownClick: Boolean;
FDropping: Boolean;
FScrollPosChanging: Integer;
FScrollbarChanging: Integer;
FCreatingWnd: Integer;
FOffice12Style: Boolean;
function GetObject(Index: Integer): TObject;
procedure SetObject(Index: Integer; Value: TObject);
function GetString(Index: Integer): String;
procedure SetString(Index: Integer; const Value: String);
function GetChecked(Index: Integer): Boolean;
procedure SetChecked(Index: Integer; Value: Boolean);
function GetState(Index: Integer): TSCCheckState;
procedure SetState(Index: Integer; Value: TSCCheckState);
function GetIndentLevel(Index: Integer): Integer;
procedure SetIndentLevel(Index: Integer; Value: Integer);
function GetItemEnabled(Index: Integer): Boolean;
procedure SetItemEnabled(Index: Integer; Value: Boolean);
function GetItemImage(Index: Integer): Integer;
procedure SetItemImage(Index: Integer; Value: Integer);
procedure SetAllowEdit(Value: Boolean);
procedure SetAlternateColor(Value: TColor);
procedure SetCenterImages(Value: Boolean);
procedure SetColors(Value: TSCListCustomColors);
procedure SetColumns(Value: Integer);
procedure SetContinuousKeySearch(Value: Boolean);
procedure SetDisabledColor(Value: TColor);
procedure SetDisabledTextColor(Value: TColor);
procedure SetEndEllipsis(Value: Boolean);
procedure SetExtendedSelect(Value: Boolean);
procedure SetFlat(Value: TSCSimpleCheckFlat);
procedure SetHideFocusRect(Value: Boolean);
procedure SetHideSelection(Value: Boolean);
procedure SetHideSelectionBorderColor(Value: TColor);
procedure SetHideSelectionColor(Value: TColor);
procedure SetHideSelectionTextColor(Value: TColor);
procedure SetHighlightBorderColor(Value: TColor);
procedure SetHighlightColor(Value: TColor);
procedure SetHighlightTextColor(Value: TColor);
procedure SetHorizontalPos(Value: Integer);
procedure SetHottrack(Value: Boolean);
procedure SetHottrackColor(Value: TColor);
procedure SetHottrackUnderline(Value: Boolean);
procedure SetItemHeight(Value: Integer);
procedure SetItemIndex(Value: Integer);
function GetItems: TStrings;
procedure SetItems(Value: TStrings);
procedure SetLayout(Value: TSCLayout);
procedure SetLineSelect(Value: Boolean);
procedure SetMultiSelect(Value: Boolean);
procedure SetScrollbarHorizontal(Value: Boolean);
procedure SetScrollbarVertical(Value: Boolean);
function GetSelected(Index: Integer): Boolean;
procedure SetSelected(Index: Integer; Value: Boolean);
procedure SetShowCheckboxes(Value: Boolean);
procedure SetShowItemImages(Value: Boolean);
procedure SetSorted(Value: Boolean);
procedure SetTopIndex(Value: Integer);
procedure SetValues(Value: TStrings);
procedure SetOffice12Style(Value: Boolean);
procedure ItemsChanged(Sender: TObject);
procedure SetScrollBounds(AWidth, AHeight: LongInt);
procedure CMFontChanged(var Message: TMessage); message CM_FONTCHANGED;
procedure WMEraseBkgnd(var Message: TWMEraseBkgnd); message WM_ERASEBKGND;
procedure WMGetDlgCode(var Message: TWMGetDlgCode); message WM_GETDLGCODE;
procedure WMLButtonDown(var Message: TWMLButtonDown); message WM_LBUTTONDOWN;
procedure WMMouseWheel(var Message: TWMMouseWheel); message WM_MOUSEWHEEL;
procedure WMHScroll(var Message: TWMHScroll); message WM_HSCROLL;
procedure WMVScroll(var Message: TWMVScroll); message WM_VSCROLL;
procedure WMSize(var Message: TWMSize); message WM_SIZE;
procedure WMTimer(var Message: TWMTimer); message WM_TIMER;
procedure KillClickTimer;
procedure InitiateClickTimer;
procedure HintWindowProc(var Message: TMessage);
procedure InplaceWindowProc(var Message: TMessage);
procedure InplaceChanged(Sender: TObject);
function SwitchState(St: TSCCheckState): TSCCheckState;
procedure MeasureItem(Index: Integer; var AWidth, AHeight, AIndent: Integer);
procedure UpdateScrollbars(Horz, Vert: Boolean);
protected
procedure WndProc(var Message: TMessage); override;
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
procedure CreateParams(var Params: TCreateParams); override;
procedure CreateWnd; override;
procedure Paint; override;
procedure Loaded; override;
procedure DragCanceled; override;
procedure SortItems; virtual;
function GetCount: Integer; virtual;
function GetSelectedValue: String; virtual;
procedure ValuesChanged(Sender: TObject); virtual;
function GetBorderPropsClass: TSCControlBorderPropsClass; override;
function GetListColorsClass: TSCListCustomColorsClass; dynamic;
function GetPicturePropsClass: TSCCustomPicturePropsClass; override;
function GetControlScrollbarsClass: TSCControlCustomScrollbarsClass; override;
procedure CanChangeCheckState(OldSt: TSCCheckState; var NewSt: TSCCheckState); dynamic;
function CanChangeItemIndex(Index: Integer): Integer; dynamic;
function CanEdit(Index: Integer): Boolean; dynamic;
function CanScrollToPos(Kind: TSCScrollbarKind; var NewValue: Integer): Boolean; override;
procedure DoScrollerPositionChanged(Kind: TSCScrollbarKind); override;
function CreateItems: TStrings; dynamic;
procedure DoSetItems; dynamic;
procedure DoInternalDataChanged(Index: Integer); dynamic;
procedure DoInternalItemsChanged; dynamic;
procedure SetIndent(Value: Integer); override;
procedure ColorsChanged; dynamic;
procedure IndentChanged; override;
procedure ImageListChange(Sender: TObject); override;
procedure StopTracking; override;
procedure MouseInControlChanged; override;
function GetBlendValue: Word; override;
procedure MakeVisible(Index: Integer);
procedure ShowHintWindow(P: TPoint; CheckHintSize: Boolean = True);
procedure HideHintWindow;
procedure SetHotIndex(Value: Integer; DoUpdate: Boolean = True);
procedure DoHotChange; dynamic;
procedure SetInplaceEditorClass(Value: TSCCustomEditClass); virtual;
function GetInplaceEditorClass: TSCCustomEditClass; virtual;
function GetEditText: String; virtual;
procedure SetEditText(const Value: String); virtual;
procedure PrepareEditor; dynamic;
procedure SizeEditor; dynamic;
function CanShowEditor: Boolean; dynamic;
procedure DoShowEditor(Index: Integer; var AllowEdit: Boolean); dynamic;
procedure DoSizeEditor(Index: Integer; var EditRect: TRect); dynamic;
procedure DoHideEditor(Index: Integer);
procedure DoValidateEditor(Index: Integer; var Text: String; var AcceptEdit: Boolean); dynamic;
procedure ClickCheck(Index: Integer); dynamic;
procedure DoItemClick(Index: Integer); dynamic;
procedure UpdateHotTrack(Draw: Boolean = True);
procedure UpdateItem(C: TCanvas; Index: Integer);
procedure BeforePaintItem(C: TCanvas; Index: Integer; ClientR, R: TRect;
State: TSCSimpleListState); virtual;
procedure AfterPaintItem(C: TCanvas; Index: Integer; ClientR, R: TRect;
State: TSCSimpleListState); virtual;
procedure DoPaintBack(C: TCanvas); virtual;
procedure DoPaintItem(C: TCanvas; Index: Integer; ClientR, R: TRect);
procedure DoDrawCheckMark(C: TCanvas; R: TRect; Cl: TColor); virtual;
procedure DoDrawCheckbox(C: TCanvas; Index: Integer; CR, R: TRect; State: TSCSimpleListState); virtual;
procedure DoDrawItem(C: TCanvas; Index: Integer; CR, R: TRect;
State: TSCSimpleListState); virtual;
procedure DrawOffice12Face(ACanvas: TCanvas; ARect: TRect;
AColor: TColor; AFace, AFrame: Boolean);
procedure VerifyIndex(var Index: Integer); dynamic;
procedure VerifyTopIndex(var Index: Integer); dynamic;
procedure VerifyHorizontalPos(var P: Integer); dynamic;
procedure UpdateBounds(var AWidth, AHeight: LongInt);
function GetItemHeight: Integer;
procedure GetItemBounds(Index: Integer; var AWidth, AHeight, AIndent: Integer); virtual;
function GetHorzScrollPos: Integer; dynamic;
procedure DoScrollBoundsChanged; dynamic;
function GetScrollbarClass: TSCCustomControlScrollbarClass; override;
function GetGradientShadow(AColor: TColor): TColor;
function GetGradientDark(AColor: TColor): TColor;
function GetGradientLight(AColor: TColor): TColor;
function GetGradientExDark(AColor: TColor): TColor;
function GetGradientExLight(AColor: TColor): TColor;
function GetGradientPeal(AColor: TColor): TColor;
function GetGradientPreDark(AColor: TColor): TColor;
function GetGradientPreLight(AColor: TColor): TColor;
procedure ProcessSearchKey(Key: Char); virtual;
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;
procedure KeyPress(var Key: Char); override;
function GetMaxWidth: Integer; virtual;
function GetCheckWidth: Integer;
function GetColumnHeight: Integer; dynamic;
function GetColumnCount: Integer; dynamic;
function GetColumnOf(Index: Integer): Integer; dynamic;
function GetPageDownIndex(Index: Integer): Integer; dynamic;
function GetPageUpIndex(Index: Integer): Integer; dynamic;
function UpdateVertScrollBar: Boolean; dynamic;
function UpdateHorzScrollBar: Boolean; dynamic;
function IsVertScrollBarVisible: Boolean; override;
function IsHorzScrollBarVisible: Boolean; override;
function CanShowVertScrollBar: Boolean; dynamic;
function CanShowHorzScrollBar: Boolean; dynamic;
procedure DoMeasureItem(Index: Integer; var AWidth, AHeight, AIndent: Integer); virtual;
function InternalGetItemData(Index: Integer): Longint; dynamic;
procedure InternalSetItemData(Index: Integer; AData: Longint); dynamic;
function GetItemData(Index: Integer): LongInt; dynamic;
procedure SetItemData(Index: Integer; AData: LongInt); dynamic;
procedure ResetContent; dynamic;
procedure DeleteString(Index: Integer); dynamic;
procedure StartScrolling;
procedure StopScrolling;
function Scrolling: Boolean;
function ScrollPaused: Boolean;
procedure PauseScrolling;
procedure ResumeScrolling;
procedure LockItemHint;
procedure UnlockItemHint;
function ItemHintLocked: Boolean;
property InEditShow: Boolean read FInEditShow;
property ScrollHeight: LongInt read FScrollHeight;
property ScrollWidth: LongInt read FScrollWidth;
property Count: Integer read GetCount;
property Dropping: Boolean read FDropping write FDropping;
property ForceDropdownClick: Boolean read FForceDropdownClick write FForceDropdownClick default False;
property Items: TStrings read GetItems write SetItems;
property Objects[Index: Integer]: TObject read GetObject write SetObject;
property Strings[Index: Integer]: String read GetString write SetString;
property Checked[Index: Integer]: Boolean read GetChecked write SetChecked;
property State[Index: Integer]: TSCCheckState read GetState write SetState;
property IndentLevel[Index: Integer]: Integer read GetIndentLevel write SetIndentLevel;
property ItemEnabled[Index: Integer]: Boolean read GetItemEnabled write SetItemEnabled;
property ItemImage[Index: Integer]: Integer read GetItemImage write SetItemImage;
property AllowGrayed: Boolean read FAllowGrayed write FAllowGrayed default False;
property AllowEdit: Boolean read FAllowEdit write SetAllowEdit default False;
property AllowMouseEdit: Boolean read FAllowMouseEdit write FAllowMouseEdit default True;
property AlternateColor: TColor read FAlternateColor write SetAlternateColor default clNone;
property CenterImages: Boolean read FCenterImages write SetCenterImages default False;
property Colors: TSCListCustomColors read FColors write SetColors;
property Columns: Integer read FColumns write SetColumns default 0;
property ContinuousKeySearch: Boolean read FContinuousKeySearch write SetContinuousKeySearch default False;
property DisabledColor: TColor read FDisabledColor write SetDisabledColor default clBtnFace;
property DisabledTextColor: TColor read FDisabledTextColor write SetDisabledTextColor default clGrayText;
property EditText: String read GetEditText write SetEditText;
property EndEllipsis: Boolean read FEndEllipsis write SetEndEllipsis default False;
property ExtendedSelect: Boolean read FExtendedSelect write SetExtendedSelect default True;
property Flat: TSCSimpleCheckFlat read FFlat write SetFlat default scsfFlat;
property HideFocusRect: Boolean read FHideFocusRect write SetHideFocusRect default False;
property HideSelection: Boolean read FHideSelection write SetHideSelection default False;
property HideSelectionBorderColor: TColor read FHideSelectionBorderColor write SetHideSelectionBorderColor default clNone;
property HideSelectionColor: TColor read FHideSelectionColor write SetHideSelectionColor default clBtnFace;
property HideSelectionTextColor: TColor read FHideSelectionTextColor write SetHideSelectionTextColor default clBtnText;
property HighlightBorderColor: TColor read FHighlightBorderColor write SetHighlightBorderColor default clNone;
property HighlightColor: TColor read FHighlightColor write SetHighlightColor default clHighlight;
property HighlightTextColor: TColor read FHighlightTextColor write SetHighlightTextColor default clHighlightText;
property HorizontalPos: Integer read FHorizontalPos write SetHorizontalPos default 0;
property HotIndex: Integer read FHotIndex;
property Hottrack: Boolean read FHottrack write SetHottrack default True;
property HottrackColor: TColor read FHottrackColor write SetHottrackColor default clHighlight;
property HottrackUnderline: Boolean read FHottrackUnderline write SetHottrackUnderline default False;
property InplaceEditor: TSCCustomEdit read FInplaceEditor;
property InplaceEditorClass: TSCCustomEditClass read GetInplaceEditorClass write SetInplaceEditorClass;
property ItemHeight: Integer read FItemHeight write SetItemHeight default -1;
property ItemIndex: Integer read FItemIndex write SetItemIndex default -1;
property Layout: TSCLayout read FLayout write SetLayout default sclaTop;
property LineSelect: Boolean read FLineSelect write SetLineSelect default True;
property MultiSelect: Boolean read FMultiSelect write SetMultiSelect default False;
property Revertable: Boolean read FRevertable write FRevertable default False;
property ScrollbarHorizontal: Boolean read FScrollbarHorizontal write SetScrollbarHorizontal default True;
property ScrollbarVertical: Boolean read FScrollbarVertical write SetScrollbarVertical default True;
property Selected[Index: Integer]: Boolean read GetSelected write SetSelected;
property SelectedValue: String read GetSelectedValue;
property ShowCheckboxes: Boolean read FShowCheckboxes write SetShowCheckboxes default False;
property ShowItemHints: Boolean read FShowItemHints write FShowItemHints default False;
property ShowItemImages: Boolean read FShowItemImages write SetShowItemImages default False;
property ShowItemOnSelect: Boolean read FShowItemOnSelect write FShowItemOnSelect default True;
property Sorted: Boolean read FSorted write SetSorted default False;
property TopIndex: Integer read FTopIndex write SetTopIndex;
property Values: TStrings read FValues write SetValues;
property Office12Style: Boolean read FOffice12Style write SetOffice12Style default False;
property OnClickCheck: TSCClickCheckEvent read FOnClickCheck write FOnClickCheck;
property OnDrawItem: TSCDrawListItemEvent read FOnDrawItem write FOnDrawItem;
property OnHideEditor: TSCListItemEvent read FOnHideEditor write FOnHideEditor;
property OnHottrack: TSCListItemEvent read FOnHottrack write FOnHottrack;
property OnMeasureItem: TSCMeasureListItemEvent read FOnMeasureItem write FOnMeasureItem;
property OnPaintHint: TSCListPaintHint read FOnPaintHint write FOnPaintHint;
property OnPrepareEditor: TSCPrepareEditorEvent read FOnPrepareEditor write FOnPrepareEditor;
property OnShowEditor: TSCShowEditorEvent read FOnShowEditor write FOnShowEditor;
property OnShowItemHint: TSCListHintEvent read FOnShowItemHint write FOnShowItemHint;
property OnValidateEditor: TSCValidateEditorEvent read FOnValidateEditor write FOnValidateEditor;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure Assign(Source: TPersistent); override;
function IsEditing: Boolean;
procedure ShowEditor;
procedure HideEditor;
procedure PostEditor;
procedure BeginItemUpdate;
procedure EndItemUpdate;
function InItemUpdate: Boolean;
procedure Clear;
function ItemRect(Index: Integer; InView: Boolean): TRect;
function ItemAtPos(X, Y: Integer; InMouseMove: Boolean = False): Integer;
function ItemInView(Index: Integer; PartitialAllowed: Boolean = True): Boolean;
function FindItem(const S: String; StartPos, EndPos: Integer): Integer;
function CompletedItem(const S: String; CaseSensitive: Boolean): Integer;
function LastVisibleItem(PartitialAllowed: Boolean = True): Integer;
property Color default clWindow;
property ParentColor default False;
property TabStop default True;
end;
TSCSimpleListboxClass = class of TSCCustomSimpleListbox;
TSCSimpleListbox = class(TSCCustomSimpleListbox)
public
property Count;
property Objects;
property Checked;
property State;
property EditText;
property HotIndex;
property IndentLevel;
property ItemEnabled;
property ItemImage;
property ScrollHeight;
property ScrollWidth;
property Strings;
property ItemIndex;
property Selected;
property SelectedValue;
property TopIndex;
published
property Align;
property AllowGrayed;
property AllowEdit;
property AllowMouseEdit;
property Anchors;
property BiDiMode;
property BorderProps;
property CenterImages;
property Color;
property Colors;
property Columns;
property Constraints;
property ContinuousKeySearch;
property DragCursor;
property DragKind;
property DragMode;
property Enabled;
property EndEllipsis;
property ExtendedSelect;
property Flat;
property Font;
property HideFocusRect;
property HideSelection;
property Hottrack;
property HottrackColor;
property HottrackUnderline;
property Images;
property ImeMode;
property ImeName;
property Indent;
property ItemHeight;
property Items;
property Layout;
property LineSelect;
property MultiSelect;
property Office12Style;
property ParentBiDiMode;
property ParentColor;
property ParentFont;
property ParentShowHint;
property Picture;
property PictureProps;
property PopupMenu;
property Revertable;
property Scrollbars;
property ShowCheckboxes;
property ShowItemHints;
property ShowItemImages;
property ShowItemOnSelect;
property ShowHint;
property ShowSizeGrip;
property ShowStatusbar;
property Sorted;
property StatusbarAlignment;
property StatusbarColor;
property StatusbarText;
property TabOrder;
property TabStop;
property Transparent;
property Values;
property Visible;
property OnCanResize;
property OnClick;
property OnClickCheck;
property OnConstrainedResize;
property OnContextPopup;
property OnDblClick;
property OnDragDrop;
property OnDragOver;
property OnDrawItem;
property OnEndDock;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnHideEditor;
property OnHottrack;
property OnKeyDown;
property OnKeyPress;
property OnKeyUp;
property OnMeasureItem;
property OnMouseDown;
property OnMouseEnter;
property OnMouseLeave;
property OnMouseMove;
property OnMouseUp;
property OnPaintHint;
property OnPictureChange;
property OnPrepareEditor;
property OnResize;
property OnShowEditor;
property OnShowItemHint;
property OnStartDock;
property OnStartDrag;
property OnValidateEditor;
end;
TSCCustomListboxEx = class;
TSCListboxExItem = class(TCollectionItem)
private
FEnabled: Boolean;
FImageIndex: TImageIndex;
FIndentLevel: Integer;
FState: TSCCheckState;
FText: String;
FValue: String;
FData: TObject;
function GetChecked: Boolean;
procedure SetChecked(Value: Boolean);
procedure SetEnabled(Value: Boolean);
procedure SetImageIndex(Value: TImageIndex);
procedure SetIndentLevel(Value: Integer);
procedure SetState(Value: TSCCheckState);
procedure SetText(const Value: String);
procedure SetValue(const Value: String);
protected
function GetDisplayName: string; override;
function GetListboxEx: TSCCustomListboxEx;
function GetImages: TCustomImageList;
public
constructor Create(Collection: TCollection); override;
procedure Assign(Source: TPersistent); override;
property ListboxEx: TSCCustomListboxEx read GetListboxEx;
property Data: TObject read FData write FData;
published
property Checked: Boolean read GetChecked write SetChecked stored False default False;
property Enabled: Boolean read FEnabled write SetEnabled default True;
property ImageIndex: TImageIndex read FImageIndex write SetImageIndex default -1;
property IndentLevel: Integer read FIndentLevel write SetIndentLevel default 0;
property State: TSCCheckState read FState write SetState default sccbUnchecked;
property Text: String read FText write SetText;
property Value: String read FValue write SetValue;
end;
TSCListboxExItems = class(TCollection)
private
FOwner: TSCCustomListboxEx;
function GetItem(Index: Integer): TSCListboxExItem;
procedure SetItem(Index: Integer; Value: TSCListboxExItem);
protected
function GetOwner: TPersistent; override;
procedure Update(Item: TCollectionItem); override;
public
constructor Create(AOwner: TSCCustomListboxEx); virtual;
function Add: TSCListboxExItem;
function IndexOf(const S: String; CaseSensitive: Boolean = False): Integer;
function IndexOfValue(const S: String; CaseSensitive: Boolean = False): Integer;
{$IFDEF SC_DELPHI5_AND_EARLY}
property Owner: TSCCustomListboxEx read FOwner;
{$ENDIF}
property Items[Index: Integer]: TSCListboxExItem read GetItem write SetItem; default;
end;
TSCCustomListboxEx = class(TSCCustomSimpleListbox)
private
FInExChange: Integer;
FItemsEx: TSCListboxExItems;
procedure SetItemsEx(Value: TSCListboxExItems);
procedure ExItemChanged(Item: TSCListboxExItem);
procedure ExItemsChanged;
protected
procedure DoInternalDataChanged(Index: Integer); override;
procedure DoInternalItemsChanged; override;
function GetSelectedValue: String; override;
procedure DoExItemChanged(Item: TSCListboxExItem); dynamic;
procedure DoExItemsChanged; dynamic;
property ItemsEx: TSCListboxExItems read FItemsEx write SetItemsEx;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure Assign(Source: TPersistent); override;
end;
TSCListboxEx = class(TSCCustomListboxEx)
public
property Count;
property State;
property EditText;
property HotIndex;
property ScrollHeight;
property ScrollWidth;
property ItemIndex;
property Selected;
property SelectedValue;
property TopIndex;
published
property Align;
property AllowGrayed;
property AllowEdit;
property AllowMouseEdit;
property Anchors;
property BiDiMode;
property BorderProps;
property CenterImages;
property Color;
property Colors;
property Columns;
property Constraints;
property ContinuousKeySearch;
property DragCursor;
property DragKind;
property DragMode;
property Enabled;
property EndEllipsis;
property ExtendedSelect;
property Flat;
property Font;
property HideFocusRect;
property HideSelection;
property Hottrack;
property HottrackColor;
property HottrackUnderline;
property Images;
property ImeMode;
property ImeName;
property Indent;
property ItemHeight;
property ItemsEx;
property Layout;
property LineSelect;
property MultiSelect;
property Office12Style;
property ParentBiDiMode;
property ParentColor;
property ParentFont;
property ParentShowHint;
property Picture;
property PictureProps;
property PopupMenu;
property Revertable;
property Scrollbars;
property ShowCheckboxes;
property ShowItemHints;
property ShowItemImages;
property ShowItemOnSelect;
property ShowHint;
property ShowSizeGrip;
property ShowStatusbar;
property StatusbarAlignment;
property StatusbarColor;
property StatusbarText;
property TabOrder;
property TabStop;
property Transparent;
property Visible;
property OnCanResize;
property OnClick;
property OnClickCheck;
property OnConstrainedResize;
property OnContextPopup;
property OnDblClick;
property OnDragDrop;
property OnDragOver;
property OnDrawItem;
property OnEndDock;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnHideEditor;
property OnHottrack;
property OnKeyDown;
property OnKeyPress;
property OnKeyUp;
property OnMeasureItem;
property OnMouseDown;
property OnMouseEnter;
property OnMouseLeave;
property OnMouseMove;
property OnMouseUp;
property OnPaintHint;
property OnPictureChange;
property OnPrepareEditor;
property OnResize;
property OnShowEditor;
property OnShowItemHint;
property OnStartDock;
property OnStartDrag;
property OnValidateEditor;
end;
function StateToData(St: TSCCheckState): Integer;
function DataToState(Dt: Integer): TSCCheckState;
implementation
const
SC_LISTSCROLL_TIMERID = 4334;
SC_LIST_CLICK_TIMERID = 7037;
type
TSCFakedControl = class(TSCCustomControl);
function StateToData(St: TSCCheckState): Integer;
begin
Result := 0;
if St = sccbChecked then
Result := 1
else
if St = sccbGrayed then
Result := 2;
end;
function DataToState(Dt: Integer): TSCCheckState;
begin
Result := sccbUnchecked;
if Dt = 1 then
Result := sccbChecked
else
if Dt = 2 then
Result := sccbGrayed;
end;
type
TSCListboxEdit = class(TSCCustomEdit);
TSCListStrings = class(TSCStringList);
{ TSCListBorderProps }
constructor TSCListBorderProps.Create(AOwner: TSCCustomControl);
begin
inherited Create(AOwner);
Border := sccb3DLowered;
end;
{ TSCListCustomColors }
procedure TSCListCustomColors.Assign(Source: TPersistent);
begin
if Source is TSCListCustomColors then
begin
with TSCListCustomColors(Source) do
begin
Self.AlternateColor := AlternateColor;
Self.DisabledColor := DisabledColor;
Self.DisabledTextColor := DisabledTextColor;
Self.HideSelectionBorderColor := HideSelectionBorderColor;
Self.HideSelectionColor := HideSelectionColor;
Self.HideSelectionTextColor := HideSelectionTextColor;
Self.HighlightBorderColor := HighlightBorderColor;
Self.HighlightColor := HighlightColor;
Self.HighlightTextColor := HighlightTextColor;
end;
end else
inherited Assign(Source);
end;
constructor TSCListCustomColors.Create(AOwner: TSCCustomSimpleListbox);
begin
inherited Create;
FOwner := AOwner;
end;
function TSCListCustomColors.GetDisabledColor: TColor;
begin
Result := clBtnFace;
if FOwner <> nil then
Result := FOwner.DisabledColor;
end;
function TSCListCustomColors.GetDisabledTextColor: TColor;
begin
Result := clGrayText;
if FOwner <> nil then
Result := FOwner.DisabledTextColor;
end;
function TSCListCustomColors.GetHideSelectionBorderColor: TColor;
begin
Result := clNone;
if FOwner <> nil then
Result := FOwner.HideSelectionBorderColor;
end;
function TSCListCustomColors.GetHideSelectionColor: TColor;
begin
Result := clBtnFace;
if FOwner <> nil then
Result := FOwner.HideSelectionColor;
end;
function TSCListCustomColors.GetHideSelectionTextColor: TColor;
begin
Result := clBtnText;
if FOwner <> nil then
Result := FOwner.HideSelectionTextColor;
end;
function TSCListCustomColors.GetHighlightBorderColor: TColor;
begin
Result := clNone;
if FOwner <> nil then
Result := FOwner.HighlightBorderColor;
end;
function TSCListCustomColors.GetHighlightColor: TColor;
begin
Result := clHighlight;
if FOwner <> nil then
Result := FOwner.HighlightColor;
end;
function TSCListCustomColors.GetHighlightTextColor: TColor;
begin