Ignore:
Timestamp:
Mar 11, 2011, 2:16:50 PM (14 years ago)
Author:
george
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Docking/CoolDocking/Managers/UCDManagerTabs.pas

    r194 r195  
    1111
    1212type
    13   TCDManagerTabsITem = class(TCDManagerItem)
    14 
     13
     14  { TCDManagerTabsItem }
     15
     16  TCDManagerTabsItem = class(TCDManagerItem)
     17    Icon: TImage;
     18    constructor Create;
     19    destructor Destroy; override;
    1520  end;
    1621
     
    3742    FTabsPos: THeaderPos;
    3843    function FindControlInPanels(Control: TControl): TCDManagerItem; override;
    39     procedure InsertControlNoUpdate(AControl: TControl; InsertAt: TAlign);
     44    procedure InsertControlNoUpdate(Control: TControl; InsertAt: TAlign);
    4045    procedure RemoveControl(Control: TControl); override;
    4146  public
     
    5762  UCDClient;
    5863
     64{ TCDManagerTabsItem }
     65
     66constructor TCDManagerTabsItem.Create;
     67begin
     68  Icon := TImage.Create(nil);
     69end;
     70
     71destructor TCDManagerTabsItem.Destroy;
     72begin
     73  Icon.Free;
     74  inherited Destroy;
     75end;
     76
    5977{ TCDManagerTabs }
    6078
     
    91109  I: Integer;
    92110begin
    93   // Hide all clients
     111  UpdateClientSize;
     112{  // Hide all clients
    94113  for I := 0 to DockItems.Count - 1 do
    95114    if TCDManagerItem(DockItems[I]).Control.Visible
     
    137156  //TCDClientPanel(FDockPanels[TabControl.TabIndex]).Visible := True;
    138157  end;
    139   MouseDownSkip := True;
     158  MouseDownSkip := True;        }
    140159end;
    141160
     
    175194    Parent := ADockSite;
    176195    Name := Self.DockSite.Name + 'TabControl';
    177     Visible := False;
    178     Align := alTop;
     196    Visible := True;
     197    //Align := alTop;
    179198    //Height := 24;
    180199    Align := alClient;
     
    193212  //MoveDuration := 1000; // ms
    194213
    195   PageControl.Visible := True;
     214  //PageControl.Visible := True;
    196215  //TabImageList.Clear;
    197   for I := 0 to DockItems.Count - 1 do
    198     Self.InsertControlNoUpdate(TCDManagerItem(DockItems[I]).Control, alNone);
     216  for I := 0 to ADockSite.DockClientCount - 1 do
     217    InsertControlNoUpdate(ADockSite.DockClients[I], alNone);
    199218  TabControlChange(Self);
     219  //TCDManagerTabs(Self).TabControlChange(Self);
    200220end;
    201221
     
    221241end;
    222242
    223 procedure TCDManagerTabs.InsertControlNoUpdate(AControl: TControl; InsertAt: TAlign);
     243procedure TCDManagerTabs.InsertControlNoUpdate(Control: TControl; InsertAt: TAlign);
    224244var
    225245  NewTabSheet: TTabSheet;
    226   NewPanel: TCDManagerTabsItem;
     246  NewItem: TCDManagerTabsItem;
    227247begin
    228248  inherited;
    229249  begin
    230     NewPanel := TCDManagerTabsItem.Create;
    231     with NewPanel do begin
     250    NewItem := TCDManagerTabsItem.Create;
     251    with NewItem do begin
    232252      //Panel.Parent := Self.DockSite;
    233253      Manager := Self;
    234       if DockStyle = dsList then Visible := True;
     254      //if DockStyle = dsList then Visible := True;
    235255      //Align := alClient;
    236       Header.PopupMenu := Self.PopupMenu;
     256      //Header.PopupMenu := Self.PopupMenu;
    237257      //PopupMenu.Parent := Self.DockSite;
    238258    end;
    239     if (AControl is TForm) and Assigned((AControl as TForm).Icon) then
    240       NewPanel.Header.Icon.Picture.Assign((AControl as TForm).Icon);
    241 
    242     NewPanel.Control := AControl;
    243     AControl.AddHandlerOnVisibleChanged(NewPanel.VisibleChange);
    244     //AControl.Parent := NewPanel.ClientAreaPanel;
    245     AControl.Align := alClient;
     259    if (Control is TForm) and Assigned((Control as TForm).Icon) then
     260      NewItem.Icon.Picture.Assign((Control as TForm).Icon);
     261
     262    NewItem.Control := Control;
     263    Control.AddHandlerOnVisibleChanged(NewItem.VisibleChange);
     264    //AControl.Parent := NewItem.ClientAreaPanel;
     265    Control.Align := alClient;
    246266    if (InsertAt = alTop) or (InsertAt = alLeft) then
    247       DockItems.Insert(0, NewPanel)
    248       else DockItems.Add(NewPanel);
    249 
    250   end;
    251 
    252   if AControl.Visible then begin
     267      DockItems.Insert(0, NewItem)
     268      else DockItems.Add(NewItem);
     269
     270  end;
     271
    253272    NewTabSheet := TTabSheet.Create(PageControl);
    254273    NewTabSheet.PageControl := PageControl;
    255     NewTabSheet.Caption := AControl.Caption;
     274    NewTabSheet.Caption := Control.Caption;
    256275    NewTabSheet.ImageIndex := TabImageList.Count;
    257     TabImageList.Add(NewPanel.Header.Icon.Picture.Bitmap, nil);
    258 //    if Assigned(NewPanel.Splitter) then
    259 //      NewPanel.Splitter.Visible := False;
    260 //    NewPanel.ClientAreaPanel.Visible := False;
    261 //    NewPanel.Visible := False;
    262     //NewPanel.Parent := NewTabSheet;
    263   end;
     276    NewTabSheet.TabVisible := Control.Visible;
     277    Control.Parent := NewTabSheet;
     278    TabImageList.Add(NewItem.Icon.Picture.Bitmap, nil);
     279//    if Assigned(NewItem.Splitter) then
     280//      NewItem.Splitter.Visible := False;
     281//    NewItem.ClientAreaPanel.Visible := False;
     282//    NewItem.Visible := False;
     283    //NewItem.Parent := NewTabSheet;
    264284end;
    265285
     
    282302var
    283303  I: Integer;
     304  NewTabSheet: TTabSheet;
    284305begin
    285306  inherited UpdateClientSize;
    286   for I := 0 to DockItems.Count - 1 do begin
     307  for I := 0 to DockItems.Count - 1 do
     308  with TCDManagerTabsItem(DockItems[I]) do begin
     309    Control.Parent := PageControl.Pages[I];
     310    Control.Align := alClient;
     311
    287312    //TCDClientPanel(DockPanels[I]).ClientAreaPanel.Width := DockSite.Width;
    288313    //TCDClientPanel(DockPanels[I]).ClientAreaPanel.Height := DockSite.Height - PageControl.Height;
Note: See TracChangeset for help on using the changeset viewer.