Ignore:
Timestamp:
Sep 16, 2010, 2:15:02 PM (14 years ago)
Author:
george
Message:
  • Přidáno: Částečná implementace umělého ukotvovacího okna.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • DockManager/Lazarus/UCustomDockManager.pas

    r43 r44  
    1717  TCustomDockManager = class;
    1818
     19  { TConjoinDockForm }
     20
    1921  TConjoinDockForm = class(TForm)
    20 
     22    Panel: TPanel;
     23    constructor Create(TheOwner: TComponent); override;
    2124  end;
    2225
     
    130133  NewPanel: TDockClientPanel;
    131134  I: Integer;
    132 begin
    133   if FDockSite.DockClientCount = 2 then begin
    134     if (InsertAt = alTop) or (InsertAt = alBottom) then
    135       FDockDirection := ddVertical
    136     else
    137     if (InsertAt = alLeft) or (InsertAt = alRight) then
    138       FDockDirection := ddHorizontal
    139     else FDockDirection := ddHorizontal;
    140   end;
    141   if FDockSite.DockClientCount > 1 then begin
    142     NewSplitter := TSplitter.Create(nil);
    143     NewSplitter.Parent := FDockSite;
    144     NewSplitter.Visible := True;
    145     NewSplitter.Color := clRed;
    146     with NewSplitter do
    147     if FDockDirection = ddVertical then begin
    148       Align := alTop;
    149       Top := FDockSite.Height;
    150     end else
    151     if FDockDirection = ddHorizontal then begin
    152       Align := alLeft;
    153       Left := FDockSite.Width;
    154     end;
    155 
    156     with TDockClientPanel(FDockPanels.Last) do
    157     if FDockDirection = ddVertical then
    158       Align := alTop
    159     else
    160     if FDockDirection = ddHorizontal then
    161       Align := alLeft;
    162   end;
    163   NewPanel := TDockClientPanel.Create(nil);
    164   with NewPanel do begin
    165     Splitter := NewSplitter;
    166     Parent := FDockSite;
    167     OwnerDockManager := Self;
    168     Visible := True;
    169     Align := alClient;
    170   end;
    171   NewPanel.Control := Control;
    172   Control.Parent := NewPanel;
    173   FDockPanels.Add(NewPanel);
    174 
    175   for I := 0 to FDockPanels.Count - 1 do begin
    176     TDockClientPanel(FDockPanels[I]).Height := FDockSite.Height div
    177       FDockSite.DockClientCount;
    178     TDockClientPanel(FDockPanels[I]).Width := FDockSite.Width div
    179       FDockSite.DockClientCount;
     135  NewConjoinDockForm: TConjoinDockForm;
     136begin
     137  if (FDockSite is TForm) and (not Assigned(FDockSite.Parent)) then begin
     138    NewConjoinDockForm := TConjoinDockForm.Create(nil);
     139    NewConjoinDockForm.Visible := True;
     140    Control.ManualDock(NewConjoinDockForm.Panel);
     141    FDockSite.ManualDock(NewConjoinDockForm.Panel);
     142  end else
     143  if FDockSite is TPanel then begin
     144    if FDockSite.DockClientCount = 2 then begin
     145      if (InsertAt = alTop) or (InsertAt = alBottom) then
     146        FDockDirection := ddVertical
     147      else
     148      if (InsertAt = alLeft) or (InsertAt = alRight) then
     149        FDockDirection := ddHorizontal
     150      else FDockDirection := ddHorizontal;
     151    end;
     152    if FDockSite.DockClientCount > 1 then begin
     153      NewSplitter := TSplitter.Create(nil);
     154      NewSplitter.Parent := FDockSite;
     155      NewSplitter.Visible := True;
     156      NewSplitter.Color := clRed;
     157      with NewSplitter do
     158      if FDockDirection = ddVertical then begin
     159        Align := alTop;
     160        Top := FDockSite.Height;
     161      end else
     162      if FDockDirection = ddHorizontal then begin
     163        Align := alLeft;
     164        Left := FDockSite.Width;
     165      end;
     166
     167      with TDockClientPanel(FDockPanels.Last) do
     168      if FDockDirection = ddVertical then
     169        Align := alTop
     170      else
     171      if FDockDirection = ddHorizontal then
     172        Align := alLeft;
     173    end;
     174    NewPanel := TDockClientPanel.Create(nil);
     175    with NewPanel do begin
     176      Splitter := NewSplitter;
     177      Parent := FDockSite;
     178      OwnerDockManager := Self;
     179      Visible := True;
     180      Align := alClient;
     181    end;
     182    NewPanel.Control := Control;
     183    Control.Parent := NewPanel;
     184    FDockPanels.Add(NewPanel);
     185
     186    for I := 0 to FDockPanels.Count - 1 do begin
     187      TDockClientPanel(FDockPanels[I]).Height := FDockSite.Height div
     188        FDockSite.DockClientCount;
     189      TDockClientPanel(FDockPanels[I]).Width := FDockSite.Width div
     190        FDockSite.DockClientCount;
     191    end;
    180192  end;
    181193
     
    243255  if Control.HostDockSite = Self.FDockSite then begin
    244256    ClientPanel := FindControlInPanels(Control);
    245     //ClientPanel.Splitter.Free;
     257    //if Assigned(ClientPanel) then ClientPanel.Splitter.Free;
    246258    FDockPanels.Remove(ClientPanel);
    247259    if FDockSite.DockClientCount = 2 then FDockDirection := ddNone;
     
    350362end;
    351363
     364{ TConjoinDockForm }
     365
     366constructor TConjoinDockForm.Create(TheOwner: TComponent);
     367begin
     368  inherited Create(TheOwner);
     369  Panel := TPanel.Create(Self);
     370  with Panel do begin
     371    Parent := Self;
     372    DockSite := True;
     373    UseDockManager := True;
     374    Align := alClient;
     375  end;
     376  DragKind := dkDock;
     377  DragMode := dmAutomatic;
     378end;
     379
    352380initialization
    353381  DefaultDockManagerClass := TCustomDockManager;
Note: See TracChangeset for help on using the changeset viewer.