Ignore:
Timestamp:
Mar 11, 2011, 10:07:38 AM (13 years ago)
Author:
george
Message:
  • Modified: Classes which iherits from TCDStyle changed to inherit from TCDManager. Now all styles will be different dock managers. Field DockStyleHanler of TCDManager removed and DockStyle property changes TCDManager descendends.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Docking/CoolDocking/UCDManager.pas

    r189 r191  
    77uses
    88  Classes, SysUtils, UCDCommon, Controls, Contnrs, UCDClientPanel,
    9   UCDStyle, UCDPopupMenu, LCLType, LMessages, Graphics,
    10   UCDConjoinForm, Menus, StdCtrls, ExtCtrls, Forms,
    11   UCDStyleRegions, UCDStyleTabs, UCDStylePopupRegions,
    12   UCDStylePopupTabs;
     9  UCDPopupMenu, LCLType, LMessages, Graphics,
     10  UCDConjoinForm, Menus, StdCtrls, ExtCtrls, Forms;
    1311
    1412type
     
    2826    FDockPanels: TCDPanels;
    2927    function GetDockSite: TWinControl;
     28    function GetDockStyle: TCDStyleType;
    3029    function GetHeaderPos: THeaderPos;
    3130    function GetMoveDuration: Integer;
     
    3635    procedure SetMoveDuration(const AValue: Integer);
    3736    procedure SetVisible(const AValue: Boolean);
    38     procedure UpdateClientSize;
    3937  public
    40     DockStyleHandler: TCDStyle;
    4138    PopupMenu: TCDPopupMenu;
    4239    constructor Create(ADockSite: TWinControl); override;
    4340    destructor Destroy; override;
     41    procedure UpdateClientSize; virtual;
     42    procedure Switch(Index: Integer); virtual;
     43    procedure ChangeVisible(Control: TWinControl; Visible: Boolean); virtual;
     44    procedure Assign(Source: TCDManager); virtual;
    4445
    4546    // Inherited from TDockManager
     
    6768    function CreateContainer(InsertAt: TAlign): TCDConjoinForm;
    6869    property DockPanels: TCDPanels read FDockPanels write FDockPanels;
    69     property DockStyle: TCDStyleType read FDockStyle write SetDockStyle;
     70    property DockStyle: TCDStyleType read GetDockStyle write SetDockStyle;
    7071    property MoveDuration: Integer read GetMoveDuration write SetMoveDuration;
    7172    property DockSite: TWinControl read GetDockSite;
     
    7677
    7778implementation
     79
     80uses
     81  UCDStyleRegions, UCDStyleTabs, UCDStylePopupRegions, UCDStylePopupTabs;
    7882
    7983{ TCDManager }
     
    96100end;
    97101
     102function TCDManager.GetDockStyle: TCDStyleType;
     103begin
     104  if Self is TCDStyleRegions then Result := dsList
     105  else if Self is TCDStyleTabs then Result := dsTabs
     106  else if Self is TCDStylePopupRegions then Result := dsPopupList
     107  else if Self is TCDStylePopupTabs then Result := dsPopupTabs;
     108end;
     109
    98110function TCDManager.GetHeaderPos: THeaderPos;
    99111begin
     
    124136begin
    125137  PopupMenu.Free;
    126   DockStyleHandler.Free;
    127138  FDockPanels.Free;
    128139  inherited Destroy;
     
    157168  DropCtl: TControl);
    158169begin
    159   DockStyleHandler.InsertControl(Control, InsertAt);
     170  //DockStyleHandler.InsertControl(Control, InsertAt);
    160171end;
    161172
     
    250261  ClientPanel: TCDClientPanel;
    251262begin
    252   DockStyleHandler.RemoveControl(Control);
     263  //DockStyleHandler.RemoveControl(Control);
    253264  //inherited;
    254265(*  if Control.HostDockSite = Self.FDockSite then begin
     
    309320var
    310321  I: Integer;
     322  NewManager: TCDManager;
    311323begin
    312324  if FDockStyle <> AValue then begin
    313325    FDockStyle := AValue;
    314     FreeAndNil(DockStyleHandler);
    315326    if AValue = dsTabs then begin
    316       DockStyleHandler := TCDStyleTabs.Create(Self);
    317       TCDStyleTabs(DockStyleHandler).TabControlChange(Self);
     327      NewManager := TCDStyleTabs.Create(Self);
     328      TCDStyleTabs(Self).TabControlChange(Self);
    318329    end else
    319330    if AValue = dsList then begin
    320       DockStyleHandler := TCDStyleRegions.Create(Self);
     331      NewManager := TCDStyleRegions.Create(Self);
    321332    end else
    322333    if AValue = dsPopupList then begin
    323       DockStyleHandler := TCDStylePopupRegions.Create(Self);
     334      NewManager := TCDStylePopupRegions.Create(Self);
    324335    end else
    325336    if AValue = dsPopupTabs then begin
    326       DockStyleHandler := TCDStylePopupTabs.Create(Self);
    327     end;
     337      NewManager := TCDStylePopupTabs.Create(Self);
     338    end;
     339    if DockSite.DockManager is TCDManager then
     340      NewManager.Assign(TCDManager(DockSite.DockManager));
     341    DockSite.DockManager := NewManager;
    328342  end;
    329343  UpdateClientSize;
     
    343357  I: Integer;
    344358begin
    345   DockStyleHandler.Visible := AValue;
     359  Visible := AValue;
    346360//  for I := 0 to DockPanels.Count - 1 do
    347361//    TCDClientPanel(DockPanels[I]).Visible := AValue;
     
    350364procedure TCDManager.UpdateClientSize;
    351365begin
    352   DockStyleHandler.UpdateClientSize;
     366//  DockStyleHandler.UpdateClientSize;
     367end;
     368
     369procedure TCDManager.Switch(Index: Integer);
     370begin
     371
     372end;
     373
     374procedure TCDManager.ChangeVisible(Control: TWinControl; Visible: Boolean);
     375begin
     376
     377end;
     378
     379procedure TCDManager.Assign(Source: TCDManager);
     380begin
     381  FDockStyle := Source.FDockStyle;
     382  FDockSite := Source.FDockSite;
    353383end;
    354384
Note: See TracChangeset for help on using the changeset viewer.