Ignore:
Timestamp:
Mar 10, 2011, 7:55:48 AM (14 years ago)
Author:
george
Message:
  • Fixed: Insertion in regions on left and top side.
  • Added: If inserted control side is defferent than already placed controls then create conjoined subform.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Docking/CoolDocking/UCoolDocking.pas

    r182 r183  
    1919
    2020type
    21   TDockDirection = (ddNone, ddHorizontal, ddVertical);
    22 
    2321  TCoolDockManager = class;
    2422  TCoolDockClient = class;
     
    5452    FMaster: TCoolDockMaster;
    5553    FDockStyle: TDockStyle;
    56     FDockDirection: TDockDirection;
    5754    FDockSite: TWinControl;
    5855    FDockPanels: TCoolDockPanels;
     
    104101    property HeaderPos: THeaderPos read GetHeaderPos write SetHeaderPos;
    105102    property Visible: Boolean write SetVisible;
    106     property DockDirection: TDockDirection read FDockDirection
    107       write FDockDirection;
    108103  end;
    109104
     
    277272procedure TCoolDockManager.InsertControlPanel(Control: TControl; InsertAt: TAlign;
    278273  DropCtl: TControl);
    279 var
    280   NewPanel: TCoolDockClientPanel;
    281   I: Integer;
    282 begin
    283     if FDockSite.DockClientCount = 2 then begin
    284       if (InsertAt = alTop) or (InsertAt = alBottom) then
    285         FDockDirection := ddVertical
    286       else
    287       if (InsertAt = alLeft) or (InsertAt = alRight) then
    288         FDockDirection := ddHorizontal
    289       else FDockDirection := ddHorizontal;
    290     end;// else FDockSite.DockClientCount > 2 then begin
    291 
    292     //end;
    293     if FDockSite.DockClientCount > 1 then begin
    294       with TCoolDockClientPanel(FDockPanels.Last).Splitter do begin
    295         Parent := FDockSite;
    296         Visible := (DockStyle = dsList);
    297         if FDockDirection = ddVertical then begin
    298           Align := alTop;
    299           Top := FDockSite.Height;
    300         end else
    301         if FDockDirection = ddHorizontal then begin
    302           Align := alLeft;
    303           Left := FDockSite.Width;
    304         end;
    305       end;
    306 
    307       with TCoolDockClientPanel(FDockPanels.Last) do
    308       if FDockDirection = ddVertical then
    309         Align := alTop
    310       else
    311       if FDockDirection = ddHorizontal then
    312         Align := alLeft;
    313     end;
    314     NewPanel := TCoolDockClientPanel.Create(nil);
    315     with NewPanel do begin
    316       Parent := FDockSite;
    317       OwnerDockManager := Self;
    318       if DockStyle = dsList then Visible := True;
    319       Align := alClient;
    320       Header.PopupMenu := Self.PopupMenu;
    321       //PopupMenu.Parent := Self.DockSite;
    322     end;
    323     if (Control is TForm) and Assigned((Control as TForm).Icon) then
    324       NewPanel.Header.Icon.Picture.Assign((Control as TForm).Icon);
    325 
    326     DockStyleHandler.InsertControl(NewPanel, Control, InsertAt);
    327 
    328     NewPanel.Control := Control;
    329     Control.AddHandlerOnVisibleChanged(NewPanel.VisibleChange);
    330     Control.Parent := NewPanel.ClientAreaPanel;
    331     Control.Align := alClient;
    332     if (InsertAt = alTop) or (InsertAt = alLeft) then
    333       FDockPanels.Insert(0, NewPanel)
    334       else FDockPanels.Add(NewPanel);
    335     UpdateClientSize;
     274begin
     275  DockStyleHandler.InsertControl(Control, InsertAt);
    336276end;
    337277
     
    433373    //Control.RemoveHandlerOnVisibleChanged(ClientPanel.VisibleChange);
    434374    FDockPanels.Remove(ClientPanel);
    435     if FDockSite.DockClientCount = 2 then FDockDirection := ddNone;
     375    DockStyleHandler.RemoveControl(Control);
    436376    UpdateClientSize;
    437377    //FDockSite.Invalidate;
Note: See TracChangeset for help on using the changeset viewer.