Changeset 181 for Docking/CoolDocking/UCoolDocking.pas
- Timestamp:
- Mar 9, 2011, 10:56:47 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Docking/CoolDocking/UCoolDocking.pas
r180 r181 13 13 DateUtils, UCoolDockStyleTabs, UCoolDockStyleRegions, UCoolDockStylePopupTabs, 14 14 UCoolDockStylePopupRegions, UCoolDockStyle, UCoolDockClientPanel, 15 UCoolDockPopupMenu , UCoolDockLayout;15 UCoolDockPopupMenu; 16 16 17 17 const … … 22 22 23 23 TCoolDockManager = class; 24 TCoolDockCustomize = class;25 24 TCoolDockClient = class; 26 25 TCoolDockMaster = class; … … 28 27 { TCoolDockConjoinForm } 29 28 30 TCoolDockConjoinForm = class(TForm) 29 TCoolDockConjoinForm = class(TCoolDockConjoinFormBase) 30 public 31 31 Panel: TPanel; 32 32 CoolDockClient: TCoolDockClient; … … 36 36 destructor Destroy; override; 37 37 private 38 procedure SetName(const NewName: TComponentName); override; 38 39 procedure PanelVisibleChange(Sender: TObject); 39 40 end; … … 107 108 { TCoolDockMaster } 108 109 109 TCoolDockMaster = class(TCo mponent)110 TCoolDockMaster = class(TCoolDockMasterBase) 110 111 private 111 FCoolDockCustomize: TCoolDockCustomize;112 112 FDefaultHeaderPos: THeaderPos; 113 113 FDefaultMoveSpeed: Integer; … … 117 117 FClients: TObjectList; 118 118 function GetClient(Index: Integer): TCoolDockClient; 119 procedure SetCustomize(const AValue: TCoolDockCustomize);120 119 procedure SetShowIcons(const AValue: Boolean); 121 120 procedure SetTabsEnabled(const AValue: Boolean); … … 138 137 property DefaultMoveSpeed: Integer read FDefaultMoveSpeed 139 138 write FDefaultMoveSpeed; 140 property Customize: TCoolDockCustomize read FCoolDockCustomize141 write SetCustomize;142 139 property ShowIcons: Boolean read FShowIcons 143 140 write SetShowIcons; … … 168 165 end; 169 166 170 { TCoolDockCustomize }171 172 TCoolDockCustomize = class(TComponent)173 private174 FLayoutList: TCoolDockLayoutList;175 FMaster: TCoolDockMaster;176 Form: TCoolDockCustomizeForm;177 procedure SetLayoutList(const AValue: TCoolDockLayoutList);178 procedure SetMaster(const AValue: TCoolDockMaster);179 public180 function Execute: Boolean;181 constructor Create(AOwner: TComponent); override;182 destructor Destroy; override;183 published184 property Master: TCoolDockMaster read FMaster write SetMaster;185 property LayoutList: TCoolDockLayoutList read FLayoutList write SetLayoutList;186 end;187 167 188 168 procedure Register; … … 198 178 RegisterComponents('CoolDocking', [TCoolDockClient]); 199 179 RegisterComponents('CoolDocking', [TCoolDockCustomize]); 180 end; 181 182 function GetUniqueName(BaseName: string): string; 183 var 184 I: Integer; 185 begin 186 I := 1; 187 while Assigned(FindGlobalComponent(BaseName + IntToStr(I))) do Inc(I); 188 Result := BaseName + IntToStr(I); 200 189 end; 201 190 … … 481 470 begin 482 471 NewConjoinDockForm := TCoolDockConjoinForm.Create(Application); 472 NewConjoinDockForm.Name := GetUniqueName('ConjoinForm'); 483 473 NewConjoinDockForm.Visible := True; 484 474 NewConjoinDockForm.BoundsRect := FDockSite.BoundsRect; … … 566 556 constructor TCoolDockConjoinForm.Create(TheOwner: TComponent); 567 557 begin 568 inherited Create (TheOwner);558 inherited CreateNew(TheOwner); 569 559 Panel := TPanel.Create(Self); 570 560 with Panel do begin 571 561 Parent := Self; 572 Name := Parent.Name + '_Panel';573 562 Caption := ''; 574 563 DockSite := True; … … 582 571 with CoolDockClient do begin 583 572 Panel := Self.Panel; 584 Name := Owner.Name + '_CoolDockClient';585 573 end; 586 574 OnShow := FormShow; … … 596 584 end; 597 585 586 procedure TCoolDockConjoinForm.SetName(const NewName: TComponentName); 587 begin 588 inherited SetName(NewName); 589 Panel.Name := Name + '_Panel'; 590 Panel.Caption := ''; 591 CoolDockClient.Name := Name + '_CoolDockClient'; 592 end; 593 598 594 procedure TCoolDockConjoinForm.PanelVisibleChange(Sender: TObject); 599 595 begin … … 607 603 if FTabsEnabled = AValue then Exit; 608 604 FTabsEnabled := AValue; 609 end;610 611 procedure TCoolDockMaster.SetCustomize(const AValue: TCoolDockCustomize612 );613 var614 OldCustomize: TCoolDockCustomize;615 begin616 if FCoolDockCustomize = AValue then Exit;617 OldCustomize := FCoolDockCustomize;618 FCoolDockCustomize := AValue;619 if Assigned(AValue) then begin620 FCoolDockCustomize.Master := Self;621 end else begin622 OldCustomize.Master := nil;623 end;624 605 end; 625 606 … … 773 754 end; 774 755 end; 775 776 { TCoolDockCustomize }777 778 procedure TCoolDockCustomize.SetMaster(const AValue: TCoolDockMaster);779 var780 OldMaster: TCoolDockMaster;781 begin782 if FMaster = AValue then Exit;783 OldMaster := FMaster;784 FMaster := AValue;785 if Assigned(AValue) then begin786 FMaster.Customize := Self;787 end else begin788 OldMaster.Customize := nil;789 end;790 end;791 792 procedure TCoolDockCustomize.SetLayoutList(const AValue: TCoolDockLayoutList);793 begin794 if FLayoutList=AValue then exit;795 FLayoutList:=AValue;796 end;797 798 function TCoolDockCustomize.Execute: Boolean;799 begin800 Form := TCoolDockCustomizeForm.Create(Self);801 if Assigned(Master) then begin802 Form.SpinEdit1.Value := Master.DefaultMoveSpeed;803 Form.ComboBox1.ItemIndex := Integer(Master.DefaultTabsPos);804 Form.ComboBox2.ItemIndex := Integer(Master.DefaultHeaderPos);805 Form.LayoutList := FLayoutList;806 end;807 Form.ShowModal;808 if Assigned(Master) then begin809 Master.DefaultMoveSpeed := Form.SpinEdit1.Value;810 Master.DefaultTabsPos := THeaderPos(Form.ComboBox1.ItemIndex);811 Master.DefaultHeaderPos := THeaderPos(Form.ComboBox2.ItemIndex);812 end;813 Form.Free;814 Result := True;815 end;816 817 constructor TCoolDockCustomize.Create(AOwner: TComponent);818 begin819 inherited Create(AOwner);820 end;821 822 destructor TCoolDockCustomize.Destroy;823 begin824 Master := nil;825 inherited Destroy;826 end;827 828 756 829 757 { TCoolDockClient } … … 916 844 end; 917 845 846 initialization 847 848 RegisterClass(TCoolDockConjoinForm); 849 850 finalization 851 852 UnRegisterClass(TCoolDockConjoinForm); 853 918 854 919 855 end.
Note:
See TracChangeset
for help on using the changeset viewer.