⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jvdockvidstyle.pas

📁 East make Tray Icon in delphi
💻 PAS
📖 第 1 页 / 共 5 页
字号:
              end;
              Host.Visible := True;
            end;
          end;
        end
        else
        if DockType <> alNone then
        begin
          Host := CreateConjoinHostAndDockControl(ParentForm, Source.Control, DockType);
          SetDockSite(ParentForm, False);
          SetDockSite(TWinControl(Source.Control), False);
          Host.Visible := True;
        end;

        if Host <> nil then
        begin
          Host.LRDockWidth := Source.Control.LRDockWidth;
          Host.TBDockHeight := Source.Control.TBDockHeight;
        end;
      end;
    finally
      if not JvGlobalDockIsLoading then
        JvDockUnLockWindow;
    end;
  end;
end;

procedure TJvDockVIDStyle.SetDockBaseControl(IsCreate: Boolean;
  DockBaseControl: TJvDockBaseControl);
var
  ADockClient: TJvDockClient;
begin
  if DockBaseControl is TJvDockClient then
  begin
    ADockClient := TJvDockClient(DockBaseControl);
    if IsCreate then
      ADockClient.DirectDrag := False;
  end;
end;

procedure TJvDockVIDStyle.FormStartDock(DockClient: TJvDockClient;
  var Source: TJvDockDragDockObject);
begin
  inherited FormStartDock(DockClient, Source);
  Source := TJvDockVIDDragDockObject.Create(DockClient.ParentForm);
//  Source.DockClient := DockClient; {allows DockClient.OnCheckIsDockable event to fire once before docking, to block or allow drag/drop to this site. }
end;

procedure TJvDockVIDStyle.FormGetDockEdge(DockClient: TJvDockClient;
  Source: TJvDockDragDockObject; MousePos: TPoint; var DropAlign: TAlign);
var
  ARect: TRect;
begin
  DropAlign := ComputeVIDDockingRect(DockClient.ParentForm, Source.Control, ARect, MousePos);
end;

function TJvDockVIDStyle.DockClientWindowProc(DockClient: TJvDockClient;
  var Msg: TMessage): Boolean;
begin
  Result := inherited DockClientWindowProc(DockClient, Msg);
end;



procedure TJvDockVIDStyle.CreateConjoinServerOption(
  var Option: TJvDockBasicConjoinServerOption);
begin
  Option := TJvDockVIDConjoinServerOption.Create(Self);
end;

procedure TJvDockVIDStyle.CreateTabServerOption(var Option: TJvDockBasicTabServerOption);
begin
  Option := TJvDockVIDTabServerOption.Create(Self);
end;

procedure TJvDockVIDStyle.AssignConjoinServerOption(APanel: TJvDockCustomPanel);
begin
  inherited AssignConjoinServerOption(APanel);
end;

procedure TJvDockVIDStyle.AssignTabServerOption(APage: TJvDockTabPageControl);
var
  TmpPage: TJvDockVIDTabPageControl;
  TmpOption: TJvDockVIDTabServerOption;
begin
  inherited AssignTabServerOption(APage);
  if (APage is TJvDockVIDTabPageControl) and (TabServerOption is TJvDockVIDTabServerOption) then
  begin
    TmpPage := APage as TJvDockVIDTabPageControl;
    TmpOption := TabServerOption as TJvDockVIDTabServerOption;
    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 TJvDockVIDStyle.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 TJvDockVIDConjoinServerOption then
      if TJvDockVIDConjoinServerOption(ConjoinServerOption).SystemInfo then
        TJvDockVIDConjoinServerOption(ConjoinServerOption).SetDefaultSystemCaptionInfo;
  end;
end;

procedure TJvDockVIDStyle.DoSystemInfoChange(Value: Boolean);
begin
  if Assigned(FSystemInfoChange) then
    FSystemInfoChange(Value);
end;

//=== { TJvDockVIDPanel } ====================================================

function TJvDockVIDPanel.CreateDockManager: IDockManager;
var
  Option: TJvDockVIDConjoinServerOption;
begin
  Result := inherited CreateDockManager;
  if (DockServer <> nil) and (Result <> nil) then
  begin
    Option := TJvDockVIDConjoinServerOption(DockServer.DockStyle.ConjoinServerOption);

    // This should already have happened, but when update when creating a new
    // panel, just in case
    if (Option.GrabbersSize>0) then
        (Result as IJvDockManager).GrabberSize := Option.GrabbersSize;
  end;
end;

procedure TJvDockVIDPanel.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 TJvDockVIDPanel.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 TJvDockVIDDragDockObject) then
    if State = dsDragMove then
    begin
      DropAlign := Source.DropAlign;
      JvDockManager.GetDockEdge(Source.DockRect, Source.DragPos, DropAlign, Source.Control);
    end;
end;

procedure TJvDockVIDPanel.CustomGetDockEdge(Source: TJvDockDragDockObject;
  MousePos: TPoint; var DropAlign: TAlign);
begin
end;

procedure TJvDockVIDPanel.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 TJvDockVIDPanel.CustomStartDock(var Source: TJvDockDragDockObject);
begin
  Source := TJvDockVIDDragDockObject.Create(Self);
end;

procedure TJvDockVIDPanel.DockDrop(Source: TDragDockObject; X, Y: Integer);
begin
  inherited DockDrop(Source, X, Y);
end;

procedure TJvDockVIDPanel.UpdateCaption(Exclude: TControl);
begin
  inherited UpdateCaption(Exclude);
  Invalidate;
end;

//=== { TJvDockVIDTree } =====================================================

constructor TJvDockVIDTree.Create(DockSite: TWinControl;
  DockZoneClass: TJvDockZoneClass;ADockStyle: TComponent);
begin
  inherited Create(DockSite, DockZoneClass, ADockStyle);
  FDropOnZone := nil;

  { BASE CLASS TJvDockTree DOES THIS ALREADY:
  if Assigned(ADockStyle) then
    GrabberSize := TJvDockBasicStyle(ADockStyle).GrabberSize;
  }
  if GrabberSize <= 0 then
    GrabberSize := 18;

  ButtonHeight := 11;
  ButtonWidth := 13;
  LeftOffset := 4;
  RightOffset := 4;
  TopOffset := 4;
  BottomOffset := 3;
  ButtonSplitter := 2;
  BorderWidth := 0;
  MinSize := 20;
  CaptionLeftOffset := 0;
  CaptionRightOffset := 0;
  if DockSite is TJvDockVIDPanel then
  begin {NEW!}
    FParent := TJvDockVIDPanel(DockSite);
    // Assert(not Assigned(TJvDockVIDPanel(DockSite).FADVTree));
    // TJvDockVIDPanel(DockSite).FADVTree := TJvDockAdvTree(Self);
  end
  else
    FParent := nil;
end;

function TJvDockVIDTree.GetDockGrabbersPosition: TJvDockGrabbersPosition;
begin
  Result := gpTop;
end;

function TJvDockVIDTree.GetTopGrabbersHTFlag(const MousePos: TPoint;
  out HTFlag: Integer; Zone: TJvDockZone): TJvDockZone;
begin
  if (MousePos.Y >= Zone.Top) and (MousePos.Y <= Zone.Top + GrabberSize) and
    (MousePos.X >= Zone.Left) and (MousePos.X <= Zone.Left + Zone.Width) then
  begin
    Result := Zone;
    with Zone.ChildControl do
    begin
      if PtInRect(Rect(
        Left + Width - ButtonWidth - RightOffset,
        Top - GrabberSize + TopOffset,
        Left + Width - RightOffset,
        Top - GrabberSize + TopOffset + ButtonHeight), MousePos) then
        HTFlag := HTCLOSE
      else
        HTFlag := HTCAPTION;
    end;
  end
  else
    Result := nil;
end;

procedure TJvDockVIDTree.InsertControl(Control: TControl; InsertAt: TAlign;
  DropCtl: TControl);
var
  I: Integer;
  Host: TJvDockTabHostForm;
  ChildCount: Integer;
  VIDSource: TJvDockVIDDragDockObject;
  TempControl: TControl;
  ARect: TRect;
  AZone: TJvDockZone;

  function CreateDockPageControl(Client: TControl): TJvDockTabHostForm;
  var
    Zone: TJvDockZone;
    TempCtl: TControl;
    TempPanel: TJvDockConjoinPanel;
    DockClient: TJvDockClient;
    APoint: TPoint;
  begin
    {$IFDEF JVDOCK_DEBUG}
    OutputDebugString('TJvDockVIDTree.InsertControl.CreateDockPageControl');
    {$ENDIF JVDOCK_DEBUG}
    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;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -