Changeset 59 for Docking/CoolDocking/UCoolDocking.pas
- Timestamp:
- Sep 24, 2010, 7:46:17 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Docking/CoolDocking/UCoolDocking.pas
r58 r59 23 23 TCoolDockCustomize = class; 24 24 TCoolDockClient = class; 25 TCoolDockMaster = class; 25 26 26 27 { TCoolDockConjoinForm } … … 81 82 TCoolDockManager = class(TDockManager) 82 83 private 84 FMaster: TCoolDockMaster; 83 85 FMoveDuration: Integer; 84 86 FTabsPos: THeaderPos; … … 97 99 procedure PopupMenuTabCloseClick(Sender: TObject); 98 100 procedure SetDockStyle(const AValue: TDockStyle); 101 procedure SetMaster(const AValue: TCoolDockMaster); 99 102 procedure SetMoveDuration(const AValue: Integer); 100 103 procedure SetTabsPos(const AValue: THeaderPos); … … 144 147 property MoveDuration: Integer read FMoveDuration write SetMoveDuration; 145 148 property TabsPos: THeaderPos read FTabsPos write SetTabsPos; 149 property Master: TCoolDockMaster read FMaster write SetMaster; 146 150 end; 147 151 … … 181 185 TCoolDockClient = class(TComponent) 182 186 private 187 FDockable: Boolean; 183 188 FMaster: TCoolDockMaster; 184 189 FPanel: TPanel; 190 procedure SetDockable(const AValue: Boolean); 185 191 procedure SetMaster(const AValue: TCoolDockMaster); 186 192 constructor Create(AOwner: TComponent); override; … … 188 194 procedure SetPanel(const AValue: TPanel); 189 195 published 196 property Dockable: Boolean read FDockable 197 write SetDockable default True; 190 198 property Master: TCoolDockMaster read FMaster 191 199 write SetMaster; … … 538 546 if (not Assigned(FDockSite.Parent)) then begin 539 547 // Create conjointed form 540 NewConjoinDockForm := TCoolDockConjoinForm.Create(Application); 541 NewConjoinDockForm.Visible := True; 542 NewConjoinDockForm.BoundsRect := FDockSite.BoundsRect; 548 NewConjoinDockForm := CreateContainer(InsertAt); 543 549 FDockSite.ManualDock(NewConjoinDockForm.Panel); 544 550 Control.ManualDock(NewConjoinDockForm.Panel, nil, InsertAt); 545 551 end else begin 546 NewConjoinDockForm := TCoolDockConjoinForm.Create(Application); 547 NewConjoinDockForm.Visible := True; 548 NewConjoinDockForm.BoundsRect := FDockSite.BoundsRect; 549 NewConjoinDockForm.DragMode := dmAutomatic; 550 NewConjoinDockForm.DragKind := dkDock; 552 NewConjoinDockForm := CreateContainer(InsertAt); 551 553 NewDockSite := FDockSite.HostDockSite; 552 554 // FDockSite.ManualFloat(FDockSite.BoundsRect); … … 664 666 NewConjoinDockForm.Visible := True; 665 667 NewConjoinDockForm.BoundsRect := FDockSite.BoundsRect; 666 NewConjoinDockForm.DragMode := dmAutomatic; 667 NewConjoinDockForm.DragKind := dkDock; 668 NewConjoinDockForm.CoolDockClient.Master := Self.Master; 668 669 NewDockSite := FDockSite.HostDockSite; 669 670 // FDockSite.ManualFloat(FDockSite.BoundsRect); … … 703 704 end; 704 705 UpdateClientSize; 706 end; 707 708 procedure TCoolDockManager.SetMaster(const AValue: TCoolDockMaster); 709 begin 710 if FMaster = AValue then Exit; 711 FMaster := AValue; 705 712 end; 706 713 … … 849 856 procedure TCoolDockManager.PopupMenuCustomizeClick(Sender: TObject); 850 857 begin 851 // if Assigned(DockMaster.Customize) then 852 // DockMaster.Customize.Execute; 858 if Assigned(Master) and 859 Assigned(Master.Customize) then 860 Master.Customize.Execute; 853 861 end; 854 862 … … 1307 1315 if Assigned(FOldMaster) then 1308 1316 FOldMaster.UnregisterClient(Self); 1309 if Assigned(FMaster) then 1317 if Assigned(FMaster) then begin 1310 1318 FMaster.RegisterClient(Self); 1319 if not (csDesigning in ComponentState) then begin 1320 if Assigned(TWinControl(Owner).DockManager) then 1321 TCoolDockManager(TWinControl(Owner).DockManager).Master := FMaster; 1322 if Assigned(Panel) then 1323 TCoolDockManager(Panel.DockManager).Master := FMaster; 1324 end; 1325 end; 1326 end; 1327 1328 procedure TCoolDockClient.SetDockable(const AValue: Boolean); 1329 begin 1330 if FDockable = AValue then Exit; 1331 FDockable := AValue; 1332 if not (Owner is TForm) then 1333 with (Owner as TForm) do 1334 if AValue then begin 1335 DragKind := dkDock; 1336 DragMode := dmAutomatic; 1337 end else begin 1338 DragKind := dkDrag; 1339 DragMode := dmManual; 1340 end; 1311 1341 end; 1312 1342 … … 1314 1344 begin 1315 1345 inherited Create(AOwner); 1346 FDockable := True; 1316 1347 if not (AOwner is TForm) then 1317 1348 raise Exception.Create(SWrongOwner); 1318 1349 with (AOwner as TForm) do begin 1319 1350 if not (csDesigning in ComponentState) then begin 1320 DragKind := dkDock; 1321 DragMode := dmAutomatic; 1351 if Dockable then begin 1352 DragKind := dkDock; 1353 DragMode := dmAutomatic; 1354 end; 1322 1355 DockSite := True; 1323 1356 UseDockManager := True;
Note:
See TracChangeset
for help on using the changeset viewer.