forked from pyscripter/pyscripter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
JvDockControlForm.pas
5326 lines (4697 loc) · 173 KB
/
JvDockControlForm.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
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
{-----------------------------------------------------------------------------
The contents of this file are subject to the Mozilla Public License
Version 1.1 (the "License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/MPL-1.1.html
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See the License for
the specific language governing rights and limitations under the License.
The Original Code is: JvDockControlForm.pas, released on 2003-12-31.
The Initial Developer of the Original Code is luxiaoban.
Portions created by luxiaoban are Copyright (C) 2002,2003 luxiaoban.
All Rights Reserved.
Contributor(s):
2005-02-08 - Warren Postma - TJvDockServer.CustomPanel.
Last Modified: 2005-02-08
You may retrieve the latest version of this file at the Project JEDI's JVCL home page,
located at http://jvcl.delphi-jedi.org
Known Issues:
-----------------------------------------------------------------------------}
// $Id$
{ Changes:
2005-02-08 WP: Added TJvDockServer.CustomDock panel (new property),
and new event TJvDockServer.OnCustomPanel to get
a custom parent control (such as the form's center area) for the
CustomPanel. Previously you could only dock at the edges. Created a
splitter object (to avoid possible access violations) but the splitter
control is hidden and never used for this custom panel. Several
changes were made to the VID dock style also to make this custom
panel more useful,allowing an "tabbed MDI" style application.
}
unit JvDockControlForm;
{$I jvcl.inc}
interface
uses
{$IFDEF UNITVERSIONING}
JclUnitVersioning,
{$ENDIF UNITVERSIONING}
Windows, Messages, Classes, Graphics, Controls, Forms, Menus,
ExtCtrls, ComCtrls,
JvComponentBase, JvComponent, JvAppStorage, JvConsts,
JvDockTree, JvDockSupportClass, JvDockSupportControl, JvDockAdvTree;
const
JvDockPositionCount = 5;
JvDockState_Unknown = 0;
JvDockState_Docking = 1;
JvDockState_Floating = 2;
type
TJvDockSplitterSize = 0..32767;
TJvDockBaseControl = class;
TJvDockServer = class;
TJvDockClient = class;
TJvDockConjoinPanel = class;
TJvDockTabPageControl = class;
TJvDockConjoinHostForm = class;
TJvDockTabHostForm = class;
TJvDockSplitter = class(TJvDockCustomPanelSplitter)
private
FDockServer: TJvDockServer;
function GetSplitterIndex: Integer;
protected
function FindControl: TControl; override;
property DockServer: TJvDockServer read FDockServer write FDockServer;
public
constructor Create(AOwner: TComponent); override;
property SplitterIndex: Integer read GetSplitterIndex;
end;
TJvDockSetDockPanelSizeFrom = (sdfDockPanel, sdfClient);
TJvDockPanel = class(TJvDockCustomPanel)
private
FDockServer: TJvDockServer;
FCustomFlag: Boolean; // Set only if custom area! {NEW}
function GetPanelIndex: Integer;
procedure SetDockServer(ADockServer: TJvDockServer);
protected
function CreateDockManager: IDockManager; override;
procedure AddDockServer(ADockServer: TJvDockServer); virtual;
procedure RemoveDockServer(ADockServer: TJvDockServer); virtual;
procedure ReloadDockedControl(const AControlName: string;
var AControl: TControl); override;
procedure CustomStartDock(var Source: TJvDockDragDockObject); override;
procedure CustomGetSiteInfo(Source: TJvDockDragDockObject; Client: TControl; var InfluenceRect: TRect;
MousePos: TPoint; var CanDock: Boolean); override;
procedure CustomDockOver(Source: TJvDockDragDockObject; X, Y: Integer;
State: TDragState; var Accept: Boolean); override;
procedure CustomPositionDockRect(Source: TJvDockDragDockObject; X, Y: Integer); override;
procedure CustomDockDrop(Source: TJvDockDragDockObject; X, Y: Integer); override;
procedure CustomEndDock(Target: TObject; X, Y: Integer); override;
function CustomUnDock(Source: TJvDockDragDockObject; NewTarget: TWinControl; Client: TControl): Boolean; override;
function DoUnDock(NewTarget: TWinControl; Client: TControl): Boolean; override;
public
constructor Create(AOwner: TComponent); override;
procedure DockDrop(Source: TDragDockObject; X, Y: Integer); override;
procedure ShowDockPanel(MakeVisible: Boolean; Client: TControl;
PanelSizeFrom: TJvDockSetDockPanelSizeFrom = sdfClient); virtual;
procedure ResetPosition;
// GetDockedControls: NEW! -WPostma.
// base class doesn't have this capability.
// see TJvDockAdvPanel for override that implements this!
procedure GetDockedControls(WinControls: TList); virtual; { not supported in base! }
function FindTabHostForm:TWinControl; virtual;
property PanelIndex: Integer read GetPanelIndex;
property DockServer: TJvDockServer read FDockServer write SetDockServer;
property CustomFlag: Boolean read FCustomFlag write FCustomFlag; // Set only if custom area! {NEW}
end;
TJvDockAdvPanel = class(TJvDockPanel)
private
procedure CMUnDockClient(var Msg: TCMUnDockClient); message CM_UNDOCKCLIENT;
protected
procedure CustomDockDrop(Source: TJvDockDragDockObject; X, Y: Integer); override;
function CustomUnDock(Source: TJvDockDragDockObject; NewTarget: TWinControl; Client: TControl): Boolean; override;
function DoUnDock(NewTarget: TWinControl; Client: TControl): Boolean; override;
public
procedure GetDockedControls(WinControls: TList); override;
function FindTabHostForm:TWinControl; override;
procedure DockDrop(Source: TDragDockObject; X, Y: Integer); override;
end;
TJvDockPanelClass = class of TJvDockPanel;
TJvDockSplitterClass = class of TJvDockSplitter;
TJvDockConjoinPanelClass = class of TJvDockConjoinPanel;
TJvDockTabClass = class of TJvDockTabPageControl;
{ Maintained by a TJvDockServer; TJvDockServer ensures that FDockServer is
assigned. FSplitter may be nil }
TJvDockSplitterStyle = class(TPersistent)
private
FSplitter: TJvDockSplitter;
FDockServer: TJvDockServer;
FColor: TColor;
FCursor: TCursor;
FParentColor: Boolean;
FResizeStyle: TResizeStyle;
FSize: TJvDockSplitterSize;
FMinSize: TJvDockSplitterSize;
procedure SetColor(const Value: TColor);
procedure SetCursor(const Value: TCursor);
procedure SetParentColor(const Value: Boolean);
procedure SetResizeStyle(const Value: TResizeStyle);
procedure SetSize(const Value: TJvDockSplitterSize);
procedure SetMinSize(const Value: TJvDockSplitterSize);
protected
procedure AssignTo(Dest: TPersistent); override;
procedure AssignToSplitter(Dest: TJvDockSplitter);
procedure SetSplitterStyle;
property Splitter: TJvDockSplitter read FSplitter write FSplitter;
public
constructor Create(ASplitter: TJvDockSplitter; ACursor: TCursor); virtual;
procedure Assign(Source: TPersistent); override;
published
property Color: TColor read FColor write SetColor default clBtnFace;
property Cursor: TCursor read FCursor write SetCursor;
property ParentColor: Boolean read FParentColor write SetParentColor default True;
property ResizeStyle: TResizeStyle read FResizeStyle write SetResizeStyle default rsPattern;
property Size: TJvDockSplitterSize read FSize write SetSize default 3;
property MinSize: TJvDockSplitterSize read FMinSize write SetMinSize default 30;
end;
TJvDockBasicStyle = class;
TJvDockBasicStyle = class(TJvDockObservableStyle)
private
FDockPanelClass: TJvDockPanelClass;
FDockSplitterClass: TJvDockSplitterClass;
FConjoinPanelClass: TJvDockConjoinPanelClass;
FTabDockClass: TJvDockTabClass;
FDockPanelTreeClass: TJvDockTreeClass;
FDockPanelZoneClass: TJvDockZoneClass;
FConjoinPanelTreeClass: TJvDockTreeClass;
FConjoinPanelZoneClass: TJvDockZoneClass;
FDockBaseControls: TList;
function GetDockBaseControlCount: Integer;
function GetDockBaseControl(Index: Integer): TJvDockBaseControl;
protected
procedure FormStartDock(DockClient: TJvDockClient; var Source: TJvDockDragDockObject); virtual;
procedure FormGetSiteInfo(Source: TJvDockDragDockObject; DockClient: TJvDockClient; Client: TControl;
var InfluenceRect: TRect; MousePos: TPoint; var CanDock: Boolean); virtual;
procedure FormDockOver(DockClient: TJvDockClient; Source: TJvDockDragDockObject; X, Y: Integer;
State: TDragState; var Accept: Boolean); virtual;
procedure FormPositionDockRect(DockClient: TJvDockClient; Source: TJvDockDragDockObject); virtual;
procedure FormDockDrop(DockClient: TJvDockClient; Source: TJvDockDragDockObject; X, Y: Integer); virtual;
procedure FormEndDock(DockClient: TJvDockClient; Target: TObject; X, Y: Integer); virtual;
function FormUnDock(DockClient: TJvDockClient; NewTarget: TWinControl; Client: TControl): Boolean; virtual;
procedure FormGetDockEdge(DockClient: TJvDockClient; Source: TJvDockDragDockObject;
MousePos: TPoint; var DropAlign: TAlign); virtual;
procedure SetDockBaseControl(IsCreate: Boolean; DockBaseControl: TJvDockBaseControl); virtual;
function DockServerWindowProc(DockServer: TJvDockServer; var Msg: TMessage): Boolean; virtual;
function DockClientWindowProc(DockClient: TJvDockClient; var Msg: TMessage): Boolean; virtual;
procedure AddDockBaseControl(ADockBaseControl: TJvDockBaseControl); virtual;
procedure RemoveDockBaseControl(ADockBaseControl: TJvDockBaseControl); virtual;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
function CanSetEnableDocked(ADockBaseControl: TJvDockBaseControl): Boolean; virtual;
function CanSetLeftDocked(ADockBaseControl: TJvDockBaseControl): Boolean; virtual;
function CanSetRightDocked(ADockBaseControl: TJvDockBaseControl): Boolean; virtual;
function CanSetTopDocked(ADockBaseControl: TJvDockBaseControl): Boolean; virtual;
function CanSetBottomDocked(ADockBaseControl: TJvDockBaseControl): Boolean; virtual;
function CanSetEachOtherDocked(ADockBaseControl: TJvDockBaseControl): Boolean; virtual;
procedure ResetCursor(Source: TJvDockDragDockObject); virtual;
function GetDockState(DockClient: TJvDockClient): Integer; virtual;
procedure DoShowDockForm(DockWindow: TWinControl); virtual;
procedure DoHideDockForm(DockWindow: TWinControl); virtual;
procedure ShowDockForm(ADockClient: TJvDockClient); virtual;
procedure HideDockForm(ADockClient: TJvDockClient); virtual;
function GetDockFormVisible(ADockClient: TJvDockClient): Boolean; virtual;
property DockBaseControlCount: Integer read GetDockBaseControlCount;
property DockBaseControl[Index: Integer]: TJvDockBaseControl read GetDockBaseControl;
procedure RestoreClient(DockClient: TJvDockClient); virtual;
property DockPanelClass: TJvDockPanelClass read FDockPanelClass write FDockPanelClass;
property DockSplitterClass: TJvDockSplitterClass read FDockSplitterClass write FDockSplitterClass;
property ConjoinPanelClass: TJvDockConjoinPanelClass read FConjoinPanelClass write FConjoinPanelClass;
property TabDockClass: TJvDockTabClass read FTabDockClass write FTabDockClass;
property DockPanelTreeClass: TJvDockTreeClass read FDockPanelTreeClass write FDockPanelTreeClass;
property DockPanelZoneClass: TJvDockZoneClass read FDockPanelZoneClass write FDockPanelZoneClass;
property ConjoinPanelTreeClass: TJvDockTreeClass read FConjoinPanelTreeClass write FConjoinPanelTreeClass;
property ConjoinPanelZoneClass: TJvDockZoneClass read FConjoinPanelZoneClass write FConjoinPanelZoneClass;
end;
TJvDockAdvStyle = class(TJvDockBasicStyle)
protected
function DockClientWindowProc(DockClient: TJvDockClient; var Msg: TMessage): Boolean; override;
end;
TJvDockBaseControl = class(TJvComponent)
private
FEnableDock: Boolean;
FLeftDock: Boolean; { Can the parent form be docked into the Left dock? }
FTopDock: Boolean; { Can the parent form be docked into the Top dock? }
FRightDock: Boolean; { Can the parent form be docked into the Right dock? }
FBottomDock: Boolean; { Can the parent form be docked into the Bottom dock? }
FCustomDock: Boolean; {NEW! Can the parent form be docked into the Custom (center window) dock area? }
FEachOtherDock: Boolean;
FDockStyle: TJvDockBasicStyle;
FOldOnClose: TCloseEvent;
FOldOnCreate: TNotifyEvent;
FParentForm: TForm;
FOldWindowProc: TWndMethod;
procedure SetDockStyle(ADockStyle: TJvDockBasicStyle);
protected
procedure SetParentComponent(Value: TComponent); override;
function CanSetEnableDocked: Boolean; virtual;
function CanSetLeftDocked: Boolean; virtual;
function CanSetRightDocked: Boolean; virtual;
function CanSetTopDocked: Boolean; virtual;
function CanSetBottomDocked: Boolean; virtual;
function CanSetEachOtherDocked: Boolean; virtual;
procedure DoFormOnClose(Sender: TObject; var Action: TCloseAction); virtual;
procedure DoFormOnCreate(Sender: TObject); virtual;
procedure SetBottomDock(const Value: Boolean); virtual;
procedure SetEachOtherDock(const Value: Boolean); virtual;
procedure SetEnableDock(const Value: Boolean); virtual;
procedure SetLeftDock(const Value: Boolean); virtual;
procedure SetRightDock(const Value: Boolean); virtual;
procedure SetTopDock(const Value: Boolean); virtual;
procedure AddDockStyle(ADockStyle: TJvDockBasicStyle); virtual;
procedure RemoveDockStyle(ADockStyle: TJvDockBasicStyle); virtual;
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
procedure WindowProc(var Msg: TMessage); virtual;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure Assign(Source: TPersistent); override;
{ Owner of this component }
property ParentForm: TForm read FParentForm;
property EnableDock: Boolean read FEnableDock write SetEnableDock default True;
property LeftDock: Boolean read FLeftDock write SetLeftDock default True;
property TopDock: Boolean read FTopDock write SetTopDock default True;
property RightDock: Boolean read FRightDock write SetRightDock default True;
property BottomDock: Boolean read FBottomDock write SetBottomDock default True;
property EachOtherDock: Boolean read FEachOtherDock write SetEachOtherDock default True;
property CustomDock: Boolean read FCustomDock write FCustomDock default True; {NEW!}
property DockStyle: TJvDockBasicStyle read FDockStyle write SetDockStyle;
end;
TJvDockCustomPanelEvent = procedure(Sender: TJvDockServer;
var AParent: TWinControl; var Align: TAlign) of object; {NEW!}
TJvDockCheckDockableEvent = procedure(DockClient: TJvDockClient; DockForm: TForm;
DockServer: TJvDockServer; DockPanel: TJvDockPanel; var CanDock: Boolean) of object; {NEW!}
TJvDockTabHostFormCreatedEvent = procedure(DockClient: TJvDockClient;
TabHost: TJvDockTabHostForm) of object;
TJvDockConjoinHostFormCreatedEvent = procedure(DockClient: TJvDockClient;
TabHost: TJvDockConjoinHostForm) of object;
TJvDockGetClientAlignSizeEvent = procedure(Align: TAlign; var Value: Integer) of object;
TJvDockFinishSetDockPanelSizeEvent = procedure(DockPanel: TJvDockPanel) of object;
{
TJvDockServer is the Creator of 4 panels and 4 splitters that are placed on
the form that contains the TJvDockServer. The type of the panels and splitters
is determined by the DockStyle.
o TJvDockServer maintains the panels and splitters. If the dock server is
destroyed then the panels and splitters are destroyed.
o If the DockStyle is changed then the panels+splitters are destroyed and
recreated.
o If DockStyle is set to nil then the panels+splitters are nil.
}
TJvDockPosition = (dpLeft, dpRight, dpTop, dpBottom, dpCustom); {dpCustom NEW!}
{$IFDEF RTL230_UP}
[ComponentPlatformsAttribute(pidWin32 or pidWin64)]
{$ENDIF RTL230_UP}
TJvDockServer = class(TJvDockBaseControl)
private
FDockPanelClass: TJvDockPanelClass;
FDockPanels: array [TJvDockPosition] of TJvDockPanel;
FDockSplitterClass: TJvDockSplitterClass;
FSplitters: array [TJvDockPosition] of TJvDockSplitter;
FSplitterStyles: array [TJvDockPosition] of TJvDockSplitterStyle;
FOnCustomPanel: TJvDockCustomPanelEvent; // Self, AParent, Align
FOnGetClientAlignSize: TJvDockGetClientAlignSizeEvent;
FOnFinishSetDockPanelSize: TJvDockFinishSetDockPanelSizeEvent;
FAutoFocusDockedForm: Boolean;
procedure CreateDockPanelAndSplitter;
procedure DestroyDockPanelAndSplitter;
procedure CreateSplitterStyle;
procedure DestroySplitterStyle;
procedure SetSplitterStyles;
procedure DoGetClientAlignControl(Align: TAlign; var Value: Integer);
function GetDockPanel(DockPosition: TJvDockPosition): TJvDockPanel;
function GetDockPanelIndex(const Index: Integer): TJvDockPanel;
function GetDockPanelWithAlign(Index: TAlign): TJvDockPanel;
function GetDockSplitterWithAlign(Index: TAlign): TJvDockSplitter;
function GetSplitter(DockPosition: TJvDockPosition): TJvDockSplitter;
function GetSplitterIndex(const Index: Integer): TJvDockSplitter;
function GetSplitterStyle(DockPosition: TJvDockPosition): TJvDockSplitterStyle;
function GetSplitterStyleIndex(const Index: Integer): TJvDockSplitterStyle;
procedure SetSplitterStyle(DockPosition: TJvDockPosition; ASplitterStyle: TJvDockSplitterStyle);
procedure SetSplitterStyleIndex(const Index: Integer; ASplitterStyle: TJvDockSplitterStyle);
protected
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
procedure DoFinishSetDockPanelSize(DockPanel: TJvDockPanel);
procedure DoFloatDockClients(DockPanel: TJvDockPanel);
procedure SetBottomDock(const Value: Boolean); override;
procedure SetEnableDock(const Value: Boolean); override;
procedure SetLeftDock(const Value: Boolean); override;
procedure SetRightDock(const Value: Boolean); override;
procedure SetTopDock(const Value: Boolean); override;
procedure AddDockStyle(ADockStyle: TJvDockBasicStyle); override;
procedure RemoveDockStyle(ADockStyle: TJvDockBasicStyle); override;
procedure WMActivate(var Msg: TWMActivate);
procedure WindowProc(var Msg: TMessage); override;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
function GetClientAlignControl(Align: TAlign): Integer;
property DockPanel[DockPosition: TJvDockPosition]: TJvDockPanel read GetDockPanel;
property Splitter[DockPosition: TJvDockPosition]: TJvDockSplitter read GetSplitter;
property SplitterStyle[DockPosition: TJvDockPosition]: TJvDockSplitterStyle read GetSplitterStyle write
SetSplitterStyle;
property LeftDockPanel: TJvDockPanel index 0 read GetDockPanelIndex;
property RightDockPanel: TJvDockPanel index 1 read GetDockPanelIndex;
property TopDockPanel: TJvDockPanel index 2 read GetDockPanelIndex;
property BottomDockPanel: TJvDockPanel index 3 read GetDockPanelIndex;
property CustomDockPanel: TJvDockPanel index 4 read GetDockPanelIndex;
property LeftSplitter: TJvDockSplitter index 0 read GetSplitterIndex;
property RightSplitter: TJvDockSplitter index 1 read GetSplitterIndex;
property TopSplitter: TJvDockSplitter index 2 read GetSplitterIndex;
property BottomSplitter: TJvDockSplitter index 3 read GetSplitterIndex;
property DockPanelWithAlign[Index: TAlign]: TJvDockPanel read GetDockPanelWithAlign;
property DockSplitterWithAlign[Index: TAlign]: TJvDockSplitter read GetDockSplitterWithAlign;
published
property LeftSplitterStyle: TJvDockSplitterStyle index 0 read GetSplitterStyleIndex write SetSplitterStyleIndex;
property RightSplitterStyle: TJvDockSplitterStyle index 1 read GetSplitterStyleIndex write SetSplitterStyleIndex;
property TopSplitterStyle: TJvDockSplitterStyle index 2 read GetSplitterStyleIndex write SetSplitterStyleIndex;
property BottomSplitterStyle: TJvDockSplitterStyle index 3 read GetSplitterStyleIndex write SetSplitterStyleIndex;
property AutoFocusDockedForm: Boolean read FAutoFocusDockedForm write FAutoFocusDockedForm default True;
property EnableDock;
property LeftDock;
property TopDock;
property RightDock;
property BottomDock;
property DockStyle;
property CustomDock;
property OnGetClientAlignSize: TJvDockGetClientAlignSizeEvent read FOnGetClientAlignSize
write FOnGetClientAlignSize;
property OnFinishSetDockPanelSize: TJvDockFinishSetDockPanelSizeEvent read FOnFinishSetDockPanelSize
write FOnFinishSetDockPanelSize;
property OnCustomPanel: TJvDockCustomPanelEvent read FOnCustomPanel write FOnCustomPanel; {NEW!}
end;
TJvDockMouseStation = (msFloat, msConjoin, msTabPage);
TJvDockNCButtonEvent = procedure(DockClient: TJvDockClient; Button: TMouseButton;
X, Y: Smallint; HitTest: Longint; MouseStation: TJvDockMouseStation) of object;
TJvDockNCButtonDownEvent = TJvDockNCButtonEvent;
TJvDockNCButtonUpEvent = TJvDockNCButtonEvent;
TJvDockNCButtonDblClkEvent = TJvDockNCButtonEvent;
TJvDockNCMouseMoveEvent = procedure(DockClient: TJvDockClient;
X, Y: Smallint; HitTest: Longint; MouseStation: TJvDockMouseStation) of object;
TJvDockPaintDockEvent = procedure(Canvas: TCanvas;
Control: TControl; const ARect: TRect) of object;
TJvDockPaintDockGrabberEvent = TJvDockPaintDockEvent;
TJvDockPaintDockSplitterEvent = TJvDockPaintDockEvent;
TJvDockFormHintEvent = procedure(HTFlag: Integer; var HintStr: string; var CanShow: Boolean) of object;
{$IFDEF RTL230_UP}
[ComponentPlatformsAttribute(pidWin32 or pidWin64)]
{$ENDIF RTL230_UP}
TJvDockClient = class(TJvDockBaseControl)
private
FConjoinPanelClass: TJvDockConjoinPanelClass;
FTabDockClass: TJvDockTabClass;
FParentVisible: Boolean;
FNCPopupMenu: TPopupMenu;
FDirectDrag: Boolean;
FShowHint: Boolean;
FCanFloat: Boolean;
FDockLevel: Integer;
FEnableCloseButton: Boolean;
FOnNCButtonDown: TJvDockNCButtonDownEvent;
FOnNCButtonUp: TJvDockNCButtonUpEvent;
FOnNCMouseMove: TJvDockNCMouseMoveEvent;
FOnNCButtonDblClk: TJvDockNCButtonDblClkEvent;
FOnPaintDockGrabber: TJvDockPaintDockGrabberEvent;
FOnPaintDockSplitter: TJvDockPaintDockSplitterEvent;
FOnFormShowHint: TJvDockFormHintEvent;
FOnFormShow: TNotifyEvent;
FOnFormHide: TNotifyEvent;
FOnCheckIsDockable: TJvDockCheckDockableEvent; {NEW!}
FOnTabHostFormCreated: TJvDockTabHostFormCreatedEvent; {NEW!}
FOnConjoinHostFormCreated: TJvDockConjoinHostFormCreatedEvent; {NEW!}
FCurrentDockSite: TWinControl;
FLastDockSite: TWinControl;
FUnDockLeft: Integer;
FUnDockTop: Integer;
FVSPaneWidth: Integer;
procedure SetParentVisible(const Value: Boolean);
function GetLRDockWidth: Integer;
function GetTBDockHeight: Integer;
procedure SetLRDockWidth(const Value: Integer);
procedure SetTBDockHeight(const Value: Integer);
procedure SetNCPopupMenu(Value: TPopupMenu);
procedure WMNCLButtonDown(var Msg: TWMNCHitMessage);
procedure WMNCLButtonUp(var Msg: TWMNCHitMessage);
procedure WMNCLButtonDblClk(var Msg: TWMNCHitMessage);
procedure WMNCMButtonDown(var Msg: TWMNCHitMessage);
procedure WMNCMButtonUp(var Msg: TWMNCHitMessage);
procedure WMNCMButtonDblClk(var Msg: TWMNCHitMessage);
procedure WMNCRButtonDown(var Msg: TWMNCHitMessage);
procedure WMNCRButtonUp(var Msg: TWMNCHitMessage);
procedure WMNCRButtonDblClk(var Msg: TWMNCHitMessage);
procedure WMNCMouseMove(var Msg: TWMNCHitMessage);
procedure CMVisibleChanged(var Msg: TMessage);
procedure SetCurrentDockSite(const Value: TWinControl);
procedure SetLastDockSite(ALastDockSite: TWinControl);
procedure SetVSPaneWidth(const Value: Integer);
procedure SetUnDockLeft(const Value: Integer);
procedure SetUnDockTop(const Value: Integer);
function GetDockState: Integer;
procedure SetCanFloat(const Value: Boolean);
procedure SetDockLevel(const Value: Integer);
procedure SetEnableCloseButton(const Value: Boolean);
protected
procedure DoMenuPopup(X, Y: Integer); virtual;
procedure Deactivate; virtual;
procedure Activate; virtual;
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
procedure DoFloatDockClients(PanelAlign: TAlign);
procedure DoFloatDockEachOther;
procedure SetBottomDock(const Value: Boolean); override;
procedure SetEachOtherDock(const Value: Boolean); override;
procedure SetEnableDock(const Value: Boolean); override;
procedure SetLeftDock(const Value: Boolean); override;
procedure SetRightDock(const Value: Boolean); override;
procedure SetTopDock(const Value: Boolean); override;
procedure DoFormOnClose(Sender: TObject; var Action: TCloseAction); override;
procedure AddDockStyle(ADockStyle: TJvDockBasicStyle); override;
procedure RemoveDockStyle(ADockStyle: TJvDockBasicStyle); override;
procedure WMSize(var Msg: TWMSize);
procedure WMActivate(var Msg: TWMActivate);
procedure WindowProc(var Msg: TMessage); override;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure FormStartDock(var Source: TJvDockDragDockObject); virtual;
procedure FormPositionDockRect(Source: TJvDockDragDockObject); virtual;
procedure FormDockOver(Source: TJvDockDragDockObject; X, Y: Integer;
State: TDragState; var Accept: Boolean); virtual;
procedure FormDockDrop(Source: TJvDockDragDockObject; X, Y: Integer); virtual;
procedure FormEndDock(Target: TObject; X, Y: Integer); virtual;
function FormUnDock(NewTarget: TWinControl; Client: TControl): Boolean; virtual;
procedure FormGetSiteInfo(Source: TJvDockDragDockObject;
Client: TControl; var InfluenceRect: TRect; MousePos: TPoint;
var CanDock: Boolean); virtual;
procedure FormGetDockEdge(Source: TJvDockDragDockObject; MousePos: TPoint; var DropAlign: TAlign); virtual;
procedure Assign(Source: TPersistent); override;
procedure MakeShowEvent;
procedure MakeHideEvent;
function CreateConjoinPanelClass(ConjoinHost: TForm): TJvDockConjoinPanel;
function CreateTabDockClass(TabHost: TForm): TJvDockTabPageControl;
function CreateConjoinHostAndDockControl(Control1, Control2: TControl;
DockType: TAlign): TJvDockConjoinHostForm; virtual;
function CreateTabHostAndDockControl(Control1, Control2: TControl): TJvDockTabHostForm; virtual;
function FindTabHostForm: TForm;
// return nil if not found, otherwise, get currently docked parent tabhost form if there is one.
procedure DoNCButtonDown(Msg: TWMNCHitMessage; Button: TMouseButton;
MouseStation: TJvDockMouseStation); virtual;
procedure DoNCButtonUp(Msg: TWMNCHitMessage; Button: TMouseButton;
MouseStation: TJvDockMouseStation); virtual;
procedure DoNCMouseMove(Msg: TWMNCHitMessage;
MouseStation: TJvDockMouseStation); virtual;
procedure DoNCButtonDblClk(Msg: TWMNCHitMessage; Button: TMouseButton;
MouseStation: TJvDockMouseStation); virtual;
procedure DoPaintDockGrabber(Canvas: TCanvas;
Control: TControl; const ARect: TRect);
procedure DoPaintDockSplitter(Canvas: TCanvas;
Control: TControl; const ARect: TRect);
procedure DoFormShowHint(HTFlag: Integer; var HintStr: string; var CanShow: Boolean);
procedure ShowParentForm;
procedure HideParentForm;
procedure RestoreChild;
property VSPaneWidth: Integer read FVSPaneWidth write SetVSPaneWidth;
property ParentVisible: Boolean read FParentVisible write SetParentVisible;
{ (rb) not used? }
property CurrentDockSite: TWinControl read FCurrentDockSite write SetCurrentDockSite;
property LastDockSite: TWinControl read FLastDockSite write SetLastDockSite;
property UnDockLeft: Integer read FUnDockLeft write SetUnDockLeft;
property UnDockTop: Integer read FUnDockTop write SetUnDockTop;
property DockState: Integer read GetDockState;
published
property LRDockWidth: Integer read GetLRDockWidth write SetLRDockWidth default 100;
property TBDockHeight: Integer read GetTBDockHeight write SetTBDockHeight default 100;
property NCPopupMenu: TPopupMenu read FNCPopupMenu write SetNCPopupMenu;
property DirectDrag: Boolean read FDirectDrag write FDirectDrag;
property ShowHint: Boolean read FShowHint write FShowHint default True;
property CanFloat: Boolean read FCanFloat write SetCanFloat default True;
{ Not implemented; intention: only forms with the same DockLevel could be docked together }
property DockLevel: Integer read FDockLevel write SetDockLevel default 0;
property EnableCloseButton: Boolean read FEnableCloseButton write SetEnableCloseButton default True;
property EnableDock;
property LeftDock;
property TopDock;
property RightDock;
property BottomDock;
property EachOtherDock;
property DockStyle;
property CustomDock;
property OnFormShow: TNotifyEvent read FOnFormShow write FOnFormShow;
property OnFormHide: TNotifyEvent read FOnFormHide write FOnFormHide;
property OnCheckIsDockable: TJvDockCheckDockableEvent read FOnCheckIsDockable write FOnCheckIsDockable; {NEW!}
property OnTabHostFormCreated: TJvDockTabHostFormCreatedEvent read FOnTabHostFormCreated
write FOnTabHostFormCreated; {NEW!}
property OnConjoinHostFormCreated: TJvDockConjoinHostFormCreatedEvent read FOnConjoinHostFormCreated
write FOnConjoinHostFormCreated; {NEW!}
property OnNCButtonDown: TJvDockNCButtonDownEvent read FOnNCButtonDown write FOnNCButtonDown;
property OnNCButtonUp: TJvDockNCButtonUpEvent read FOnNCButtonUp write FOnNCButtonUp;
property OnNCMouseMove: TJvDockNCMouseMoveEvent read FOnNCMouseMove write FOnNCMouseMove;
property OnNCButtonDblClk: TJvDockNCButtonDblClkEvent read FOnNCButtonDblClk write FOnNCButtonDblClk;
property OnPaintDockGrabber: TJvDockPaintDockGrabberEvent read FOnPaintDockGrabber write FOnPaintDockGrabber;
property OnPaintDockSplitter: TJvDockPaintDockSplitterEvent read FOnPaintDockSplitter write FOnPaintDockSplitter;
property OnFormShowHint: TJvDockFormHintEvent read FOnFormShowHint write FOnFormShowHint;
end;
{ Maintained by a TJvDockConjoinHostForm; That is (always) the owner, ie.
that is assumed on multiple places in the code) }
TJvDockConjoinPanel = class(TJvDockCustomPanel)
private
function GetDockClient: TJvDockClient;
function GetParentForm: TJvDockConjoinHostForm;
procedure CMUnDockClient(var Msg: TCMUnDockClient); message CM_UNDOCKCLIENT;
protected
function CreateDockManager: IDockManager; override;
procedure ReloadDockedControl(const AControlName: string; var AControl: TControl); override;
procedure CustomStartDock(var Source: TJvDockDragDockObject); override;
procedure CustomGetSiteInfo(Source: TJvDockDragDockObject;
Client: TControl; var InfluenceRect: TRect; MousePos: TPoint;
var CanDock: Boolean); override;
procedure CustomDockOver(Source: TJvDockDragDockObject; X, Y: Integer;
State: TDragState; var Accept: Boolean); override;
procedure CustomPositionDockRect(Source: TJvDockDragDockObject; X, Y: Integer); override;
procedure CustomDockDrop(Source: TJvDockDragDockObject; X, Y: Integer); override;
procedure CustomEndDock(Target: TObject; X, Y: Integer); override;
function CustomUnDock(Source: TJvDockDragDockObject; NewTarget: TWinControl;
Client: TControl): Boolean; override;
procedure DoDockOver(Source: TDragDockObject; X, Y: Integer; State: TDragState;
var Accept: Boolean); override;
procedure GetSiteInfo(Client: TControl; var InfluenceRect: TRect;
MousePos: TPoint; var CanDock: Boolean); override;
function DoUnDock(NewTarget: TWinControl; Client: TControl): Boolean; override;
public
constructor Create(AOwner: TComponent); override;
procedure DockDrop(Source: TDragDockObject; X, Y: Integer); override;
{ DockClient of the Owner }
property DockClient: TJvDockClient read GetDockClient;
{ ParentForm is the Owner }
property ParentForm: TJvDockConjoinHostForm read GetParentForm;
end;
TJvDockAdvConjoinPanel = class(TJvDockConjoinPanel)
private
procedure CMUnDockClient(var Msg: TCMUnDockClient); message CM_UNDOCKCLIENT;
protected
procedure CustomDockDrop(Source: TJvDockDragDockObject; X, Y: Integer); override;
function CustomUnDock(Source: TJvDockDragDockObject; NewTarget: TWinControl;
Client: TControl): Boolean; override;
function DoUnDock(NewTarget: TWinControl; Client: TControl): Boolean; override;
public
procedure DockDrop(Source: TDragDockObject; X, Y: Integer); override;
end;
{ Maintained by a TJvDockTabHostForm; That is (always) the owner, ie.
that is assumed on multiple places in the code) }
TJvDockTabPageControl = class(TJvDockPageControl)
private
FVersion: Integer;
FStyleLink: TJvDockStyleLink;
function GetParentForm: TJvDockTabHostForm;
procedure DockStyleChanged(Sender: TObject);
function GetDockStyle: TJvDockObservableStyle;
function GetActiveDockForm: TCustomForm;
function GetDockForm(Index: Integer): TCustomForm;
protected
procedure AdjustClientRect(var Rect: TRect); override;
procedure ReloadDockedControl(const AControlName: string;
var AControl: TControl); override;
procedure CustomStartDock(var Source: TJvDockDragDockObject); override;
procedure CustomGetSiteInfo(Source: TJvDockDragDockObject; Client: TControl;
var InfluenceRect: TRect; MousePos: TPoint; var CanDock: Boolean); override;
procedure CustomDockOver(Source: TJvDockDragDockObject; X, Y: Integer;
State: TDragState; var Accept: Boolean); override;
procedure CustomPositionDockRect(Source: TJvDockDragDockObject; X, Y: Integer); override;
procedure CustomDockDrop(Source: TJvDockDragDockObject; X, Y: Integer); override;
procedure CustomEndDock(Target: TObject; X, Y: Integer); override;
function CustomUnDock(Source: TJvDockDragDockObject; NewTarget: TWinControl;
Client: TControl): Boolean; override;
procedure CustomGetDockEdge(Source: TJvDockDragDockObject; MousePos: TPoint;
var DropAlign: TAlign); override;
function DoUnDock(NewTarget: TWinControl; Client: TControl): Boolean; override;
procedure SyncWithStyle; virtual;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure AfterConstruction; override;
procedure DockDrop(Source: TDragDockObject; X, Y: Integer); override;
procedure LoadFromStream(Stream: TStream); virtual;
procedure SaveToStream(Stream: TStream); virtual;
property ActiveDockForm: TCustomForm read GetActiveDockForm;
property DockForm[Index: Integer]: TCustomForm read GetDockForm;
{ ParentForm is the Owner }
property ParentForm: TJvDockTabHostForm read GetParentForm;
property TabPosition;
property DockStyle: TJvDockObservableStyle read GetDockStyle;
end;
TJvDockAdvTabPageControl = class(TJvDockTabPageControl)
private
procedure CMUnDockClient(var Msg: TCMUnDockClient); message CM_UNDOCKCLIENT;
protected
procedure CustomDockDrop(Source: TJvDockDragDockObject; X, Y: Integer); override;
function CustomUnDock(Source: TJvDockDragDockObject; NewTarget: TWinControl;
Client: TControl): Boolean; override;
function DoUnDock(NewTarget: TWinControl; Client: TControl): Boolean; override;
public
destructor Destroy; override;
procedure DockDrop(Source: TDragDockObject; X, Y: Integer); override;
end;
{ A TJvDockableForm is a base class for TJvDockConjoinHostForm
and TJvDockTabHostForm which are the base classes for the two kinds of
docked-views possible for handling multiple controls docked to the same
dock site.
This form is not meant to be visible to the user nor to contain any
visible components, it is just part of the docking framework.
This is the reason why it does not inherit from TJvForm, and it were
inheriting from it, all sorts of weird bugs would show up (Mantis 5023)
}
TJvDockableForm = class(TForm) { DO NOT MAKE THIS TJvForm! }
private
FDockClient: TJvDockClient;
FDockableControl: TWinControl;
FUnDockControl: TControl;
FFloatingChild: TControl;
function GetDockableControl: TWinControl;
procedure SetDockableControl(const Value: TWinControl);
procedure SetUnDockControl(const Value: TControl);
protected
procedure DoClose(var Action: TCloseAction); override;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
{ Fixed DockClient owned by the component }
property DockClient: TJvDockClient read FDockClient;
{ Either a TJvDockTabPageControl or a TJvDockConjoinPanel, assigned on
construction of the dockable form }
property DockableControl: TWinControl read GetDockableControl write SetDockableControl;
{ ?? Probably needs notification }
property UnDockControl: TControl read FUnDockControl write SetUnDockControl;
{ ?? Probably needs notification }
property FloatingChild: TControl read FFloatingChild;
end;
TJvDockConjoinHostForm = class(TJvDockableForm)
private
FPanel: TJvDockConjoinPanel;
protected
procedure DoClose(var Action: TCloseAction); override;
public
constructor Create(AOwner: TComponent); override;
property DockClient;
{ Constructed in TJvDockClient.CreateConjoinPanelClass }
property Panel: TJvDockConjoinPanel read FPanel write FPanel;
end;
TJvDockTabHostForm = class(TJvDockableForm)
private
FPageControl: TJvDockTabPageControl;
public
constructor Create(AOwner: TComponent); override;
procedure ShowDockedControl(AControl:TWinControl); virtual; // If aControl is docked in PageControl, change PageControl to that page. NEW! WPostma.
procedure UpdateCaption(AControl:TWinControl); virtual; // update tab host's tabs and title bar when page caption changes.
procedure DoDock(NewDockSite: TWinControl; var ARect: TRect); override;
// backwards compatibility: Mantis 4100
function GetActiveDockForm: TForm;
property DockClient;
{ Constructed in TJvDockClient.CreateTabDockClass }
property PageControl: TJvDockTabPageControl read FPageControl write FPageControl;
end;
TJvGlobalDockManager = class(TJvDockManager)
private
FDockServers: TList;
FDockClients: TList;
FDockableForms: TList;
function GetDockClient(const Index: Integer): TJvDockClient;
function GetDockClientCount: Integer;
function GetDockServer(const Index: Integer): TJvDockServer;
function GetDockServerCount: Integer;
function GetDockableForm(const Index: Integer): TJvDockableForm;
function GetDockableFormCount: Integer;
public
constructor Create; override;
destructor Destroy; override;
procedure RegisterDockServer(ADockServer: TJvDockServer);
procedure RegisterDockClient(ADockClient: TJvDockClient);
procedure RegisterDockableForm(ADockableForm: TJvDockableForm);
procedure UnRegisterDockServer(ADockServer: TJvDockServer);
procedure UnRegisterDockClient(ADockClient: TJvDockClient);
procedure UnRegisterDockableForm(ADockableForm: TJvDockableForm);
function FindDockServerForm(const AName: string): TControl;
function FindDockClientForm(const AName: string): TControl;
function FindDockControlForm(const AName: string): TControl;
property DockServer[const Index: Integer]: TJvDockServer read GetDockServer;
property DockClient[const Index: Integer]: TJvDockClient read GetDockClient;
property DockableForm[const Index: Integer]: TJvDockableForm read GetDockableForm;
property DockServerCount: Integer read GetDockServerCount;
property DockClientCount: Integer read GetDockClientCount;
property DockableFormCount: Integer read GetDockableFormCount;
end;
var
DefaultDockPanelClass: TJvDockPanelClass = TJvDockPanel;
DefaultDockSplitterClass: TJvDockSplitterClass = TJvDockSplitter;
DefaultConjoinPanelClass: TJvDockConjoinPanelClass = TJvDockConjoinPanel;
DefaultTabDockClass: TJvDockTabClass = TJvDockTabPageControl;
DefaultDockZoneClass: TJvDockZoneClass = TJvDockZone;
DefaultDockTreeClass: TJvDockTreeClass = TJvDockTree;
procedure ShowDockForm(DockWindow: TWinControl);
procedure HideDockForm(DockWindow: TWinControl);
procedure MakeDockClientEvent(Host: TControl; Visible: Boolean);
function GetFormVisible(DockWindow: TWinControl): Boolean;
procedure SetDockPageControlPopupMenu(Value: TPopupMenu);
procedure SetDockPageControlHotTrack(Value: Boolean);
procedure SetTabDockHostBorderStyle(Value: TFormBorderStyle);
procedure SetConjoinDockHostBorderStyle(Value: TFormBorderStyle);
// Save Layout to JvAppStorage:
procedure SaveDockTreeToAppStorage(AppStorage: TJvCustomAppStorage; AppStoragePath: string = '');
// Load Layout from JvAppStorage:
procedure LoadDockTreeFromAppStorage(AppStorage: TJvCustomAppStorage; AppStoragePath: string = '');
procedure SaveDockTreeToFile(FileName: string);
procedure LoadDockTreeFromFile(FileName: string);
procedure SaveDockTreeToReg(ARootKey: DWORD; RegPatch: string);
procedure LoadDockTreeFromReg(ARootKey: DWORD; RegPatch: string);
function FindDockBaseControl(Client: TControl): TJvDockBaseControl;
function FindDockClient(Client: TControl): TJvDockClient;
function FindDockServer(Client: TControl): TJvDockServer;
function IsDockable(Sender: TWinControl; Client: TControl;
DropCtl: TControl = nil; DockAlign: TAlign = alNone): Boolean;
function ComputeDockingRect(AControl: TControl;
var DockRect: TRect; MousePos: TPoint): TAlign;
{ Undocks AControl from Sender; Sender is used to calculate the rectangle in
which AControl is displayed when it starts floating. }
procedure DoFloat(Sender, AControl: TControl);
procedure SetDockSite(Control: TWinControl; SiteValue: Boolean);
procedure DoFloatForm(DockForm: TControl);
procedure FreeAllDockableForm;
procedure DoFloatAllForm;
function GetClientAlignControlArea(AControl: TWinControl; Align: TAlign; Exclude: TControl = nil): Integer;
procedure ResetDockClient(Control: TControl; NewTarget: TControl); overload;
procedure ResetDockClient(DockClient: TJvDockClient; NewTarget: TControl); overload;
{ Quick way to do tabbed docking programmatically - Added by Warren. New implementation Jan 2010 }
function ManualTabDock(DockSite: TWinControl; Form1, Form2: TForm): TJvDockTabHostForm;
function _ManualTabDock(DockSite: TWinControl; Form1, Form2: TForm;oldTechnique:Boolean=false): TJvDockTabHostForm; {experimental}
{ Must create the initial tab dock with two pages, using ManualTabDock,
then you can add more pages with this:}
procedure ManualTabDockAddPage(TabHost: TJvDockTabHostForm; AForm: TForm);
function ManualConjoinDock(DockSite: TWinControl; Form1, Form2: TForm): TJvDockConjoinHostForm;
function DockStateStr(DockState: Integer): string; {return string for a dock state}
procedure BeginDockLoading;
procedure EndDockLoading;
function JvGlobalDockIsLoading: Boolean;
{$IFNDEF COMPILER9_UP}
procedure InvalidateDockHostSiteOfControl(Control: TControl; FocusLost: Boolean);
{$ENDIF !COMPILER9_UP}
{$IFDEF UNITVERSIONING}
const
UnitVersioning: TUnitVersionInfo = (
RCSfile: '$URL$';
Revision: '$Revision$';
Date: '$Date$';
LogPath: 'JVCL\run'
);
{$ENDIF UNITVERSIONING}
implementation
uses
Types, SysUtils,
JclSysInfo,
JvAppRegistryStorage, JvAppIniStorage, JvTypes,
JvDockSupportProc, JvDockGlobals, JvDockInfo, JvDockVSNetStyle, JvJVCLUtils;
{$R JvDockableForm.dfm}
{$R JvDockConjoinHost.dfm}
{$R JvDockTabHost.dfm}
type
TControlAccessProtected = class(TControl);
TWinControlAccessProtected = class(TWinControl);
var
DockPageControlPopupMenu: TPopupMenu = nil;
DockPageControlHotTrack: Boolean = False;
TabDockHostBorderStyle: TFormBorderStyle = bsSizeToolWin;
ConjoinDockHostBorderStyle: TFormBorderStyle = bsSizeToolWin;
GDockLoadCount: Integer = 0;
GShowingChanged: TList;
//=== Local procedures =======================================================
function IsWinXP_UP: Boolean;
begin
Result := (Win32Platform = VER_PLATFORM_WIN32_NT) and JclCheckWinVersion(5, 1);
end;
procedure ApplyShowingChanged;
var
I: Integer;
begin
if IsWinXP_UP and (GShowingChanged <> nil) then
for I := 0 to Screen.FormCount - 1 do
if GShowingChanged.IndexOf(Screen.Forms[I]) >= 0 then
Screen.Forms[i].Perform(CM_SHOWINGCHANGED, 0, 0);
FreeAndNil(GShowingChanged);
end;
procedure UpdateCaption(Source: TWinControl; Exclude: TControl);
var
I: Integer;
Host: TJvDockableForm;
begin
if (Source <> nil) and (Source.Parent is TJvDockableForm) then
begin
Host := TJvDockableForm(Source.Parent);
Host.Caption := '';
for I := 0 to Source.DockClientCount - 1 do
if Source.DockClients[I].Visible and (Source.DockClients[I] <> Exclude) then
Host.Caption := Host.Caption + TCustomForm(Source.DockClients[I]).Caption + RsDockStringSplitter;
if Host.HostDockSite is TJvDockTabPageControl then
with TJvDockTabPageControl(Host.HostDockSite) do
if (ActivePage <> nil) and (ActivePage.Controls[0] = Source) then
ActivePage.Caption := Host.Caption;
UpdateCaption(Host.HostDockSite, nil);
end;
end;
//=== Global procedures ======================================================
procedure BeginDockLoading;
begin
if GDockLoadCount = 0 then
begin
JvDockLockWindow(nil);
end;
Inc(GDockLoadCount);
end;
procedure EndDockLoading;
begin
Dec(GDockLoadCount);
if GDockLoadCount = 0 then
begin
ApplyShowingChanged;
JvDockUnLockWindow;
end;
end;
function JvGlobalDockIsLoading: Boolean;
begin
Result := GDockLoadCount > 0;
end;
function ComputeDockingRect(AControl: TControl; var DockRect: TRect; MousePos: TPoint): TAlign;
var
DockTopRect, DockLeftRect, DockBottomRect, DockRightRect, DockCenterRect: TRect;
begin
Result := alNone;
if AControl = nil then
Exit;
with AControl do
begin
DockLeftRect.TopLeft := Point(0, 0);
DockLeftRect.BottomRight := Point(ClientWidth div 5, ClientHeight);
DockTopRect.TopLeft := Point(ClientWidth div 5, 0);
DockTopRect.BottomRight := Point(ClientWidth div 5 * 4, ClientHeight div 5);
DockRightRect.TopLeft := Point(ClientWidth div 5 * 4, 0);
DockRightRect.BottomRight := Point(ClientWidth, ClientHeight);
DockBottomRect.TopLeft := Point(ClientWidth div 5, ClientHeight div 5 * 4);
DockBottomRect.BottomRight := Point(ClientWidth div 5 * 4, ClientHeight);
DockCenterRect.TopLeft := Point(ClientWidth div 5, ClientHeight div 5);
DockCenterRect.BottomRight := Point(ClientWidth div 5 * 4, ClientHeight div 5 * 4);
if PtInRect(DockLeftRect, MousePos) then
begin
Result := alLeft;