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/UCoolDockStyleTabs.pas

    r182 r183  
    2525    procedure TabControlMouseUp(Sender: TObject; Button: TMouseButton;
    2626      Shift: TShiftState; X, Y: Integer);
    27     procedure InsertControl(NewPanel: TCoolDockClientPanel;
    28       AControl: TControl; InsertAt: TAlign); override;
     27    procedure InsertControl(AControl: TControl; InsertAt: TAlign); override;
    2928    procedure UpdateClientSize; override;
    3029  private
    3130    FTabsPos: THeaderPos;
    32     procedure InsertControlNoUpdate(NewPanel: TCoolDockClientPanel;
    33       AControl: TControl; InsertAt: TAlign);
     31    procedure InsertControlNoUpdate(AControl: TControl; InsertAt: TAlign);
     32    procedure RemoveControl(Control: TControl); override;
    3433  public
    3534    constructor Create(AManager: TCoolDockManagerBase);
     
    162161    MultiLine := True;
    163162    PopupMenu := TCoolDockManager(Manager).PopupMenu;
     163    OnMouseLeave := TabControlMouseLeave;
     164    OnMouseDown := TabControlMouseDown;
    164165    //TTabControlNoteBookStrings(Tabs).NoteBook.OnMouseLeave := TabControlMouseLeave;
    165166    //TTabControlNoteBookStrings(Tabs).NoteBook.OnMouseDown := TabControlMouseDown;
     
    175176  with TCoolDockManager(Manager) do
    176177  for I := 0 to DockPanels.Count - 1 do
    177     Self.InsertControlNoUpdate(TCoolDockClientPanel(DockPanels[I]),
    178       TCoolDockClientPanel(DockPanels[I]).Control, alNone);
     178    Self.InsertControlNoUpdate(TCoolDockClientPanel(DockPanels[I]).Control, alNone);
    179179  TabControlChange(Self);
    180180end;
     
    193193end;
    194194
    195 procedure TCoolDockStyleTabs.InsertControlNoUpdate(NewPanel: TCoolDockClientPanel;
    196   AControl: TControl; InsertAt: TAlign);
     195procedure TCoolDockStyleTabs.InsertControlNoUpdate(AControl: TControl; InsertAt: TAlign);
    197196var
    198197  NewTabSheet: TTabSheet;
     198  NewPanel: TCoolDockClientPanel;
    199199begin
    200200  inherited;
     201  with TCoolDockManager(Manager) do begin
     202    NewPanel := TCoolDockClientPanel.Create(nil);
     203    with NewPanel do begin
     204      Parent := TCoolDockManager(Manager).DockSite;
     205      OwnerDockManager := Self;
     206      if DockStyle = dsList then Visible := True;
     207      Align := alClient;
     208      Header.PopupMenu := TCoolDockManager(Manager).PopupMenu;
     209      //PopupMenu.Parent := Self.DockSite;
     210    end;
     211    if (AControl is TForm) and Assigned((AControl as TForm).Icon) then
     212      NewPanel.Header.Icon.Picture.Assign((AControl as TForm).Icon);
     213
     214    NewPanel.Control := AControl;
     215    AControl.AddHandlerOnVisibleChanged(NewPanel.VisibleChange);
     216    AControl.Parent := NewPanel.ClientAreaPanel;
     217    AControl.Align := alClient;
     218    if (InsertAt = alTop) or (InsertAt = alLeft) then
     219      DockPanels.Insert(0, NewPanel)
     220      else DockPanels.Add(NewPanel);
     221
     222  end;
     223
    201224  if AControl.Visible then begin
    202225    NewTabSheet := TTabSheet.Create(PageControl);
     
    213236end;
    214237
    215 procedure TCoolDockStyleTabs.InsertControl(NewPanel: TCoolDockClientPanel;
    216   AControl: TControl; InsertAt: TAlign);
     238procedure TCoolDockStyleTabs.RemoveControl(Control: TControl);
     239begin
     240  inherited RemoveControl(Control);
     241end;
     242
     243procedure TCoolDockStyleTabs.InsertControl(AControl: TControl; InsertAt: TAlign);
    217244var
    218245  NewTabSheet: TTabSheet;
    219246begin
    220247  inherited;
    221   InsertControlNoUpdate(NewPanel, AControl, InsertAt);
     248  InsertControlNoUpdate(AControl, InsertAt);
    222249  TabControlChange(Self);
    223250end;
Note: See TracChangeset for help on using the changeset viewer.