Ignore:
Timestamp:
Mar 11, 2011, 10:07:38 AM (14 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/UCDStyleRegions.pas

    r189 r191  
    66
    77uses
    8   Classes, SysUtils, Controls, ExtCtrls, StdCtrls, UCDStyle, Forms,
    9   Graphics, Contnrs, Buttons, UCDClientPanel, UCDCommon;
     8  Classes, SysUtils, Controls, ExtCtrls, StdCtrls, Forms,
     9  Graphics, Contnrs, Buttons, UCDClientPanel, UCDCommon, UCDManager;
    1010
    1111type
     
    1616  { TCDStyleRegions }
    1717
    18   TCDStyleRegions = class(TCDStyle)
     18  TCDStyleRegions = class(TCDManager)
    1919  private
    2020    function GetDirection(InsertAt: TAlign): TCDDirection;
     
    2222    FDockDirection: TCDDirection;
    2323    //Panels: TObjectList; // TObjectList<TCDStyleRegionsPanel>
    24     procedure InsertControl(AControl: TControl; InsertAt: TAlign); override;
     24    procedure InsertControl(Control: TControl; InsertAt: TAlign;
     25      DropCtl: TControl); override;
    2526    procedure RemoveControl(Control: TControl); override;
    26     function GetHeaderPos: THeaderPos; override;
    27     procedure SetHeaderPos(const AValue: THeaderPos); override;
    2827    constructor Create(AManager: TCDManagerBase);
    2928    destructor Destroy; override;
    3029    procedure UpdateClientSize; override;
    31     procedure SetVisible(const AValue: Boolean); override;
    32     procedure ChangeVisible(Control: TWinControl; Visible: Boolean); override;
     30    procedure DoSetVisible(const AValue: Boolean);
     31    procedure ChangeVisible(Control: TWinControl; Visible: Boolean);
    3332    property DockDirection: TCDDirection read FDockDirection
    3433      write FDockDirection;
     
    3837
    3938uses
    40   UCDClient, UCDConjoinForm, UCDManager;
     39  UCDClient, UCDConjoinForm;
    4140
    4241
     
    5453end;
    5554
    56 procedure TCDStyleRegions.InsertControl(AControl: TControl; InsertAt: TAlign);
     55procedure TCDStyleRegions.InsertControl(Control: TControl; InsertAt: TAlign;
     56  DropCtl: TControl);
    5757var
    5858  NewPanel: TCDClientPanel;
     
    6363begin
    6464  inherited;
    65   with TCDManager(Manager) do begin
     65  begin
    6666    if DockSite.DockClientCount <= 2 then FDockDirection := GetDirection(InsertAt)
    6767    else
     
    7474        // FDockSite.ManualFloat(FDockSite.BoundsRect);
    7575        NewConjoinDockForm.ManualDock(NewDockSite);
    76         AControl.ManualDock(NewConjoinDockForm, nil, InsertAt);
     76        Control.ManualDock(NewConjoinDockForm, nil, InsertAt);
    7777        if DockSite is TForm then
    7878          DockSite.ManualDock(NewConjoinDockForm)
     
    8787    NewPanel := TCDClientPanel.Create(nil);
    8888    with NewPanel do begin
    89       Parent := TCDManager(Manager).DockSite;
    90       OwnerDockManager := Manager;
     89      Parent := Self.DockSite;
     90      OwnerDockManager := Self;
    9191      if DockStyle = dsList then Visible := True;
    92       Header.PopupMenu := TCDManager(Manager).PopupMenu;
     92      Header.PopupMenu := Self.PopupMenu;
    9393      //PopupMenu.Parent := Self.DockSite;
    9494    end;
    95     if (AControl is TForm) and Assigned((AControl as TForm).Icon) then
    96       NewPanel.Header.Icon.Picture.Assign((AControl as TForm).Icon);
    97 
    98     NewPanel.Control := AControl;
    99     AControl.AddHandlerOnVisibleChanged(NewPanel.VisibleChange);
    100     AControl.Parent := NewPanel.ClientAreaPanel;
    101     AControl.Align := alClient;
     95    if (Control is TForm) and Assigned((Control as TForm).Icon) then
     96      NewPanel.Header.Icon.Picture.Assign((Control as TForm).Icon);
     97
     98    NewPanel.Control := Control;
     99    Control.AddHandlerOnVisibleChanged(NewPanel.VisibleChange);
     100    Control.Parent := NewPanel.ClientAreaPanel;
     101    Control.Align := alClient;
    102102    if (InsertAt = alTop) or (InsertAt = alLeft) then
    103103      DockPanels.Insert(0, NewPanel)
     
    112112  ClientCount: Integer;
    113113begin
    114   ClientPanel := TCDManager(Manager).FindControlInPanels(Control);
     114  ClientPanel := FindControlInPanels(Control);
    115115  Control.RemoveHandlerOnVisibleChanged(ClientPanel.VisibleChange);
    116116
    117   TCDManager(Manager).DockPanels.Remove(ClientPanel);
    118   ClientCount := TCDManager(Manager).DockPanels.Count;
     117  DockPanels.Remove(ClientPanel);
     118  ClientCount := DockPanels.Count;
    119119
    120120  //if TCDManager(Manager).DockSite.DockClientCount = 2 then FDockDirection := ddNone;
    121121  if ClientCount = 1 then begin
    122122    // Last removed control => Free parent if it is TCDConjoinForm
    123     if TCDManager(Manager).DockSite is TCDConjoinForm then
    124     with TCDConjoinForm(TCDManager(Manager).DockSite) do begin
     123    if Self.DockSite is TCDConjoinForm then
     124    with TCDConjoinForm(Self.DockSite) do begin
    125125      if Assigned(Parent) then begin
    126         TCDClientPanel(TCDManager(Manager).DockPanels[0]).Control.ManualDock(HostDockSite);
    127       end else TCDClientPanel(TCDManager(Manager).DockPanels[0]).Control.ManualFloat(Rect(Left, Top, Left + Width, Top + Height));
     126        TCDClientPanel(DockPanels[0]).Control.ManualDock(HostDockSite);
     127      end else TCDClientPanel(DockPanels[0]).Control.ManualFloat(Rect(Left, Top, Left + Width, Top + Height));
    128128      ManualFloat(Rect(Left, Top, Left + Width, Top + Height));
    129129      Free;
     
    134134end;
    135135
    136 function TCDStyleRegions.GetHeaderPos: THeaderPos;
    137 begin
    138 //  Result := TCDManager(Manager).;
    139 end;
    140 
    141 procedure TCDStyleRegions.SetHeaderPos(const AValue: THeaderPos);
    142 begin
    143   inherited SetHeaderPos(AValue);
    144 end;
    145 
    146136constructor TCDStyleRegions.Create(AManager: TCDManagerBase);
    147137var
    148138  I: Integer;
    149139begin
    150   inherited;
     140 // inherited;
    151141  //Panels := TObjectList.Create;
    152142
     
    181171  SplitterLeft := 0;
    182172  SplitterTop := 0;
    183   with TCDManager(Manager) do
    184173  for I := 0 to DockPanels.Count - 1 do
    185174  with TCDClientPanel(DockPanels[I]) do begin
    186175    Left := SplitterLeft;
    187176    Top := SplitterTop;
    188     Height := TCDManager(Manager).DockSite.Height div
    189       TCDManager(Manager).DockSite.DockClientCount;
    190     Width := TCDManager(Manager).DockSite.Width div
    191       TCDManager(Manager).DockSite.DockClientCount;
     177    Height := Self.DockSite.Height div
     178      Self.DockSite.DockClientCount;
     179    Width := Self.DockSite.Width div
     180      SElf.DockSite.DockClientCount;
    192181    //TCDClientPanel(FDockPanels[I]).DockPanelPaint(Self);
    193182    if I < (DockPanels.Count - 1) then Align := BaseAlign
     
    198187    Splitter.Left := SplitterLeft;
    199188    Splitter.Top := SplitterTop;
    200     Splitter.Parent := TCDManager(Manager).DockSite;
     189    Splitter.Parent := SElf.DockSite;
    201190    Splitter.Align := BaseAlign;
    202191    Splitter.Visible := I < (DockPanels.Count - 1);
     
    212201end;
    213202
    214 procedure TCDStyleRegions.SetVisible(const AValue: Boolean);
    215 var
    216   I: Integer;
    217 begin
    218   inherited SetVisible(AValue);
    219   with TCDManager(Manager) do
     203procedure TCDStyleRegions.DoSetVisible(const AValue: Boolean);
     204var
     205  I: Integer;
     206begin
     207//  inherited SetVisible(AValue);
    220208  for I := 0 to DockPanels.Count - 1 do
    221209
Note: See TracChangeset for help on using the changeset viewer.