📄 jvdockvidvcstyle.pas
字号:
if DockBaseControl is TJvDockClient then
begin
ADockClient := TJvDockClient(DockBaseControl);
if IsCreate then
ADockClient.DirectDrag := False;
end;
end;
procedure TJvDockVIDVCStyle.FormStartDock(DockClient: TJvDockClient;
var Source: TJvDockDragDockObject);
begin
inherited FormStartDock(DockClient, Source);
Source := TJvDockVIDVCDragDockObject.Create(DockClient.ParentForm);
end;
procedure TJvDockVIDVCStyle.FormGetDockEdge(DockClient: TJvDockClient;
Source: TJvDockDragDockObject; MousePos: TPoint; var DropAlign: TAlign);
var
ARect: TRect;
begin
DropAlign := ComputeVIDDockingRect(DockClient.ParentForm, Source.Control, ARect, MousePos);
end;
function TJvDockVIDVCStyle.DockClientWindowProc(DockClient: TJvDockClient;
var Msg: TMessage): Boolean;
begin
Result := inherited DockClientWindowProc(DockClient, Msg);
end;
procedure TJvDockVIDVCStyle.CreateConjoinServerOption(
var Option: TJvDockBasicConjoinServerOption);
begin
Option := TJvDockVIDVCConjoinServerOption.Create(Self);
end;
procedure TJvDockVIDVCStyle.CreateTabServerOption(var Option: TJvDockBasicTabServerOption);
begin
Option := TJvDockVIDVCTabServerOption.Create(Self);
end;
procedure TJvDockVIDVCStyle.AssignConjoinServerOption(APanel: TJvDockCustomPanel);
begin
inherited AssignConjoinServerOption(APanel);
end;
procedure TJvDockVIDVCStyle.AssignTabServerOption(APage: TJvDockTabPageControl);
var
TmpPage: TJvDockVIDVCTabPageControl;
TmpOption: TJvDockVIDVCTabServerOption;
begin
inherited AssignTabServerOption(APage);
if (APage is TJvDockVIDVCTabPageControl) and (TabServerOption is TJvDockVIDVCTabServerOption) then
begin
TmpPage := APage as TJvDockVIDVCTabPageControl;
TmpOption := TabServerOption as TJvDockVIDVCTabServerOption;
TmpPage.ActiveFont.Assign(TmpOption.ActiveFont);
TmpPage.ActiveSheetColor := TmpOption.ActiveSheetColor;
TmpPage.InactiveFont.Assign(TmpOption.InactiveFont);
TmpPage.InactiveSheetColor := TmpOption.InactiveSheetColor;
TmpPage.HotTrackColor := TmpOption.HotTrackColor;
TmpPage.ShowTabImages := TmpOption.ShowTabImages;
end;
end;
procedure TJvDockVIDVCStyle.ParentFormWindowProc(var Msg: TMessage);
begin
inherited ParentFormWindowProc(Msg);
if (Msg.Msg = WM_SETTINGCHANGE) or (Msg.Msg = WM_SYSCOLORCHANGE) then
begin
ParentForm.Caption := '';
if ConjoinServerOption is TJvDockVIDVCConjoinServerOption then
if TJvDockVIDVCConjoinServerOption(ConjoinServerOption).SystemInfo then
TJvDockVIDVCConjoinServerOption(ConjoinServerOption).SetDefaultSystemCaptionInfo;
end;
end;
procedure TJvDockVIDVCStyle.DoSystemInfoChange(Value: Boolean);
begin
if Assigned(FSystemInfoChange) then
FSystemInfoChange(Value);
end;
//=== { TJvDockVIDVCPanel } ==================================================
function TJvDockVIDVCPanel.CreateDockManager: IDockManager;
var
Option: TJvDockVIDVCConjoinServerOption;
begin
Result := inherited CreateDockManager;
if (DockServer <> nil) and (Result <> nil) then
begin
Option := TJvDockVIDVCConjoinServerOption(DockServer.DockStyle.ConjoinServerOption);
(Result as IJvDockManager).GrabberSize := Option.GrabbersSize;
end;
end;
procedure TJvDockVIDVCPanel.CustomDockDrop(Source: TJvDockDragDockObject; X, Y: Integer);
begin
if Source.Control is TJvDockableForm then
ShowDockPanel(True, Source.Control);
if not ((Source.Control.HostDockSite <> nil) and
(Source.DropOnControl = Source.Control.HostDockSite.Parent) and
(Source.DropAlign = alClient)) then
begin
inherited CustomDockDrop(Source, X, Y);
JvDockManager.ActiveControl := Source.Control;
if (Source.Control is TWinControl) and TWinControl(Source.Control).CanFocus then
TWinControl(Source.Control).SetFocus;
end;
end;
procedure TJvDockVIDVCPanel.CustomDockOver(Source: TJvDockDragDockObject;
X, Y: Integer; State: TDragState; var Accept: Boolean);
var
DropAlign: TAlign;
begin
inherited CustomDockOver(Source, X, Y, State, Accept);
if Accept and (Source is TJvDockVIDVCDragDockObject) then
if State = dsDragMove then
begin
DropAlign := Source.DropAlign;
JvDockManager.GetDockEdge(Source.DockRect, Source.DragPos, DropAlign, Source.Control);
end;
end;
procedure TJvDockVIDVCPanel.CustomGetDockEdge(Source: TJvDockDragDockObject;
MousePos: TPoint; var DropAlign: TAlign);
begin
end;
procedure TJvDockVIDVCPanel.CustomGetSiteInfo(Source: TJvDockDragDockObject;
Client: TControl; var InfluenceRect: TRect; MousePos: TPoint;
var CanDock: Boolean);
begin
if VisibleDockClientCount = 0 then
inherited CustomGetSiteInfo(Source, Client, InfluenceRect, MousePos, CanDock)
else
begin
CanDock := IsDockable(Self, Client, Source.DropOnControl, Source.DropAlign);
if CanDock then
JvDockManager.GetSiteInfo(Client, InfluenceRect, MousePos, CanDock);
end;
end;
procedure TJvDockVIDVCPanel.CustomStartDock(var Source: TJvDockDragDockObject);
begin
Source := TJvDockVIDVCDragDockObject.Create(Self);
end;
procedure TJvDockVIDVCPanel.DockDrop(Source: TDragDockObject; X, Y: Integer);
begin
inherited DockDrop(Source, X, Y);
end;
procedure TJvDockVIDVCPanel.UpdateCaption(Exclude: TControl);
begin
inherited UpdateCaption(Exclude);
Invalidate;
end;
//=== { TJvDockVIDVCTree } ===================================================
constructor TJvDockVIDVCTree.Create(DockSite: TWinControl;
DockZoneClass: TJvDockZoneClass; ADockStyle: TComponent);
begin
inherited Create(DockSite, DockZoneClass, ADockStyle);
FDropOnZone := nil;
GrabberSize := 18;
ButtonHeight := 11;
ButtonWidth := 13;
LeftOffset := 2;
RightOffset := 2;
TopOffset := 4;
BottomOffset := 3;
ButtonSplitter := 2;
BorderWidth := 4;
MinSize := 20;
CaptionLeftOffset := 0;
CaptionRightOffset := 0;
end;
procedure TJvDockVIDVCTree.InsertControl(Control: TControl; InsertAt: TAlign;
DropCtl: TControl);
var
I: Integer;
Host: TJvDockTabHostForm;
ChildCount: Integer;
VIDSource: TJvDockVIDVCDragDockObject;
TempControl: TControl;
ARect: TRect;
AZone: TJvDockZone;
function CreateDockPageControl(Client: TControl): TJvDockTabHostForm;
var
Zone: TJvDockZone;
TempCtl: TControl;
TempPanel: TJvDockConjoinPanel;
DockClient: TJvDockClient;
APoint: TPoint;
begin
Result := nil;
Zone := FindControlZone(DropCtl);
DockClient := FindDockClient(DropCtl);
if (DockClient <> nil) and (Zone <> nil) then
begin
TempCtl := DropCtl;
if Zone.ParentZone.Orientation = doHorizontal then
begin
if Zone.PrevSibling = nil then
begin
if Zone.NextSibling <> nil then
DropCtl := Zone.NextSibling.ChildControl;
InsertAt := alTop;
end
else
begin
DropCtl := Zone.PrevSibling.ChildControl;
InsertAt := alBottom;
end;
end
else
if Zone.ParentZone.Orientation = doVertical then
begin
if Zone.PrevSibling = nil then
begin
if Zone.NextSibling <> nil then
DropCtl := Zone.NextSibling.ChildControl;
InsertAt := alLeft;
end
else
begin
DropCtl := Zone.PrevSibling.ChildControl;
InsertAt := alRight;
end;
end;
if TempCtl.HostDockSite is TJvDockConjoinPanel then
TempPanel := TJvDockConjoinPanel(TempCtl.HostDockSite)
else
TempPanel := nil;
Result := DockClient.CreateTabHostAndDockControl(TempCtl, Client);
if TempPanel <> nil then
TempPanel.ParentForm.UnDockControl := Result;
SetDockSite(TWinControl(TempCtl), False);
SetDockSite(TWinControl(Client), False);
if DockSite.Align = alBottom then
APoint := Point(0, -TempCtl.TBDockHeight)
else
if DockSite.Align = alRight then
APoint := Point(-TempCtl.LRDockWidth, 0)
else
APoint := Point(0, 0);
APoint := DockSite.ClientToScreen(APoint);
Result.Left := APoint.X;
Result.Top := APoint.Y;
Result.UndockWidth := TempCtl.UndockWidth;
Result.UndockHeight := TempCtl.UndockHeight;
Result.LRDockWidth := TempCtl.LRDockWidth;
Result.TBDockHeight := TempCtl.TBDockHeight + GrabberSize;
Result.Visible := True;
end;
end;
begin
if not JvGlobalDockIsLoading then
JvDockLockWindow(nil);
try
VIDSource := nil;
if Control is TJvDockableForm then
begin
if InsertAt in [alClient] then
begin
if DropCtl is TJvDockTabHostForm then
begin
try
VIDSource := TJvDockVIDVCDragDockObject.Create(Control);
DoFloatForm(Control);
FreeAllDockableForm;
for I := VIDSource.SourceDockClientCount - 1 downto 0 do
begin
TempControl := VIDSource.SourceDockClients[I];
TempControl.ManualDock(TJvDockTabHostForm(DropCtl).PageControl);
if TempControl is TForm then
begin
TForm(TempControl).ActiveControl := nil;
SetDockSite(TForm(TempControl), False);
end;
end;
finally
VIDSource.Free;
JvGlobalDockManager.DragObject.Control := nil;
end;
end
else
begin
if (DockSite is TJvDockCustomPanel) and (DockSite.VisibleDockClientCount > 1) and (DropCtl <> nil) then
begin
try
VIDSource := TJvDockVIDVCDragDockObject.Create(Control);
DoFloatForm(Control);
FreeAllDockableForm;
Host := CreateDockPageControl(VIDSource.SourceDockClients[0]);
if Host <> nil then
begin
for I := VIDSource.SourceDockClientCount - 1 downto 1 do
begin
TempControl := VIDSource.SourceDockClients[I];
TempControl.ManualDock(Host.PageControl);
if TempControl is TForm then
begin
TForm(TempControl).ActiveControl := nil;
SetDockSite(TForm(TempControl), False);
end;
end;
Host.ManualDock(DockSite, nil, InsertAt);
end;
finally
VIDSource.Free;
JvGlobalDockManager.DragObject.Control := nil;
end;
end
else
inherited InsertControl(Control, InsertAt, DropCtl);
end;
end
else
if Control is TJvDockConjoinHostForm then
begin
TWinControlAccessProtected(TJvDockableForm(Control).DockableControl).DockManager.ResetBounds(True);
InsertControlFromConjoinHost(Control, InsertAt, DropCtl);
end
else
inherited InsertControl(Control, InsertAt, DropCtl);
end
else
begin
if InsertAt in [alLeft, alTop] then
DropDockSize := DropDockSize + SplitterWidth div 2;
if InsertAt in [alClient] then
begin
if DropCtl is TJvDockTabHostForm then
Control.ManualDock(TJvDockTabHostForm(DropCtl).PageControl, nil, alClient)
else
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -