Changeset 218 for Docking/CoolDocking/UCDManager.pas
- Timestamp:
- Mar 23, 2011, 12:22:26 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Docking/CoolDocking/UCDManager.pas
r217 r218 16 16 TCDManager = class; 17 17 TCDManagerItem = class; 18 19 TCDPanelForm = class(TForm) 20 Panel: TPanel; 21 end; 18 22 19 23 { TCDHeaderButton } … … 37 41 Buttons: TObjectList; // TList<TCDHeaderButton> 38 42 Icon: TImage; 39 ManagerItem: TCDManagerItem;43 Control: TControl; 40 44 constructor Create(TheOwner: TComponent); override; 41 45 destructor Destroy; override; … … 63 67 TCDManagerItem = class 64 68 private 69 FControl: TWinControl; 65 70 function GetHideType: TCDHideType; 66 71 procedure ResizeExecute(Sender: TObject); 67 72 procedure SetHideType(const AValue: TCDHideType); 68 73 public 69 Control: TWinControl;70 74 Manager: TCDManager; 75 procedure SetControl(const AValue: TWinControl); virtual; 71 76 procedure DockPanelMouseDown(Sender: TObject; Button: TMouseButton; 72 77 Shift: TShiftState; X, Y: Integer); 73 78 procedure Paint(Sender: TObject); virtual; 74 79 procedure VisibleChange(Sender: TObject); virtual; 80 procedure VisibleChanging(Sender: TObject); virtual; 75 81 constructor Create; virtual; 76 82 destructor Destroy; override; 77 83 property HideType: TCDHideType read GetHideType write SetHideType; 84 property Control: TWinControl read FControl write SetControl; 78 85 end; 79 86 … … 90 97 procedure SetHeaderVisible(const AValue: Boolean); 91 98 procedure SetMoveDuration(const AValue: Integer); 92 procedure SetVisible(const AValue: Boolean);93 99 public 94 100 Locked: Boolean; … … 96 102 FDockStyle: TCDStyleType; 97 103 FreeParentIfEmpty: Boolean; // Free or not parent conjoin forms 104 procedure SetVisible(const AValue: Boolean); virtual; 98 105 constructor Create(ADockSite: TWinControl); override; 99 106 destructor Destroy; override; … … 104 111 procedure InsertControlPanel(Control: TControl; InsertAt: TAlign; 105 112 DropCtl: TControl); virtual; 106 procedure DoSetVisible(const AValue: Boolean); virtual;107 113 procedure SetHeaderPos(const AValue: THeaderPos); virtual; 108 114 function GetHeaderPos: THeaderPos; virtual; … … 130 136 131 137 function FindControlInPanels(Control: TControl): TCDManagerItem; virtual; 132 function CreateContainer(InsertAt: TAlign): TCDConjoinForm; 138 function CreateConjoinForm: TCDConjoinForm; 139 function CreateDockableForm: TCDPanelForm; 133 140 property DockStyle: TCDStyleType read FDockStyle write SetDockStyle; 134 141 property MoveDuration: Integer read GetMoveDuration write SetMoveDuration; … … 144 151 uses 145 152 UCDManagerRegions, UCDManagerTabs, UCDManagerRegionsPopup, UCDManagerTabsPopup, 146 UCDResource ;153 UCDResource, UCDClient; 147 154 148 155 function CreateRotatedFont(F: TFont; Angle: Integer): Integer; … … 281 288 end; 282 289 290 procedure TCDManagerItem.SetControl(const AValue: TWinControl); 291 begin 292 if FControl = AValue then Exit; 293 FControl := AValue; 294 end; 295 283 296 procedure TCDManagerItem.SetHideType(const AValue: TCDHideType); 284 297 begin … … 314 327 end; 315 328 329 procedure TCDManagerItem.VisibleChanging(Sender: TObject); 330 begin 331 332 end; 333 316 334 { TCDManager } 317 335 … … 388 406 DropCtl: TControl); 389 407 begin 390 end;391 392 procedure TCDManager.DoSetVisible(const AValue: Boolean);393 begin394 395 408 end; 396 409 … … 409 422 if (not Assigned(FDockSite.Parent)) then begin 410 423 // Create conjointed form 411 NewConjoinDockForm := CreateCon tainer(InsertAt);424 NewConjoinDockForm := CreateConjoinForm; 412 425 FDockSite.ManualDock(NewConjoinDockForm); 413 426 Control.ManualDock(NewConjoinDockForm, nil, InsertAt); 414 427 NewConjoinDockForm.UpdateCaption; 415 428 end else begin 416 NewConjoinDockForm := CreateCon tainer(InsertAt);429 NewConjoinDockForm := CreateConjoinForm; 417 430 NewDockSite := FDockSite.HostDockSite; 418 431 // FDockSite.ManualFloat(FDockSite.BoundsRect); … … 504 517 end; 505 518 506 function TCDManager.CreateCon tainer(InsertAt: TAlign): TCDConjoinForm;519 function TCDManager.CreateConjoinForm: TCDConjoinForm; 507 520 var 508 521 NewDockSite: TWinControl; … … 511 524 NewConjoinDockForm := TCDConjoinForm.Create(Application); 512 525 NewConjoinDockForm.Name := GetUniqueName('ConjoinForm'); 513 NewConjoinDockForm.Visible := True;526 //NewConjoinDockForm.Visible := True; 514 527 NewConjoinDockForm.BoundsRect := FDockSite.BoundsRect; 515 528 NewConjoinDockForm.CoolDockClient.Master := Self.Master; … … 518 531 //NewConjoinDockForm.ManualDock(NewDockSite, nil, InsertAt); 519 532 Result := NewConjoinDockForm; 533 end; 534 535 function TCDManager.CreateDockableForm: TCDPanelForm; 536 var 537 NewClient: TCDClient; 538 begin 539 Application.CreateForm(TCDPanelForm, Result); 540 Result.Name := GetUniqueName('DockForm'); 541 NewClient := TCDClient.Create(Result); 542 Result.Panel := TPanel.Create(Result); 543 Result.Panel.Parent := Result; 544 //Result.Panel.Visible := True; 545 Result.Panel.BevelInner := bvNone; 546 Result.Panel.BevelOuter := bvNone; 547 NewClient.Panel := Result.Panel; 548 NewClient.Master := Self.Master; 549 NewClient.Dockable := False; 520 550 end; 521 551 … … 564 594 565 595 procedure TCDManager.SetVisible(const AValue: Boolean); 566 var 567 I: Integer; 568 begin 569 DoSetVisible(AValue); 570 //Visible := AValue; 571 // for I := 0 to DockPanels.Count - 1 do 572 // TCDClientPanel(DockPanels[I]).Visible := AValue; 596 begin 573 597 end; 574 598 … … 638 662 Visible := True; 639 663 end; 664 665 BevelInner := bvNone; 666 BevelOuter := bvNone; 640 667 end; 641 668 … … 662 689 R: TRect; 663 690 begin 664 with TCDManager(TWinControl(ManagerItem.Control).DockManager) do 691 if Assigned(Control) then 692 with TCDManager(TWinControl(Control).DockManager) do 665 693 case HeaderPos of 666 694 hpLeft: begin … … 682 710 end; 683 711 684 if (ManagerItem.Control as TWinControl).Focused then 685 Canvas.Font.Style := Canvas.Font.Style + [fsBold] 686 else Canvas.Font.Style := Canvas.Font.Style - [fsBold]; 712 if Assigned(Control) then 713 if (Control as TWinControl).Focused then 714 Canvas.Font.Style := Canvas.Font.Style + [fsBold] 715 else Canvas.Font.Style := Canvas.Font.Style - [fsBold]; 687 716 688 717 RearrangeButtons; … … 737 766 738 767 //SelectObject(Canvas.Handle, MyFont); 739 Title := ManagerItem.Control.Caption; 768 if Assigned(Control) then 769 Title := Control.Caption else Title := ''; 740 770 if (TextWidth(Title) > TitleMaxWidth) then begin 741 771 while (Length(Title) > 0) and (TextWidth(Title + '...') > TitleMaxWidth) do begin … … 776 806 procedure TCDHeader.CloseButtonClick(Sender: TObject); 777 807 begin 778 ManagerItem.Control.Hide; 779 end; 780 781 808 if Assigned(Control) then 809 Control.Hide; 810 end; 782 811 783 812 end.
Note:
See TracChangeset
for help on using the changeset viewer.