Ignore:
Timestamp:
Mar 11, 2011, 1:00:06 PM (14 years ago)
Author:
george
Message:
  • Removed: UCDClientPanel replaced by TCDManagerItem and it's descendend.
Location:
Docking/CoolDocking/Managers
Files:
4 edited

Legend:

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

    r193 r194  
    77uses
    88  Classes, SysUtils, Controls, ExtCtrls, StdCtrls, Forms,
    9   Graphics, Contnrs, Buttons, UCDClientPanel, UCDCommon, UCDManager;
     9  Graphics, Contnrs, Buttons, UCDCommon, UCDManager,
     10  LCLType, LMessages;
    1011
    1112type
    12   TCDStyleRegionsPanel = class(TPanel)
    13 
     13
     14  { TCDManagerRegionsItem }
     15
     16  TCDManagerRegionsItem = class(TCDManagerItem)
     17    Panel: TPanel;
     18    Splitter: TSplitter;
     19    ClientAreaPanel: TPanel;
     20    constructor Create;
    1421  end;
    1522
     
    1825  TCDManagerRegions = class(TCDManager)
    1926  private
     27    FDockItems: TObjectList; // TList<TCDManagerRegionsItem>
    2028    function GetDirection(InsertAt: TAlign): TCDDirection;
    2129  public
    2230    FDockDirection: TCDDirection;
    2331    //Panels: TObjectList; // TObjectList<TCDStyleRegionsPanel>
     32    function FindControlInPanels(Control: TControl): TCDManagerItem; override;
    2433    procedure InsertControlPanel(Control: TControl; InsertAt: TAlign;
    2534      DropCtl: TControl); override;
     
    2736    constructor Create(ADockSite: TWinControl);
    2837    destructor Destroy; override;
     38    procedure PaintSite(DC: HDC); override;
    2939    procedure UpdateClientSize; override;
    3040    procedure DoSetVisible(const AValue: Boolean); override;
     
    3242    property DockDirection: TCDDirection read FDockDirection
    3343      write FDockDirection;
     44    property DockItems: TObjectList read FDockItems write FDockItems;
    3445  end;
    3546
     
    3849uses
    3950  UCDClient, UCDConjoinForm;
     51
     52{ TCDManagerRegionsItem }
     53
     54constructor TCDManagerRegionsItem.Create;
     55begin
     56  Panel := TPanel.Create(nil);
     57
     58  ClientAreaPanel := TPanel.Create(Panel);
     59  with ClientAreaPanel do begin
     60    Parent := Panel;
     61    Visible := True;
     62    DockSite := True;
     63    UseDockManager := True;
     64    Align := alClient;
     65    BevelInner := bvNone;
     66    BevelOuter := bvNone;
     67    //Color := clGreen;
     68  end;
     69  Splitter := TSplitter.Create(Panel);
     70  with Splitter do begin
     71    Parent := Panel;
     72    //Color := clRed;
     73  end;
     74end;
    4075
    4176
     
    5388end;
    5489
     90function TCDManagerRegions.FindControlInPanels(Control: TControl
     91  ): TCDManagerItem;
     92var
     93  I: Integer;
     94begin
     95  I := 0;
     96  while (I < FDockItems.Count) and
     97    (TCDManagerItem(FDockItems[I]).Control <> Control) do Inc(I);
     98  if I < FDockItems.Count then Result := TCDManagerItem(FDockItems[I])
     99    else Result := nil;
     100end;
     101
    55102procedure TCDManagerRegions.InsertControlPanel(Control: TControl; InsertAt: TAlign;
    56103  DropCtl: TControl);
    57104var
    58   NewPanel: TCDClientPanel;
     105  NewPanel: TCDManagerRegionsItem;
    59106  I: Integer;
    60107  NewDirection: TCDDirection;
     
    85132    end;
    86133
    87     NewPanel := TCDClientPanel.Create(nil);
     134    NewPanel := TCDManagerRegionsItem.Create;
    88135    with NewPanel do begin
    89       Parent := Self.DockSite;
    90       OwnerDockManager := Self;
     136      Panel.Parent := Self.DockSite;
     137      Manager := Self;
    91138      if DockStyle = dsList then Visible := True;
    92139      Header.PopupMenu := Self.PopupMenu;
     
    101148    Control.Align := alClient;
    102149    if (InsertAt = alTop) or (InsertAt = alLeft) then
    103       DockPanels.Insert(0, NewPanel)
    104       else DockPanels.Add(NewPanel);
     150      DockItems.Insert(0, NewPanel)
     151      else DockItems.Add(NewPanel);
    105152  end;
    106153  UpdateClientSize;
     
    109156procedure TCDManagerRegions.RemoveControl(Control: TControl);
    110157var
    111   ClientPanel: TCDClientPanel;
     158  ClientPanel: TCDManagerItem;
    112159  ClientCount: Integer;
    113160begin
     
    115162  Control.RemoveHandlerOnVisibleChanged(ClientPanel.VisibleChange);
    116163
    117   DockPanels.Remove(ClientPanel);
    118   ClientCount := DockPanels.Count;
     164  DockItems.Remove(ClientPanel);
     165  ClientCount := DockItems.Count;
    119166
    120167  //if TCDManager(Manager).DockSite.DockClientCount = 2 then FDockDirection := ddNone;
     
    124171    with TCDConjoinForm(Self.DockSite) do begin
    125172      if Assigned(Parent) then begin
    126         TCDClientPanel(DockPanels[0]).Control.ManualDock(HostDockSite);
    127       end else TCDClientPanel(DockPanels[0]).Control.ManualFloat(Rect(Left, Top, Left + Width, Top + Height));
     173        TCDManagerItem(DockItems[0]).Control.ManualDock(HostDockSite);
     174      end else TCDManagerItem(DockItems[0]).Control.ManualFloat(Rect(Left, Top, Left + Width, Top + Height));
    128175      ManualFloat(Rect(Left, Top, Left + Width, Top + Height));
    129176      Free;
     
    140187  inherited;
    141188  FDockStyle := dsList;
    142   //Panels := TObjectList.Create;
    143 
    144   for I := 0 to DockPanels.Count - 1 do begin
    145     if Assigned(TCDClientPanel(DockPanels[I]).Splitter) then
    146       TCDClientPanel(DockPanels[I]).Splitter.Visible := True;
    147     TCDClientPanel(DockPanels[I]).Visible := True;
    148     TCDClientPanel(DockPanels[I]).ClientAreaPanel.Parent := TCDClientPanel(DockPanels[I]);
    149     TCDClientPanel(DockPanels[I]).ClientAreaPanel.Visible := True;
    150     TCDClientPanel(DockPanels[I]).Control.Visible := True;
     189  FDockItems := TObjectList.Create;
     190
     191  for I := 0 to DockItems.Count - 1 do begin
     192    if Assigned(TCDManagerRegionsItem(DockItems[I]).Splitter) then
     193    with TCDManagerRegionsItem(DockItems[I]) do begin
     194      Splitter.Visible := True;
     195      Panel.Visible := True;
     196      ClientAreaPanel.Parent := TCDManagerRegionsItem(DockItems[I]).Panel;
     197      ClientAreaPanel.Visible := True;
     198      Control.Visible := True;
     199    end;
    151200  end;
    152201end;
     
    154203destructor TCDManagerRegions.Destroy;
    155204begin
    156   //Panels.Free;
     205  FDockItems.Free;
    157206  inherited Destroy;
     207end;
     208
     209procedure TCDManagerRegions.PaintSite(DC: HDC);
     210var
     211  I: Integer;
     212begin
     213  inherited PaintSite(DC);
     214  for I := 0 to FDockItems.Count - 1 do
     215    with TCDManagerRegionsItem(FDockItems[I]) do begin
     216      Panel.Invalidate;
     217    end;
    158218end;
    159219
     
    171231  SplitterLeft := 0;
    172232  SplitterTop := 0;
    173   for I := 0 to DockPanels.Count - 1 do
    174   with TCDClientPanel(DockPanels[I]) do begin
    175     Left := SplitterLeft;
    176     Top := SplitterTop;
    177     Height := Self.DockSite.Height div
     233  for I := 0 to DockItems.Count - 1 do
     234  with TCDManagerRegionsItem(DockItems[I]) do begin
     235    Panel.Left := SplitterLeft;
     236    Panel.Top := SplitterTop;
     237    Panel.Height := Self.DockSite.Height div
    178238      Self.DockSite.DockClientCount;
    179     Width := Self.DockSite.Width div
    180       SElf.DockSite.DockClientCount;
     239    Panel.Width := Self.DockSite.Width div
     240      Self.DockSite.DockClientCount;
    181241    //TCDClientPanel(FDockPanels[I]).DockPanelPaint(Self);
    182     if I < (DockPanels.Count - 1) then Align := BaseAlign
    183       else Align := alClient;
    184 
    185     Inc(SplitterLeft, Width);
    186     Inc(SplitterTop, Height);
     242    if I < (DockItems.Count - 1) then Panel.Align := BaseAlign
     243      else Panel.Align := alClient;
     244
     245    Inc(SplitterLeft, Panel.Width);
     246    Inc(SplitterTop, Panel.Height);
    187247    Splitter.Left := SplitterLeft;
    188248    Splitter.Top := SplitterTop;
    189     Splitter.Parent := SElf.DockSite;
     249    Splitter.Parent := Self.DockSite;
    190250    Splitter.Align := BaseAlign;
    191     Splitter.Visible := I < (DockPanels.Count - 1);
     251    Splitter.Visible := I < (DockItems.Count - 1);
    192252    Inc(SplitterLeft, Splitter.Width);
    193253    Inc(SplitterTop, Splitter.Height);
    194254
    195     DockPanelPaint(Self);
    196     if I < (DockPanels.Count - 1) then begin
    197       if DockDirection = ddHorizontal then Align := alLeft
    198         else Align := alTop;
    199     end else Align := alClient;
     255    Paint(Self);
     256    if I < (DockItems.Count - 1) then begin
     257      if DockDirection = ddHorizontal then Panel.Align := alLeft
     258        else Panel.Align := alTop;
     259    end else Panel.Align := alClient;
    200260  end;
    201261end;
     
    206266begin
    207267  inherited;
    208   for I := 0 to DockPanels.Count - 1 do
     268  for I := 0 to DockItems.Count - 1 do
    209269
    210270        //Show;
    211271        //ShowMessage(IntToStr(Control.Tag));
    212       with TCDClientPanel(DockPanels[I]) do begin
     272      with TCDManagerRegionsItem(DockItems[I]) do begin
    213273        if AValue and (not Control.Visible) and (Control.Tag = Integer(dhtTemporal))  then begin
    214274          Control.Show;
  • Docking/CoolDocking/Managers/UCDManagerRegionsPopup.pas

    r193 r194  
    1010type
    1111
    12   { TCDStylePopupRegions }
     12  { TCDManagerPopupRegionsItem }
    1313
    14   TCDStylePopupRegions = class(TCDManagerRegions)
     14  TCDManagerPopupRegionsItem = class(TCDManagerRegionsItem)
     15  private
     16    FAutoHide: Boolean;
     17    function GetAutoHideEnabled: Boolean;
     18    procedure SetAutoHide(const AValue: Boolean);
     19    procedure SetAutoHideEnabled(const AValue: Boolean);
     20  public
     21    property AutoHideEnabled: Boolean read GetAutoHideEnabled
     22      write SetAutoHideEnabled;
     23  end;
     24
     25  { TCDManagerPopupRegions }
     26
     27  TCDManagerPopupRegions = class(TCDManagerRegions)
    1528    constructor Create(ADockSite: TWinControl);
    1629  end;
     
    2235  UCDClient;
    2336
    24 { TCDStylePopupRegions }
     37{ TCDManagerPopupRegionsItem }
    2538
    26 constructor TCDStylePopupRegions.Create(ADockSite: TWinControl);
     39function TCDManagerPopupRegionsItem.GetAutoHideEnabled: Boolean;
     40begin
     41
     42end;
     43
     44procedure TCDManagerPopupRegionsItem.SetAutoHide(const AValue: Boolean);
     45begin
     46
     47end;
     48
     49procedure TCDManagerPopupRegionsItem.SetAutoHideEnabled(const AValue: Boolean);
     50begin
     51
     52end;
     53
     54{ TCDManagerPopupRegions }
     55
     56constructor TCDManagerPopupRegions.Create(ADockSite: TWinControl);
    2757begin
    2858  inherited;
  • Docking/CoolDocking/Managers/UCDManagerTabs.pas

    r193 r194  
    66
    77uses
    8   Classes, Controls, ExtCtrls, ComCtrls, SysUtils, Dialogs,
    9   Menus, Forms, UCDClientPanel, UCDCommon, UCDManager;
     8  Classes, Controls, ExtCtrls, ComCtrls, SysUtils, Dialogs, Contnrs,
     9  Menus, Forms, UCDCommon, UCDManager,
     10  LCLType, LMessages, Graphics;
    1011
    1112type
     13  TCDManagerTabsITem = class(TCDManagerItem)
     14
     15  end;
    1216
    1317  { TCDManagerTabs }
     
    2024    PageControl: TPageControl;
    2125    TabImageList: TImageList;
     26    FDockItems: TObjectList; // TList<TCDManagerRegionsItem>
    2227    procedure TabControlMouseLeave(Sender: TObject);
    2328    procedure TabControlChange(Sender: TObject);
     
    3136  private
    3237    FTabsPos: THeaderPos;
     38    function FindControlInPanels(Control: TControl): TCDManagerItem; override;
    3339    procedure InsertControlNoUpdate(AControl: TControl; InsertAt: TAlign);
    3440    procedure RemoveControl(Control: TControl); override;
    3541  public
    3642    constructor Create(ADockSite: TWinControl);
     43    destructor Destroy; override;
     44    procedure PaintSite(DC: HDC); override;
    3745    procedure DoSetVisible(const AValue: Boolean); override;
    38     destructor Destroy; override;
    3946    procedure ChangeVisible(Control: TWinControl; Visible: Boolean); override;
    4047    procedure Switch(Index: Integer); override;
     
    4249    procedure PopupMenuTabCloseClick(Sender: TObject);
    4350    property TabsPos: THeaderPos read FTabsPos write SetTabsPos;
     51    property DockItems: TObjectList read FDockItems write FDockItems;
    4452  end;
    4553
     
    5159{ TCDManagerTabs }
    5260
     61function TCDManagerTabs.FindControlInPanels(Control: TControl
     62  ): TCDManagerItem;
     63var
     64  I: Integer;
     65begin
     66  I := 0;
     67  while (I < FDockItems.Count) and
     68    (TCDManagerItem(FDockItems[I]).Control <> Control) do Inc(I);
     69  if I < FDockItems.Count then Result := TCDManagerItem(FDockItems[I])
     70    else Result := nil;
     71end;
     72
    5373procedure TCDManagerTabs.PopupMenuTabCloseClick(Sender: TObject);
    5474begin
    5575  if Assigned(PageControl.ActivePage) then
    56     TCDClientPanel(DockPanels[PageControl.TabIndex]).Control.Hide;
     76    TCDManagerItem(DockItems[PageControl.TabIndex]).Control.Hide;
    5777end;
    5878
     
    6181  if MouseDown then
    6282  if Assigned(PageControl.ActivePage) then begin
    63     TCDClientPanel(DockPanels[PageControl.TabIndex]).ClientAreaPanel.DockSite := False;
    64     DragManager.DragStart(TCDClientPanel(DockPanels[PageControl.TabIndex]).Control, False, 1);
     83    //TCDManagerItem(DockItems[PageControl.TabIndex]).ClientAreaPanel.DockSite := False;
     84    DragManager.DragStart(TCDManagerItem(DockItems[PageControl.TabIndex]).Control, False, 1);
    6585  end;
    6686  MouseDown := False;
     
    7292begin
    7393  // Hide all clients
    74   for I := 0 to DockPanels.Count - 1 do
    75     if TCDClientPanel(DockPanels[I]).Control.Visible
     94  for I := 0 to DockItems.Count - 1 do
     95    if TCDManagerItem(DockItems[I]).Control.Visible
    7696    //and (PageControl.TabIndex <> I)
    7797    then
    7898    begin
    79       TCDClientPanel(DockPanels[I]).Control.Tag := Integer(dhtTemporal);
    80       TCDClientPanel(DockPanels[I]).Control.Hide;
    81       TCDClientPanel(DockPanels[I]).ClientAreaPanel.Hide;
    82       TCDClientPanel(DockPanels[I]).ClientAreaPanel.Parent := PageControl.Pages[I];
     99      TCDManagerItem(DockItems[I]).Control.Tag := Integer(dhtTemporal);
     100      TCDManagerItem(DockItems[I]).Control.Hide;
     101      //TCDClientPanel(DockItems[I]).ClientAreaPanel.Hide;
     102      //TCDClientPanel(DockItems[I]).ClientAreaPanel.Parent := PageControl.Pages[I];
    83103      //TCDClientPanel(DockPanels[I]).ClientAreaPanel.Parent := DockSite;
    84       TCDClientPanel(DockPanels[I]).Control.Align := alClient;
     104      TCDManagerItem(DockItems[I]).Control.Align := alClient;
    85105      //TCDClientPanel(DockPanels[I]).Control.Parent :=
    86106      //  TCDClientPanel(DockPanels[I]).ClientAreaPanel;
    87107      //ShowMessage(TCDClientPanel(DockPanels[I]).Control.ClassName);
    88       Application.ProcessMessages;
     108      //Application.ProcessMessages;
    89109
    90110      // Workaround for "Cannot focus" error
    91       TForm(TCDClientPanel(DockPanels[I]).Control).ActiveControl := nil;
     111      TForm(TCDManagerItem(DockItems[I]).Control).ActiveControl := nil;
    92112    end;
    93113
    94114  // Show selected
    95   if (PageControl.TabIndex <> -1) and (DockPanels.Count > PageControl.TabIndex)
     115  if (PageControl.TabIndex <> -1) and (DockItems.Count > PageControl.TabIndex)
    96116//  and not TCDClientPanel(DockPanels[PageControl.TabIndex]).Control.Visible
    97117  then begin
    98     with TCDClientPanel(DockPanels[PageControl.TabIndex]), ClientAreaPanel do begin
     118    with TCDManagerItem(DockItems[PageControl.TabIndex]) do begin
    99119      Control.Show;
    100120      (*AutoHide.Enable := True;
     
    145165  inherited;
    146166  FDockStyle := dsTabs;
     167  FDockItems := TObjectList.Create;
     168
    147169  TabImageList := TImageList.Create(ADockSite); //FDockSite);
    148170  with TabImageList do begin
     
    173195  PageControl.Visible := True;
    174196  //TabImageList.Clear;
    175   for I := 0 to DockPanels.Count - 1 do
    176     Self.InsertControlNoUpdate(TCDClientPanel(DockPanels[I]).Control, alNone);
     197  for I := 0 to DockItems.Count - 1 do
     198    Self.InsertControlNoUpdate(TCDManagerItem(DockItems[I]).Control, alNone);
    177199  TabControlChange(Self);
    178200end;
     
    180202destructor TCDManagerTabs.Destroy;
    181203begin
     204  FDockItems.Free;
    182205  PageControl.Free;
    183206  TabImageList.Free;
     
    185208end;
    186209
     210procedure TCDManagerTabs.PaintSite(DC: HDC);
     211var
     212  I: Integer;
     213begin
     214  inherited PaintSite(DC);
     215  PageControl.Invalidate;
     216end;
     217
    187218procedure TCDManagerTabs.Switch(Index: Integer);
    188219begin
     
    193224var
    194225  NewTabSheet: TTabSheet;
    195   NewPanel: TCDClientPanel;
     226  NewPanel: TCDManagerTabsItem;
    196227begin
    197228  inherited;
    198229  begin
    199     NewPanel := TCDClientPanel.Create(nil);
     230    NewPanel := TCDManagerTabsItem.Create;
    200231    with NewPanel do begin
    201       Parent := Self.DockSite;
    202       OwnerDockManager := Self;
     232      //Panel.Parent := Self.DockSite;
     233      Manager := Self;
    203234      if DockStyle = dsList then Visible := True;
    204       Align := alClient;
     235      //Align := alClient;
    205236      Header.PopupMenu := Self.PopupMenu;
    206237      //PopupMenu.Parent := Self.DockSite;
     
    211242    NewPanel.Control := AControl;
    212243    AControl.AddHandlerOnVisibleChanged(NewPanel.VisibleChange);
    213     AControl.Parent := NewPanel.ClientAreaPanel;
     244    //AControl.Parent := NewPanel.ClientAreaPanel;
    214245    AControl.Align := alClient;
    215246    if (InsertAt = alTop) or (InsertAt = alLeft) then
    216       DockPanels.Insert(0, NewPanel)
    217       else DockPanels.Add(NewPanel);
     247      DockItems.Insert(0, NewPanel)
     248      else DockItems.Add(NewPanel);
    218249
    219250  end;
     
    225256    NewTabSheet.ImageIndex := TabImageList.Count;
    226257    TabImageList.Add(NewPanel.Header.Icon.Picture.Bitmap, nil);
    227     if Assigned(NewPanel.Splitter) then
    228       NewPanel.Splitter.Visible := False;
    229     NewPanel.ClientAreaPanel.Visible := False;
    230     NewPanel.Visible := False;
     258//    if Assigned(NewPanel.Splitter) then
     259//      NewPanel.Splitter.Visible := False;
     260//    NewPanel.ClientAreaPanel.Visible := False;
     261//    NewPanel.Visible := False;
    231262    //NewPanel.Parent := NewTabSheet;
    232263  end;
     
    253284begin
    254285  inherited UpdateClientSize;
    255   for I := 0 to DockPanels.Count - 1 do begin
     286  for I := 0 to DockItems.Count - 1 do begin
    256287    //TCDClientPanel(DockPanels[I]).ClientAreaPanel.Width := DockSite.Width;
    257288    //TCDClientPanel(DockPanels[I]).ClientAreaPanel.Height := DockSite.Height - PageControl.Height;
     
    263294begin
    264295  inherited;
    265     if (PageControl.TabIndex >= 0) and (PageControl.TabIndex < DockPanels.Count) then
    266       with TCDClientPanel(DockPanels[PageControl.TabIndex]) do begin
     296    if (PageControl.TabIndex >= 0) and (PageControl.TabIndex < DockItems.Count) then
     297      with TCDManagerItem(DockItems[PageControl.TabIndex]) do begin
    267298        //Show;
    268299        //ShowMessage(IntToStr(Control.Tag));
     
    294325        //TabImageList.Delete(PageControl.Tabs.IndexOf(Control.Caption));
    295326
    296         I := DockPanels.IndexOf(FindControlInPanels(Control));
     327        I := DockItems.IndexOf(FindControlInPanels(Control));
    297328        if Control.Tag = Integer(dhtPermanent) then
    298329        if I <> -1 then
     
    308339    begin
    309340//      if Control.Tag = 0 then begin
    310         I := DockPanels.IndexOf(FindControlInPanels(Control));
     341        I := DockItems.IndexOf(FindControlInPanels(Control));
    311342        //if  then
    312343        if I <> -1 then
  • Docking/CoolDocking/Managers/UCDManagerTabsPopup.pas

    r193 r194  
    77uses
    88  Classes, Controls, SysUtils, ComCtrls, ExtCtrls, UCDCommon,
    9   UCDManagerTabs, UCDClientPanel;
     9  UCDManagerTabs;
    1010
    1111type
     
    3838  end;
    3939
     40  { TCDManagerTabsPopupItem }
     41
     42  TCDManagerTabsPopupItem = class
     43    constructor Create;
     44  end;
     45
    4046  { TCDStylePopupTabs }
    4147
    4248  TCDStylePopupTabs = class(TCDManagerTabs)
     49  public
    4350    TabControl: TTabControl;
    4451    TabImageList: TImageList;
     52    AutoHideEnabled: Boolean;
    4553    AutoHide: TCDAutoHide;
    4654    procedure TabControlMouseLeave(Sender: TObject);
     
    6169  UCDClient;
    6270
     71{ TCDManagerTabsPopupItem }
     72
     73constructor TCDManagerTabsPopupItem.Create;
     74begin
     75end;
     76
    6377{ TCDAutoHide }
    6478
Note: See TracChangeset for help on using the changeset viewer.