Changeset 195 for Docking/CoolDocking/Managers/UCDManagerRegions.pas
- Timestamp:
- Mar 11, 2011, 2:16:50 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Docking/CoolDocking/Managers/UCDManagerRegions.pas
r194 r195 15 15 16 16 TCDManagerRegionsItem = class(TCDManagerItem) 17 Panel : TPanel;17 PanelHeader: TCDPanelHeader; 18 18 Splitter: TSplitter; 19 ClientAreaPanel: TPanel;20 19 constructor Create; 20 destructor Destroy; override; 21 21 end; 22 22 … … 31 31 //Panels: TObjectList; // TObjectList<TCDStyleRegionsPanel> 32 32 function FindControlInPanels(Control: TControl): TCDManagerItem; override; 33 procedure InsertControlNoUpdate(Control: TControl; InsertAt: TAlign); 33 34 procedure InsertControlPanel(Control: TControl; InsertAt: TAlign; 34 35 DropCtl: TControl); override; … … 54 55 constructor TCDManagerRegionsItem.Create; 55 56 begin 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); 57 PanelHeader := TCDPanelHeader.Create(nil); 58 PanelHeader.Header.ManagerItem := Self; 59 60 Splitter := TSplitter.Create(nil); 70 61 with Splitter do begin 71 Parent := Panel;62 //Parent := Panel; 72 63 //Color := clRed; 73 64 end; 65 end; 66 67 destructor TCDManagerRegionsItem.Destroy; 68 begin 69 inherited Destroy; 74 70 end; 75 71 … … 100 96 end; 101 97 98 procedure TCDManagerRegions.InsertControlNoUpdate(Control: TControl; 99 InsertAt: TAlign); 100 var 101 NewItem: TCDManagerRegionsItem; 102 begin 103 NewItem := TCDManagerRegionsItem.Create; 104 with NewItem do begin 105 PanelHeader.Parent := Self.DockSite; 106 Manager := Self; 107 if DockStyle = dsList then Visible := True; 108 PanelHeader.Header.PopupMenu := Self.PopupMenu; 109 end; 110 if (Control is TForm) and Assigned((Control as TForm).Icon) then 111 NewItem.PanelHeader.Header.Icon.Picture.Assign((Control as TForm).Icon); 112 NewItem.PanelHeader.Parent := DockSite; 113 114 NewItem.Control := Control; 115 Control.AddHandlerOnVisibleChanged(NewItem.VisibleChange); 116 Control.Parent := NewItem.PanelHeader.ControlPanel; 117 Control.Align := alClient; 118 if (InsertAt = alTop) or (InsertAt = alLeft) then 119 DockItems.Insert(0, NewItem) 120 else DockItems.Add(NewItem); 121 end; 122 102 123 procedure TCDManagerRegions.InsertControlPanel(Control: TControl; InsertAt: TAlign; 103 124 DropCtl: TControl); 104 125 var 105 New Panel: TCDManagerRegionsItem;126 NewItem: TCDManagerRegionsItem; 106 127 I: Integer; 107 128 NewDirection: TCDDirection; … … 131 152 end; 132 153 end; 133 134 NewPanel := TCDManagerRegionsItem.Create; 135 with NewPanel do begin 136 Panel.Parent := Self.DockSite; 137 Manager := Self; 138 if DockStyle = dsList then Visible := True; 139 Header.PopupMenu := Self.PopupMenu; 140 //PopupMenu.Parent := Self.DockSite; 141 end; 142 if (Control is TForm) and Assigned((Control as TForm).Icon) then 143 NewPanel.Header.Icon.Picture.Assign((Control as TForm).Icon); 144 145 NewPanel.Control := Control; 146 Control.AddHandlerOnVisibleChanged(NewPanel.VisibleChange); 147 Control.Parent := NewPanel.ClientAreaPanel; 148 Control.Align := alClient; 149 if (InsertAt = alTop) or (InsertAt = alLeft) then 150 DockItems.Insert(0, NewPanel) 151 else DockItems.Add(NewPanel); 154 InsertControlNoUpdate(Control, InsertAt); 152 155 end; 153 156 UpdateClientSize; … … 156 159 procedure TCDManagerRegions.RemoveControl(Control: TControl); 157 160 var 158 ClientPanel: TCDManagerItem;161 ManagerItem: TCDManagerItem; 159 162 ClientCount: Integer; 160 163 begin 161 ClientPanel := FindControlInPanels(Control); 162 Control.RemoveHandlerOnVisibleChanged(ClientPanel.VisibleChange); 163 164 DockItems.Remove(ClientPanel); 164 ManagerItem := FindControlInPanels(Control); 165 if Assigned(ManagerItem) then 166 Control.RemoveHandlerOnVisibleChanged(ManagerItem.VisibleChange); 167 168 DockItems.Remove(ManagerItem); 165 169 ClientCount := DockItems.Count; 166 170 … … 184 188 var 185 189 I: Integer; 190 NewItem: TCDManagerRegionsItem; 186 191 begin 187 192 inherited; … … 189 194 FDockItems := TObjectList.Create; 190 195 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; 200 end; 196 for I := 0 to ADockSite.DockClientCount - 1 do 197 InsertControlNoUpdate(ADockSite.DockClients[I], alLeft); 198 UpdateClientSize; 201 199 end; 202 200 … … 214 212 for I := 0 to FDockItems.Count - 1 do 215 213 with TCDManagerRegionsItem(FDockItems[I]) do begin 216 Panel .Invalidate;214 PanelHeader.Invalidate; 217 215 end; 218 216 end; … … 233 231 for I := 0 to DockItems.Count - 1 do 234 232 with TCDManagerRegionsItem(DockItems[I]) do begin 235 Panel .Left := SplitterLeft;236 Panel .Top := SplitterTop;237 Panel .Height := Self.DockSite.Height div233 PanelHeader.Left := SplitterLeft; 234 PanelHeader.Top := SplitterTop; 235 PanelHeader.Height := Self.DockSite.Height div 238 236 Self.DockSite.DockClientCount; 239 Panel .Width := Self.DockSite.Width div237 PanelHeader.Width := Self.DockSite.Width div 240 238 Self.DockSite.DockClientCount; 241 239 //TCDClientPanel(FDockPanels[I]).DockPanelPaint(Self); 242 if I < (DockItems.Count - 1) then Panel .Align := BaseAlign243 else Panel .Align := alClient;244 245 Inc(SplitterLeft, Panel .Width);246 Inc(SplitterTop, Panel .Height);240 if I < (DockItems.Count - 1) then PanelHeader.Align := BaseAlign 241 else PanelHeader.Align := alClient; 242 243 Inc(SplitterLeft, PanelHeader.Width); 244 Inc(SplitterTop, PanelHeader.Height); 247 245 Splitter.Left := SplitterLeft; 248 246 Splitter.Top := SplitterTop; … … 255 253 Paint(Self); 256 254 if I < (DockItems.Count - 1) then begin 257 if DockDirection = ddHorizontal then Panel .Align := alLeft258 else Panel .Align := alTop;259 end else Panel .Align := alClient;255 if DockDirection = ddHorizontal then PanelHeader.Align := alLeft 256 else PanelHeader.Align := alTop; 257 end else PanelHeader.Align := alClient; 260 258 end; 261 259 end;
Note:
See TracChangeset
for help on using the changeset viewer.