Changeset 191 for Docking/CoolDocking/UCDStyleRegions.pas
- Timestamp:
- Mar 11, 2011, 10:07:38 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Docking/CoolDocking/UCDStyleRegions.pas
r189 r191 6 6 7 7 uses 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; 10 10 11 11 type … … 16 16 { TCDStyleRegions } 17 17 18 TCDStyleRegions = class(TCD Style)18 TCDStyleRegions = class(TCDManager) 19 19 private 20 20 function GetDirection(InsertAt: TAlign): TCDDirection; … … 22 22 FDockDirection: TCDDirection; 23 23 //Panels: TObjectList; // TObjectList<TCDStyleRegionsPanel> 24 procedure InsertControl(AControl: TControl; InsertAt: TAlign); override; 24 procedure InsertControl(Control: TControl; InsertAt: TAlign; 25 DropCtl: TControl); override; 25 26 procedure RemoveControl(Control: TControl); override; 26 function GetHeaderPos: THeaderPos; override;27 procedure SetHeaderPos(const AValue: THeaderPos); override;28 27 constructor Create(AManager: TCDManagerBase); 29 28 destructor Destroy; override; 30 29 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); 33 32 property DockDirection: TCDDirection read FDockDirection 34 33 write FDockDirection; … … 38 37 39 38 uses 40 UCDClient, UCDConjoinForm , UCDManager;39 UCDClient, UCDConjoinForm; 41 40 42 41 … … 54 53 end; 55 54 56 procedure TCDStyleRegions.InsertControl(AControl: TControl; InsertAt: TAlign); 55 procedure TCDStyleRegions.InsertControl(Control: TControl; InsertAt: TAlign; 56 DropCtl: TControl); 57 57 var 58 58 NewPanel: TCDClientPanel; … … 63 63 begin 64 64 inherited; 65 with TCDManager(Manager) dobegin65 begin 66 66 if DockSite.DockClientCount <= 2 then FDockDirection := GetDirection(InsertAt) 67 67 else … … 74 74 // FDockSite.ManualFloat(FDockSite.BoundsRect); 75 75 NewConjoinDockForm.ManualDock(NewDockSite); 76 AControl.ManualDock(NewConjoinDockForm, nil, InsertAt);76 Control.ManualDock(NewConjoinDockForm, nil, InsertAt); 77 77 if DockSite is TForm then 78 78 DockSite.ManualDock(NewConjoinDockForm) … … 87 87 NewPanel := TCDClientPanel.Create(nil); 88 88 with NewPanel do begin 89 Parent := TCDManager(Manager).DockSite;90 OwnerDockManager := Manager;89 Parent := Self.DockSite; 90 OwnerDockManager := Self; 91 91 if DockStyle = dsList then Visible := True; 92 Header.PopupMenu := TCDManager(Manager).PopupMenu;92 Header.PopupMenu := Self.PopupMenu; 93 93 //PopupMenu.Parent := Self.DockSite; 94 94 end; 95 if ( AControl is TForm) and Assigned((AControl as TForm).Icon) then96 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; 102 102 if (InsertAt = alTop) or (InsertAt = alLeft) then 103 103 DockPanels.Insert(0, NewPanel) … … 112 112 ClientCount: Integer; 113 113 begin 114 ClientPanel := TCDManager(Manager).FindControlInPanels(Control);114 ClientPanel := FindControlInPanels(Control); 115 115 Control.RemoveHandlerOnVisibleChanged(ClientPanel.VisibleChange); 116 116 117 TCDManager(Manager).DockPanels.Remove(ClientPanel);118 ClientCount := TCDManager(Manager).DockPanels.Count;117 DockPanels.Remove(ClientPanel); 118 ClientCount := DockPanels.Count; 119 119 120 120 //if TCDManager(Manager).DockSite.DockClientCount = 2 then FDockDirection := ddNone; 121 121 if ClientCount = 1 then begin 122 122 // Last removed control => Free parent if it is TCDConjoinForm 123 if TCDManager(Manager).DockSite is TCDConjoinForm then124 with TCDConjoinForm( TCDManager(Manager).DockSite) do begin123 if Self.DockSite is TCDConjoinForm then 124 with TCDConjoinForm(Self.DockSite) do begin 125 125 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)); 128 128 ManualFloat(Rect(Left, Top, Left + Width, Top + Height)); 129 129 Free; … … 134 134 end; 135 135 136 function TCDStyleRegions.GetHeaderPos: THeaderPos;137 begin138 // Result := TCDManager(Manager).;139 end;140 141 procedure TCDStyleRegions.SetHeaderPos(const AValue: THeaderPos);142 begin143 inherited SetHeaderPos(AValue);144 end;145 146 136 constructor TCDStyleRegions.Create(AManager: TCDManagerBase); 147 137 var 148 138 I: Integer; 149 139 begin 150 inherited;140 // inherited; 151 141 //Panels := TObjectList.Create; 152 142 … … 181 171 SplitterLeft := 0; 182 172 SplitterTop := 0; 183 with TCDManager(Manager) do184 173 for I := 0 to DockPanels.Count - 1 do 185 174 with TCDClientPanel(DockPanels[I]) do begin 186 175 Left := SplitterLeft; 187 176 Top := SplitterTop; 188 Height := TCDManager(Manager).DockSite.Height div189 TCDManager(Manager).DockSite.DockClientCount;190 Width := TCDManager(Manager).DockSite.Width div191 TCDManager(Manager).DockSite.DockClientCount;177 Height := Self.DockSite.Height div 178 Self.DockSite.DockClientCount; 179 Width := Self.DockSite.Width div 180 SElf.DockSite.DockClientCount; 192 181 //TCDClientPanel(FDockPanels[I]).DockPanelPaint(Self); 193 182 if I < (DockPanels.Count - 1) then Align := BaseAlign … … 198 187 Splitter.Left := SplitterLeft; 199 188 Splitter.Top := SplitterTop; 200 Splitter.Parent := TCDManager(Manager).DockSite;189 Splitter.Parent := SElf.DockSite; 201 190 Splitter.Align := BaseAlign; 202 191 Splitter.Visible := I < (DockPanels.Count - 1); … … 212 201 end; 213 202 214 procedure TCDStyleRegions.SetVisible(const AValue: Boolean); 215 var 216 I: Integer; 217 begin 218 inherited SetVisible(AValue); 219 with TCDManager(Manager) do 203 procedure TCDStyleRegions.DoSetVisible(const AValue: Boolean); 204 var 205 I: Integer; 206 begin 207 // inherited SetVisible(AValue); 220 208 for I := 0 to DockPanels.Count - 1 do 221 209
Note:
See TracChangeset
for help on using the changeset viewer.