Repository navigation
Expand file tree
/
Copy pathSCNavBar.pas
More file actions
7244 lines (6060 loc) · 179 KB
/
Copy pathSCNavBar.pas
File metadata and controls
7244 lines (6060 loc) · 179 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 SCNavBar;
{$I SweetControls.inc}
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Menus, ImgList, {$IFDEF SC_DELPHI6_UP} Variants, Types, {$ENDIF}
SCCommon, SCConsts, SCControl, SCGradient;
type
TSCNavBarOption = (scnboShowCloseButton, scnboShowMenuButton,
scnboShowHeader, scnboShowSplitter, scnboUseBarColors,
scnboUseGradientHeader);
TSCNavBarOptions = set of TSCNavBarOption;
const
SC_DefaultNavBarOptions = [scnboShowHeader, scnboShowMenuButton,
scnboShowSplitter, scnboUseGradientHeader];
type
TSCNavBarData = class;
TSCCustomNavControl = class;
TSCCustomNavPanel = class;
TSCNavBarStyle = (scnbOfficeXP, scnbOffice11, scnbOffice12);
TSCNavBarPart = (scnpNowhere, scnpHeader, scnpClient, scnpCloseButton,
scnpIcon, scnpIconBar, scnpMenuButton, scnpNavBar, scnpSplitter);
TSCNavBarParts = set of TSCNavBarPart;
TSCNavBarHitInfo = record
X: Integer;
Y: Integer;
Index: Integer;
Part: TSCNavBarPart;
Clicked: Boolean;
IsLeftBtn: Boolean;
end;
PSCNavBarHitInfo = ^TSCNavBarHitInfo;
// events
TSCNavBarAllowEvent = procedure(Sender: TObject; var AllowClose: Boolean) of object;
TSCNavBarChangingEvent = procedure(Sender: TObject; NewIndex: Integer;
var AllowChange: Boolean) of object;
TSCNavBarHottrackEvent = procedure (Sender: TObject; AHotInfo: TSCNavBarHitInfo;
var ACursor: TCursor) of object;
TSCNavBarPaintButtonEvent = procedure(Sender: TObject; ACanvas: TCanvas;
ARect: TRect; ADown, AHot: Boolean; var ABackColor: TColor;
var AForeColor: TColor; var Handled: Boolean) of object;
TSCNavBarPaintBarEvent = procedure(Sender: TObject; ACanvas: TCanvas;
ARect: TRect; ADown, AHot, AActive, AExpanded: Boolean; AFont: TFont;
var AColor: TColor; var AImage: Integer; var AText: string;
var Handled: Boolean) of object;
TSCNavBarPaintHeaderEvent = procedure(Sender: TObject; ACanvas: TCanvas;
ARect: TRect; AFont: TFont; var AColor: TColor; var AText: string;
var Handled: Boolean) of object;
TSCNavBarPaintIconEvent = procedure(Sender: TObject; ACanvas: TCanvas;
ARect: TRect; ADown, AHot, AActive: Boolean; var AColor: TColor;
var AImage: Integer; var Handled: Boolean) of object;
TSCNavBarPaintIconBarEvent = procedure(Sender: TObject; ACanvas: TCanvas;
ARect: TRect; var AColor: TColor; var Handled: Boolean) of object;
TSCNavBarPaintSplitterEvent = procedure(Sender: TObject; ACanvas: TCanvas;
ARect: TRect; var AColor: TColor; var Handled: Boolean) of object;
TSCNavBarData = class(TPersistent)
private
FCaption: String;
FColor: TColor;
FEnabled: Boolean;
FFontColor: TColor;
FHint: String;
FImageIndex: TImageIndex;
FLargeImageIndex: TImageIndex;
FVisible: Boolean;
FTag: Longint;
FBarItem: TObject;
FIndex: Integer;
FUseSmallImages: Boolean;
protected
property Index: Integer read FIndex write FIndex;
property BarItem: TObject read FBarItem write FBarItem;
public
constructor Create;
procedure Assign(Source: TPersistent); override;
property Caption: String read FCaption write FCaption;
property Color: TColor read FColor write FColor;
property Enabled: Boolean read FEnabled write FEnabled;
property FontColor: TColor read FFontColor write FFontColor;
property Hint: String read FHint write FHint;
property ImageIndex: TImageIndex read FImageIndex write FImageIndex;
property LargeImageIndex: TImageIndex read FLargeImageIndex write FLargeImageIndex;
property Tag: Longint read FTag write FTag;
property UseSmallImages: Boolean read FUseSmallImages write FUseSmallImages;
property Visible: Boolean read FVisible write FVisible;
end;
TSCNavBarDataList = class(TObject)
private
FList: TList;
function Get(Index: Integer): TSCNavBarData;
public
constructor Create;
destructor Destroy; override;
procedure Clear;
function Count: Integer;
function Add: TSCNavBarData;
procedure Delete(Index: Integer);
function IndexOf(AData: TSCNavBarData): Integer;
property Items[Index: Integer]: TSCNavBarData read Get; default;
end;
TSCNavBarColors = class(TPersistent)
private
FBarColor: TColor;
FBarTextColor: TColor;
FButtonIconColor: TColor;
FFrameColor: TColor;
FHeaderColor: TColor;
FHighlightColor: TColor;
FHighlightTextColor: TColor;
FSplitterColor: TColor;
FOwner: TSCCustomNavControl;
procedure SetBarColor(Value: TColor);
procedure SetBarTextColor(Value: TColor);
procedure SetButtonIconColor(Value: TColor);
procedure SetFrameColor(Value: TColor);
procedure SetHeaderColor(Value: TColor);
procedure SetHighlightColor(Value: TColor);
procedure SetHighlightTextColor(Value: TColor);
procedure SetSplitterColor(Value: TColor);
protected
procedure DoChange;
function GetOwner: TPersistent; override;
public
constructor Create(AOwner: TSCCustomNavControl); virtual;
procedure Assign(Source: TPersistent); override;
published
property BarColor: TColor read FBarColor write SetBarColor default clBtnFace;
property BarTextColor: TColor read FBarTextColor write SetBarTextColor default clBtnText;
property ButtonIconColor: TColor read FButtonIconColor write SetButtonIconColor default clBtnText;
property FrameColor: TColor read FFrameColor write SetFrameColor default clBtnShadow;
property HeaderColor: TColor read FHeaderColor write SetHeaderColor default clBtnFace;
property HighlightColor: TColor read FHighlightColor write SetHighlightColor default $003FABFF;
property HighlightTextColor: TColor read FHighlightTextColor write SetHighlightTextColor default clBtnText;
property SplitterColor: TColor read FSplitterColor write SetSplitterColor default clBtnShadow;
end;
TSCNavBackGradient = class(TSCGradientPainter)
private
FOwner: TSCCustomNavControl;
protected
function GetColorBegin: TColor; override;
procedure SetColorBegin(Value: TColor); override;
function IsColorBeginSaved: Boolean; override;
public
constructor Create(AOwner: TSCCustomNavControl); virtual;
published
property Style default scdgsNone;
end;
TSCNavBarBorderProps = class(TSCControlBorderProps)
public
constructor Create(AOwner: TSCCustomControl); override;
published
property Border default sccbFlat;
property Color;
property ExDraw;
property FlatColor;
property FlatInnerColor;
property InnerBorder;
property Width;
end;
TSCCustomNavControl = class(TSCCustomControl)
private
FAlignment: TLeftRight;
FBarHeight: Integer;
FImageSpacing: Integer;
FGradient: TSCNavBackGradient;
FGradientPainter: TSCGradientPainter;
FStyle: TSCNavBarStyle;
FColors: TSCNavBarColors;
FBarIndex: Integer;
FDataList: TSCNavBarDataList;
FHitInfo: TSCNavBarHitInfo;
FHottrackInfo: TSCNavBarHitInfo;
FSplitterDownPos: Integer;
FBarFont: TFont;
FHeaderFont: TFont;
FLargeImages: TCustomImageList;
FLargeImgChangeLink: TChangeLink;
FBufferUpdate: Integer;
FPaintBuffer: TBitmap;
FDesignChange: Boolean;
FOptions: TSCNavBarOptions;
FOptionsMenu: TPopupMenu;
FCurrVisibleBars: Integer;
FVisibleBarCount: Integer;
FControlLoaded: Boolean;
FDefaultBarHeight: Integer;
FDefaultHeaderHeight: Integer;
FDefaultIndex: Integer;
FCursorChange: Boolean;
FDefaultCursor: TCursor;
FOnBarClick: TNotifyEvent;
FOnBarChange: TNotifyEvent;
FOnBarChanging: TSCNavBarChangingEvent;
FOnBarClose: TSCNavBarAllowEvent;
FOnCustomDrawBar: TSCNavBarPaintBarEvent;
FOnCustomDrawCloseButton: TSCNavBarPaintButtonEvent;
FOnCustomDrawHeader: TSCNavBarPaintHeaderEvent;
FOnCustomDrawIcon: TSCNavBarPaintIconEvent;
FOnCustomDrawIconBar: TSCNavBarPaintIconBarEvent;
FOnCustomDrawMenuButton: TSCNavBarPaintButtonEvent;
FOnCustomDrawSplitter: TSCNavBarPaintSplitterEvent;
FOnShowMenu: TSCNavBarAllowEvent;
procedure SetAlignment(Value: TLeftRight);
procedure SetBarFont(Value: TFont);
procedure SetBarHeight(Value: Integer);
procedure SetBarIndex(Value: Integer);
procedure SetColors(Value: TSCNavBarColors);
procedure SetGradient(Value: TSCNavBackGradient);
procedure SetHeaderFont(Value: TFont);
procedure SetImageSpacing(Value: Integer);
procedure SetLargeImages(Value: TCustomImageList);
procedure SetOptions(Value: TSCNavBarOptions);
procedure SetOptionsMenu(Value: TPopupMenu);
procedure SetStyle(Value: TSCNavBarStyle);
procedure SetVisibleBarCount(Value: Integer);
procedure ColorsChanged;
procedure BarIndexChanged;
procedure MenuClick;
procedure CloseClick;
procedure SizeSplitterMove;
procedure ChangeCursor(ACursor: TCursor);
procedure DrawGradientBack(ACanvas: TCanvas);
procedure DrawBars(ACanvas: TCanvas);
procedure DrawBar(ACanvas: TCanvas; AData: TSCNavBarData);
procedure DrawHeader(ACanvas: TCanvas);
procedure DrawSplitter(ACanvas: TCanvas);
procedure DrawIconBar(ACanvas: TCanvas);
procedure DrawCloseButton(ACanvas: TCanvas);
procedure DrawMenuButton(ACanvas: TCanvas);
procedure DrawButtonFace(ACanvas: TCanvas; ARect: TRect;
AColor: TColor; IsDown, IsHot, IsActive: Boolean);
procedure ReadActiveData(Reader: TReader);
procedure WriteActiveData(Writer: TWriter);
procedure ReadVisibleData(Reader: TReader);
procedure WriteVisibleData(Writer: TWriter);
procedure CMDesignHitTest(var Message: TCMDesignHitTest); message CM_DESIGNHITTEST;
procedure CMFontChanged(var Message: TMessage); message CM_FONTCHANGED;
procedure CMColorChanged(var Message: TMessage); message CM_COLORCHANGED;
procedure CMMouseEnter(var Message: TMessage); message CM_MOUSEENTER;
procedure CMMouseLeave(var Message: TMessage); message CM_MOUSELEAVE;
procedure CMCursorChanged(var Message: TMessage); message CM_CURSORCHANGED;
procedure CNChar(var Message: TWMChar); message CN_CHAR;
procedure WMEraseBkgnd(var Message: TWMEraseBkgnd); message WM_ERASEBKGND;
procedure WMGetDlgCode(var Message: TWMGetDlgCode); message WM_GETDLGCODE;
procedure WMNCHitTest(var Message: TWMNCHitTest); message WM_NCHITTEST;
procedure WMSize(var Message: TWMSize); message WM_SIZE;
protected
procedure DefineProperties(Filer: TFiler); override;
procedure CreateParams(var Params: TCreateParams); override;
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
procedure Loaded; override;
procedure CreateWnd; override;
procedure Paint; override;
procedure StopTracking; override;
procedure CancelSplitterMove;
procedure UpdateHottrackInfo;
procedure CheckMouseUpdate(OldHot: TSCNavBarHitInfo);
procedure CheckCursorUpdate(AHitInfo: TSCNavBarHitInfo);
procedure UpdateDesigner;
procedure AdjustClientRect(var ARect: TRect); override;
function GetDefaultBackColor: TColor; override;
function GetBorderPropsClass: TSCControlBorderPropsClass; override;
function GetLargeImages: TCustomImageList; virtual;
function IsShowCloseButton: Boolean;virtual;
function IsShowHeader: Boolean;virtual;
function IsShowMenuButton: Boolean; virtual;
function IsShowSplitter: Boolean;virtual;
function IsUseBarColors: Boolean;virtual;
function IsUseGradientHeader: Boolean; virtual;
function GetCurrVisibleCount: Integer; virtual;
function GetBarCount: Integer; virtual;
function GetVisibleBarCount: Integer; virtual;
function GetVisibleIndexOf(AData: TSCNavBarData): Integer; virtual;
function IsShowingCaption(AData: TSCNavBarData): Boolean; virtual;
function GetHeaderHeight: Integer; virtual;
function GetSplitterHeight: Integer; virtual;
function GetBorderIndent: Integer; virtual;
function GetMinBarHeight: Integer; virtual;
function GetVisibleBarsHeight: Integer;
function GetBarHeight: Integer; overload; virtual;
function GetBarHeight(AIndex: Integer): Integer; overload; virtual;
function CanClose: Boolean; dynamic;
function CanShowMenu: Boolean; dynamic;
procedure Changing(NewIndex: Integer; var Allowed: Boolean); virtual;
function GetCardRect: TRect; virtual;
procedure GradientChanged(Sender: TObject); virtual;
procedure DestroyActiveNavBar; virtual;
procedure ActiveNavBarMoved(Index: Integer); virtual;
procedure UpdateBuffer(Repaint: Boolean = True);
function GetDataList: TSCNavBarDataList; virtual;
procedure InitializeHitTest(AHitInfo: PSCNavBarHitInfo);
procedure BarFontChanged(Sender: TObject); virtual;
procedure HeaderFontChanged(Sender: TObject); virtual;
function GetFrameColor: TColor; virtual;
function GetIconBarColor: TColor; virtual;
function GetSplitterColor: TColor; virtual;
function GetHeaderColor: TColor; virtual;
function GetBarColor(AData: TSCNavBarData): TColor; virtual;
function GetBarTextColor(AData: TSCNavBarData): TColor; virtual;
function GetButtonColor(IsHot, IsDown, IsActive: Boolean): TColor; virtual;
function GetButtonTextColor(IsHot, IsDown, IsActive: Boolean): TColor; virtual;
procedure DoDrawBar(ACanvas: TCanvas; AData: TSCNavBarData;
ARect: TRect; ADown, AHot, AActive, AExpanded: Boolean; AFont: TFont;
var AColor: TColor; var AImage: Integer; var AText: string;
var Handled: Boolean); virtual;
procedure DoDrawHeader(ACanvas: TCanvas; ARect: TRect;
AFont: TFont; var AColor: TColor; var AText: string;
var Handled: Boolean); virtual;
procedure DoDrawSplitter(ACanvas: TCanvas; ARect: TRect;
var AColor: TColor; var Handled: Boolean); virtual;
procedure DoDrawIcon(ACanvas: TCanvas; ARect: TRect;
ADown, AHot, AActive: Boolean; var AColor: TColor;
var AImage: Integer; var Handled: Boolean); virtual;
procedure DoDrawIconBar(ACanvas: TCanvas; ARect: TRect;
var AColor: TColor; var Handled: Boolean); virtual;
procedure DoDrawCloseButton(ACanvas: TCanvas;
ARect: TRect; ADown, AHot: Boolean; var ABackColor: TColor;
var AForeColor: TColor; var Handled: Boolean); virtual;
procedure DoDrawMenuButton(ACanvas: TCanvas;
ARect: TRect; ADown, AHot: Boolean; var ABackColor: TColor;
var AForeColor: TColor; var Handled: Boolean); virtual;
function GetGradientShadow(AColor: TColor): TColor;
function GetGradientDark(AColor: TColor): TColor;
function GetGradientLight(AColor: TColor): TColor;
function GetGradientExLight(AColor: TColor): TColor;
function GetGradientPeal(AColor: TColor): TColor;
function GetGradientPreLight(AColor: TColor): TColor;
function GetNavBarImage(AData: TSCNavBarData): TImageIndex; virtual;
procedure SetIndent(Value: Integer); override;
procedure IndentChanged; override;
procedure ImageListChange(Sender: TObject); override;
procedure DoColorsChanged; virtual;
procedure DoBarIndexChanged; virtual;
procedure DoOptionsChanged; dynamic;
procedure UpdateNavBars(Realign: Boolean = False);
procedure StoreCalcValues;
procedure FillDataList; virtual;
procedure DoCloseClick; virtual;
function DoMenuClick: Boolean; virtual;
procedure BarClick; virtual;
function GetActiveIndex: Integer; dynamic;
function CheckVisible(Index: Integer): Integer;
function IsBarVisible(AData: TSCNavBarData): Boolean; virtual;
function GetFirstVisibleNavBar: Integer; dynamic;
function GetLastVisibleNavBar: Integer; dynamic;
function GetSplitterRect: TRect; virtual;
function GetIconBarRect: TRect; virtual;
function GetHeaderRect: TRect; virtual;
function GetCloseButtonRect: TRect; virtual;
function GetMenuButtonRect: TRect; virtual;
function GetBarRect(Index: Integer): TRect; overload; virtual;
function GetBarRect(AData: TSCNavBarData): TRect; overload; virtual;
function GetOptionsMenu: TPopupMenu; dynamic;
function GetHitInfo(const P: TPoint): TSCNavBarHitInfo; 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;
property CardRect: TRect read GetCardRect;
property DataList: TSCNavBarDataList read GetDataList;
property ControlLoaded: Boolean read FControlLoaded;
property Alignment: TLeftRight read FAlignment write SetAlignment default taLeftJustify;
property BarCount: Integer read GetBarCount;
property BarFont: TFont read FBarFont write SetBarFont;
property BarHeight: Integer read FBarHeight write SetBarHeight default 32;
property BarIndex: Integer read FBarIndex write SetBarIndex default -1;
property Colors: TSCNavBarColors read FColors write SetColors;
property Gradient: TSCNavBackGradient read FGradient write SetGradient;
property HeaderFont: TFont read FHeaderFont write SetHeaderFont;
property ImageSpacing: Integer read FImageSpacing write SetImageSpacing default 2;
property LargeImages: TCustomImageList read FLargeImages write SetLargeImages;
property Options: TSCNavBarOptions read FOptions write SetOptions default SC_DefaultNavBarOptions;
property OptionsMenu: TPopupMenu read FOptionsMenu write SetOptionsMenu;
property Style: TSCNavBarStyle read FStyle write SetStyle default scnbOfficeXP;
property VisibleBarCount: Integer read FVisibleBarCount write SetVisibleBarCount default 5;
property OnBarClick: TNotifyEvent read FOnBarClick write FOnBarClick;
property OnBarChange: TNotifyEvent read FOnBarChange write FOnBarChange;
property OnBarChanging: TSCNavBarChangingEvent read FOnBarChanging write FOnBarChanging;
property OnBarClose: TSCNavBarAllowEvent read FOnBarClose write FOnBarClose;
property OnCustomDrawBar: TSCNavBarPaintBarEvent read FOnCustomDrawBar write FOnCustomDrawBar;
property OnCustomDrawCloseButton: TSCNavBarPaintButtonEvent read FOnCustomDrawCloseButton
write FOnCustomDrawCloseButton;
property OnCustomDrawHeader: TSCNavBarPaintHeaderEvent read FOnCustomDrawHeader
write FOnCustomDrawHeader;
property OnCustomDrawIcon: TSCNavBarPaintIconEvent read FOnCustomDrawIcon
write FOnCustomDrawIcon;
property OnCustomDrawIconBar: TSCNavBarPaintIconBarEvent read FOnCustomDrawIconBar
write FOnCustomDrawIconBar;
property OnCustomDrawMenuButton: TSCNavBarPaintButtonEvent read FOnCustomDrawMenuButton
write FOnCustomDrawMenuButton;
property OnCustomDrawSplitter: TSCNavBarPaintSplitterEvent read FOnCustomDrawSplitter
write FOnCustomDrawSplitter;
property OnShowMenu: TSCNavBarAllowEvent read FOnShowMenu write FOnShowMenu;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
function BarAtPos(const P: TPoint): Integer;
procedure CloseActiveNavBar;
procedure HideAllBars; virtual;
procedure ShowAllBars; virtual;
procedure ShowMoreButtons;
procedure ShowLessButtons;
property Color default clWindow;
property ParentColor default False;
end;
TSCNavTabItem = class(TCollectionItem)
private
FCaption: string;
FColor: TColor;
FEnabled: Boolean;
FFontColor: TColor;
FHint: string;
FImageIndex: TImageIndex;
FLargeImageIndex: TImageIndex;
FTag: Longint;
FUseSmallImages: Boolean;
FVisible: Boolean;
FData: TObject;
procedure SetCaption(const Value: String);
procedure SetColor(Value: TColor);
procedure SetEnabled(Value: Boolean);
procedure SetFontColor(Value: TColor);
procedure SetHint(const Value: String);
procedure SetImageIndex(Value: TImageIndex);
procedure SetLargeImageIndex(Value: TImageIndex);
procedure SetUseSmallImages(Value: Boolean);
procedure SetVisible(Value: Boolean);
protected
function GetDisplayName: string; override;
procedure AssignTo(Dest: TPersistent); override;
public
constructor Create(Collection: TCollection); override;
procedure Assign(Source: TPersistent); override;
property Data: TObject read FData write FData;
published
property Caption: String read FCaption write SetCaption;
property Color: TColor read FColor write SetColor default clBtnFace;
property Enabled: Boolean read FEnabled write SetEnabled default True;
property FontColor: TColor read FFontColor write SetFontColor default clNone;
property Hint: String read FHint write SetHint;
property ImageIndex: TImageIndex read FImageIndex write SetImageIndex default -1;
property LargeImageIndex: TImageIndex read FLargeImageIndex write SetLargeImageIndex default -1;
property Tag: Longint read FTag write FTag default 0;
property UseSmallImages: Boolean read FUseSmallImages write SetUseSmallImages default False;
property Visible: Boolean read FVisible write SetVisible default True;
end;
TSCCustomNavTabControl = class;
TSCNavTabItems = class(TCollection)
private
FOwner: TSCCustomNavTabControl;
function GetItem(Index: Integer): TSCNavTabItem;
procedure SetItem(Index: Integer; Value: TSCNavTabItem);
protected
function GetOwner: TPersistent; override;
procedure Update(Item: TCollectionItem); override;
public
constructor Create(AOwner: TSCCustomNavTabControl); virtual;
procedure Clear;
function Add: TSCNavTabItem;
procedure Delete(Index: Integer);
procedure Move(CurIndex, NewIndex: Integer);
function IndexOf(ATab: TSCNavTabItem): Integer;
property Items[Index: Integer]: TSCNavTabItem read GetItem write SetItem; default;
end;
TSCCustomNavTabControl = class(TSCCustomNavControl)
private
FTabs: TSCNavTabItems;
procedure SetTabs(Value: TSCNavTabItems);
function GetTabIndex: Integer;
procedure SetTabIndex(Value: Integer);
protected
procedure FillDataList; override;
function GetFirstVisibleNavBar: Integer; override;
function GetLastVisibleNavBar: Integer; override;
function IsBarVisible(AData: TSCNavBarData): Boolean; override;
function IsTabVisible(ATab: TSCNavTabItem): Boolean; virtual;
function GetBarCount: Integer; override;
function GetVisibleBarCount: Integer; override;
function IsTabShowingCaption(ATab: TSCNavTabItem): Boolean;
function GetActiveIndex: Integer; override;
procedure DoCloseClick; override;
property Tabs: TSCNavTabItems read FTabs write SetTabs;
property TabIndex: Integer read GetTabIndex write SetTabIndex default -1;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure HideAllBars; override;
procedure ShowAllBars; override;
property TabCount: Integer read GetBarCount;
end;
TSCNavTabControl = class(TSCCustomNavTabControl)
published
property Align;
property Alignment;
property Anchors;
property BarFont;
property BarHeight;
property BorderProps;
property ClickFocus;
property Color;
property Colors;
property Constraints;
property DockSite;
property DragCursor;
property DragKind;
property DragMode;
property Enabled;
property Font;
property Gradient;
property HeaderFont;
property Images;
property ImageSpacing;
property Indent;
property LargeImages;
property Options;
property OptionsMenu;
property ParentColor;
property ParentFont;
property PopupMenu;
property ParentShowHint;
property ShowHint;
property Style;
property TabIndex;
property Tabs;
property TabOrder;
property TabStop;
property Visible;
property VisibleBarCount;
property OnBarClick;
property OnBarClose;
property OnBarChange;
property OnBarChanging;
property OnClick;
property OnCustomDrawBar;
property OnCustomDrawCloseButton;
property OnCustomDrawHeader;
property OnCustomDrawIcon;
property OnCustomDrawIconBar;
property OnCustomDrawMenuButton;
property OnCustomDrawSplitter;
property OnDblClick;
property OnDockDrop;
property OnDockOver;
property OnDragDrop;
property OnDragOver;
property OnEndDock;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnGetSiteInfo;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
property OnShowMenu;
property OnStartDock;
property OnStartDrag;
property OnUnDock;
end;
TSCCustomNavBarControl = class;
TSCNavBarSheet = class(TSCCustomControl)
private
FBarEnabled: Boolean;
FBarVisible: Boolean;
FFontColor: TColor;
FImageIndex: TImageIndex;
FLargeImageIndex: TImageIndex;
FUseSmallImages: Boolean;
FData: Pointer;
FNavBarRect: TRect;
FNavBarControl: TSCCustomNavBarControl;
procedure Changed;
procedure InternalSetVisible(Value: Boolean);
function GetBarIndex: Integer;
procedure SetBarIndex(Value: Integer);
procedure SetBarEnabled(Value: Boolean);
procedure SetBarVisible(Value: Boolean);
function GetColor: TColor;
procedure SetColor(Value: TColor);
procedure SetFontColor(Value: TColor);
procedure SetImageIndex(Value: TImageIndex);
procedure SetLargeImageIndex(Value: TImageIndex);
procedure SetNavBarControl(ANavBarControl: TSCCustomNavBarControl);
procedure SetUseSmallImages(Value: Boolean);
function GetVisible: Boolean;
procedure SetVisible(Value: Boolean);
procedure SetNavBarRect(Value: TRect);
procedure CMTextChanged(var Message: TMessage); message CM_TEXTCHANGED;
procedure CMEnabledChanged(var Message: TMessage); message CM_ENABLEDCHANGED;
procedure WMEraseBkgnd(var Message: TWmEraseBkgnd); message WM_ERASEBKGND;
protected
procedure AssignTo(Dest: TPersistent); override;
procedure CreateParams(var Params: TCreateParams); override;
procedure Paint; override;
procedure ReadState(Reader: TReader); override;
function GetImages: TCustomImageList; override;
function GetDefaultBackColor: TColor; override;
property NavBarRect: TRect read FNavBarRect write SetNavBarRect;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
property Data: Pointer read FData write FData;
property Visible: Boolean read GetVisible write SetVisible;
property NavBarControl: TSCCustomNavBarControl read FNavBarControl write SetNavBarControl;
published
property BarIndex: Integer read GetBarIndex write SetBarIndex stored False;
property BarEnabled: Boolean read FBarEnabled write SetBarEnabled default True;
property BarVisible: Boolean read FBarVisible write SetBarVisible default True;
property Color: TColor read GetColor write SetColor default clBtnFace;
property FontColor: TColor read FFontColor write SetFontColor default clNone;
property ImageIndex: TImageIndex read FImageIndex write SetImageIndex default -1;
property LargeImageIndex: TImageIndex read FLargeImageIndex write SetLargeImageIndex default -1;
property UseSmallImages: Boolean read FUseSmallImages write SetUseSmallImages default False;
property Caption;
property Constraints;
property Enabled;
property Font;
property Height stored False;
property Left stored False;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property ShowHint;
property Top stored False;
property Width stored False;
property OnClick;
property OnDblClick;
property OnDragDrop;
property OnDragOver;
property OnEnter;
property OnExit;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
property OnResize;
end;
TSCCustomNavBarControl = class(TSCCustomNavControl)
private
FSheets: TList;
FActiveBar: TSCNavBarSheet;
FNewDockSheet: TSCNavBarSheet;
FUndockingBar: TSCNavBarSheet;
FInitActiveBar: Boolean;
procedure InsertBar(Bar: TSCNavBarSheet);
procedure RemoveBar(Bar: TSCNavBarSheet);
procedure ChangeActiveBar(Bar: TSCNavBarSheet);
function GetDockClientAt(P: TPoint): TControl;
procedure CMColorChanged(var Message: TMessage); message CM_COLORCHANGED;
procedure CMDialogKey(var Message: TCMDialogKey); message CM_DIALOGKEY;
procedure CMDockClient(var Message: TCMDockClient); message CM_DOCKCLIENT;
procedure CMDockNotification(var Message: TCMDockNotification); message CM_DOCKNOTIFICATION;
procedure CMUnDockClient(var Message: TCMUnDockClient); message CM_UNDOCKCLIENT;
procedure WMLButtonDown(var Message: TWMLButtonDown); message WM_LBUTTONDOWN;
procedure WMLButtonDblClk(var Message: TWMLButtonDblClk); message WM_LBUTTONDBLCLK;
procedure WMEraseBkgnd(var Message: TWMEraseBkgnd); message WM_ERASEBKGND;
protected
procedure CreateParams(var Params: TCreateParams); override;
procedure Loaded; override;
procedure FillDataList; override;
function IsSheetVisible(Sheet: TSCNavBarSheet): Boolean; virtual;
procedure Changing(NewIndex: Integer; var Allowed: Boolean); override;
function GetFirstVisibleNavBar: Integer; override;
function GetLastVisibleNavBar: Integer; override;
function GetActiveIndex: Integer; override;
procedure GradientChanged(Sender: TObject); override;
procedure DoCloseClick; override;
procedure DoBarIndexChanged; override;
procedure DestroyActiveNavBar; override;
procedure ActiveNavBarMoved(Index: Integer); override;
procedure GetChildren(Proc: TGetChildProc; Root: TComponent); override;
procedure SetChildOrder(Child: TComponent; Order: Integer); override;
procedure ShowControl(AControl: TControl); override;
procedure DoAddDockClient(Client: TControl; const ARect: TRect); override;
procedure DockOver(Source: TDragDockObject; X, Y: Integer;
State: TDragState; var Accept: Boolean); override;
procedure DoRemoveDockClient(Client: TControl); override;
function GetBarFromDockClient(Client: TControl): TSCNavBarSheet;
procedure GetSiteInfo(Client: TControl; var InfluenceRect: TRect;
MousePos: TPoint; var CanDock: Boolean); override;
function GetBar(Index: Integer): TSCNavBarSheet; virtual;
procedure SetActiveBar(Bar: TSCNavBarSheet); virtual;
function GetActiveBarIndex: Integer; virtual;
procedure SetActiveBarIndex(Value: Integer); virtual;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure Change; override;
function GetBarCount: Integer; override;
function FindNextBar(CurBar: TSCNavBarSheet; GoForward,
CheckBarVisible: Boolean): TSCNavBarSheet;
function BarForNavBar(ABarIndex: Integer): TSCNavBarSheet;
procedure SelectNextBar(GoForward: Boolean);
procedure HideAllBars; override;
procedure ShowAllBars; override;
procedure MakeControlVisible(AControl: TControl);
property BarCount;
property Bars[Index: Integer]: TSCNavBarSheet read GetBar;
property ActiveBarIndex: Integer read GetActiveBarIndex write SetActiveBarIndex;
property ActiveBar: TSCNavBarSheet read FActiveBar write SetActiveBar;
end;
TSCNavBarControl = class(TSCCustomNavBarControl)
published
property ActiveBar;
property Align;
property Alignment;
property Anchors;
property BarFont;
property BarHeight;
property BorderProps;
property Color;
property Colors;
property Constraints;
property DockSite;
property DragCursor;
property DragKind;
property DragMode;
property Enabled;
property Gradient;
property Font;
property HeaderFont;
property HelpContext;
property Hint;
property Images;
property ImageSpacing;
property LargeImages;
property Options;
property OptionsMenu;
property ParentColor;
property ParentFont;
property PopupMenu;
property ParentShowHint;
property ShowHint;
property Style;
property TabOrder;
property TabStop;
property Visible;
property VisibleBarCount;
property OnBarClick;
property OnBarClose;
property OnBarChange;
property OnBarChanging;
property OnClick;
property OnCustomDrawBar;
property OnCustomDrawCloseButton;
property OnCustomDrawHeader;
property OnCustomDrawIcon;
property OnCustomDrawIconBar;
property OnCustomDrawMenuButton;
property OnCustomDrawSplitter;
property OnDblClick;
property OnDockDrop;
property OnDockOver;
property OnDragDrop;
property OnDragOver;
property OnEndDock;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnGetSiteInfo;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
property OnShowMenu;
property OnStartDock;
property OnStartDrag;
property OnUnDock;
end;
TSCNavPanelGradient = class(TSCGradientPainter)
private
FOwner: TSCCustomNavPanel;
protected
function GetColorBegin: TColor; override;
procedure SetColorBegin(Value: TColor); override;
function IsColorBeginSaved: Boolean; override;
public
constructor Create(AOwner: TSCCustomNavPanel); virtual;
published
property Style default scdgsNone;
end;
TSCNavPanelHeader = class(TPersistent)
private
FAlignment: TLeftRight;
FButtonIconColor: TColor;
FColor: TColor;
FCloseButton: Boolean;
FFont: TFont;
FFrameColor: TColor;
FHeight: Integer;
FHighlightColor: TColor;
FImageIndex: TImageIndex;
FStyle: TSCNavBarStyle;
FText: String;
FVisible: Boolean;
FOwner: TSCCustomNavPanel;
procedure SetAlignment(Value: TLeftRight);
procedure SetButtonIconColor(Value: TColor);
procedure SetCloseButton(Value: Boolean);
procedure SetColor(Value: TColor);
procedure SetFont(Value: TFont);
procedure SetFrameColor(Value: TColor);
procedure SetHeight(Value: Integer);
procedure SetHighlightColor(Value: TColor);
procedure SetImageIndex(Value: TImageIndex);
procedure SetStyle(Value: TSCNavBarStyle);
procedure SetText(const Value: String);
procedure SetVisible(Value: Boolean);
protected
function GetOwner: TPersistent; override;
property Owner: TSCCustomNavPanel read FOwner;
procedure Changed(Force: Boolean);
procedure FontChanged(Sender: TObject);
public
constructor Create(AOwner: TSCCustomNavPanel);
destructor Destroy; override;
procedure Assign(Source: TPersistent); override;
published
property Alignment: TLeftRight read FAlignment write SetAlignment default taLeftJustify;
property ButtonIconColor: TColor read FButtonIconColor write SetButtonIconColor default clBtnText;
property CloseButton: Boolean read FCloseButton write SetCloseButton default True;
property Color: TColor read FColor write SetColor default clBtnFace;
property Font: TFont read FFont write SetFont;
property FrameColor: TColor read FFrameColor write SetFrameColor default clBtnShadow;
property Height: Integer read FHeight write SetHeight default -1;
property HighlightColor: TColor read FHighlightColor write SetHighlightColor default $003FABFF;
property ImageIndex: TImageIndex read FImageIndex write SetImageIndex default -1;
property Style: TSCNavBarStyle read FStyle write SetStyle default scnbOfficeXP;
property Text: String read FText write SetText;
property Visible: Boolean read FVisible write SetVisible default True;
end;
TSCNavPanelBorderProps = class(TSCControlBorderProps)
public
constructor Create(AOwner: TSCCustomControl); override;
published
property Border default sccbNone;
property Color;
property ExDraw;
property FlatColor;
property FlatInnerColor;
property InnerBorder;
property Width;
end;
TSCNavPanelPart = (scnppNowhere, scnppHeader, scnppClient,
scnppCloseButton);
TSCNavPanelParts = set of TSCNavPanelPart;
TSCNavPanelHitInfo = record
X: Integer;
Y: Integer;
Part: TSCNavPanelPart;
Clicked: Boolean;
IsLeftBtn: Boolean;
end;
PSCNavPanelHitInfo = ^TSCNavPanelHitInfo;
TSCNavPanelAllowEvent = procedure(Sender: TObject; var AllowClose: Boolean) of object;
TSCNavPanelPaintButtonEvent = procedure(Sender: TObject; ACanvas: TCanvas;
ARect: TRect; ADown, AHot: Boolean; var ABackColor: TColor;
var AForeColor: TColor; var Handled: Boolean) of object;
TSCNavPanelPaintHeaderEvent = procedure(Sender: TObject; ACanvas: TCanvas;
ARect: TRect; AFont: TFont; var AColor: TColor; var AImage: Integer;
var AText: String; var Handled: Boolean) of object;
TSCCustomNavPanel = class(TSCCustomControl)
private
FGradient: TSCNavPanelGradient;
FHeader: TSCNavPanelHeader;
FGradientPainter: TSCGradientPainter;
FBufferUpdate: Integer;
FPaintBuffer: TBitmap;
FControlLoaded: Boolean;
FDefaultHeaderHeight: Integer;
FHitInfo: TSCNavPanelHitInfo;