Changeset 198 for Docking/CoolDocking/UCDManager.pas
- Timestamp:
- Mar 16, 2011, 12:32:41 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Docking/CoolDocking/UCDManager.pas
r197 r198 14 14 15 15 type 16 THeaderPos = (hpAuto, hpLeft, hpTop, hpRight, hpBottom);17 18 16 TCDManager = class; 19 17 TCDManagerItem = class; … … 23 21 TCDHeaderButton = class 24 22 Icon: TImage; 23 Visible: Boolean; 25 24 constructor Create; 26 25 destructor Destroy; override; … … 32 31 private 33 32 procedure CloseButtonClick(Sender: TObject); 34 procedure DrawGrabber(Canvas: TCanvas; AControl: TControl);35 33 procedure PaintExecute(Sender: TObject); 36 34 procedure RearrangeButtons; … … 40 38 Icon: TImage; 41 39 ManagerItem: TCDManagerItem; 40 procedure DrawGrabber(Canvas: TCanvas; AControl: TControl); 42 41 constructor Create(TheOwner: TComponent); override; 43 42 destructor Destroy; override; … … 72 71 procedure Paint(Sender: TObject); virtual; 73 72 procedure VisibleChange(Sender: TObject); virtual; 74 constructor Create; 73 constructor Create; virtual; 75 74 destructor Destroy; override; 76 75 end; … … 81 80 private 82 81 FDockSite: TWinControl; 82 FHeaderPos: THeaderPos; 83 83 function GetDockSite: TWinControl; 84 function GetHeaderPos: THeaderPos;85 84 function GetMoveDuration: Integer; 86 85 procedure SetDockStyle(const AValue: TCDStyleType); 87 procedure SetHeaderPos(const AValue: THeaderPos);88 86 procedure SetMoveDuration(const AValue: Integer); 89 87 procedure SetVisible(const AValue: Boolean); 90 88 public 89 Locked: Boolean; 90 PopupMenu: TCDPopupMenu; 91 91 FDockStyle: TCDStyleType; 92 PopupMenu: TCDPopupMenu;93 92 constructor Create(ADockSite: TWinControl); override; 94 93 destructor Destroy; override; … … 100 99 DropCtl: TControl); virtual; 101 100 procedure DoSetVisible(const AValue: Boolean); virtual; 101 procedure SetHeaderPos(const AValue: THeaderPos); virtual; 102 function GetHeaderPos: THeaderPos; virtual; 102 103 103 104 // Inherited from TDockManager … … 131 132 end; 132 133 134 function HeaderPosToTabPos(HeaderPos: THeaderPos): TTabPosition; 135 133 136 134 137 implementation … … 137 140 UCDManagerRegions, UCDManagerTabs, UCDManagerRegionsPopup, UCDManagerTabsPopup, 138 141 UCDResource; 142 143 function HeaderPosToTabPos(HeaderPos: THeaderPos): TTabPosition; 144 begin 145 case HeaderPos of 146 hpBottom: Result := tpBottom; 147 hpLeft: Result := tpLeft; 148 hpTop: Result := tpTop; 149 hpRight: Result := tpRight; 150 hpAuto: Result := tpLeft; 151 end; 152 end; 139 153 140 154 { TCDHeaderButton } … … 204 218 205 219 procedure TCDManagerItem.Paint(Sender: TObject); 206 var 207 I: Integer; 208 R: TRect; 209 begin 210 (* if not (csDesigning in ComponentState) then 211 if Assigned(Control) then begin 212 R := Control.ClientRect; 213 Canvas.FillRect(R); 214 Header.Visible := ShowHeader; 215 if ShowHeader then begin 216 if ClientAreaPanel.DockClientCount = 0 then 217 Header.DrawGrabber(Canvas, Control) else 218 Header.DrawGrabber(Canvas, ClientAreaPanel); 219 end; 220 end;*) 220 begin 221 221 end; 222 222 … … 248 248 //(Control as TWinControl).DockSite := False; 249 249 //ClientAreaPanel.DockSite := False; 250 (Control as TWinControl).BeginDrag(False, 10); 251 DragManager.DragStart(Control, False, 1); 250 if not Manager.Locked then begin 251 (Control as TWinControl).BeginDrag(False, 10); 252 DragManager.DragStart(Control, False, 1); 253 end; 252 254 end; 253 255 end; … … 310 312 function TCDManager.GetHeaderPos: THeaderPos; 311 313 begin 312 314 Result := FHeaderPos; 313 315 end; 314 316 … … 527 529 end else 528 530 if AValue = dsPopupTabs then begin 529 NewManager := TCD StylePopupTabs.Create(FDockSite);531 NewManager := TCDManagerTabsPopup.Create(FDockSite); 530 532 end; 531 533 if DockSite.DockManager is TCDManager then … … 538 540 procedure TCDManager.SetHeaderPos(const AValue: THeaderPos); 539 541 begin 540 542 FHeaderPos := AValue; 541 543 end; 542 544 … … 600 602 Icon.Parent := Self; 601 603 Icon.OnClick := CloseButtonClick; 604 Visible := True; 602 605 end; 603 606 Buttons.Add(NewButton); … … 606 609 DataModule2.ImageList1.GetBitmap(1, Icon.Picture.Bitmap); 607 610 Icon.Parent := Self; 608 Icon.OnClick := CloseButtonClick; 611 Icon.OnClick := nil; 612 Visible := False; 613 end; 614 Buttons.Add(NewButton); 615 NewButton := TCDHeaderButton.Create; 616 with NewButton do begin 617 DataModule2.ImageList1.GetBitmap(2, Icon.Picture.Bitmap); 618 Icon.Parent := Self; 619 Icon.OnClick := nil; 620 Visible := False; 609 621 end; 610 622 Buttons.Add(NewButton); … … 640 652 else Title.Left := 6; 641 653 Title.Caption := AControl.Caption; 654 RearrangeButtons; 642 655 end; 643 656 end; … … 702 715 LeftPos := Self.Width; 703 716 for I := 0 to Buttons.Count - 1 do 704 with TCDHeaderButton(Buttons[I]), Icon do begin 705 Anchors := [akRight, akTop]; 717 with TCDHeaderButton(Buttons[I]) do 718 if Visible then begin 719 Icon.Anchors := [akRight, akTop]; 706 720 //Icon.Picture.Bitmap.SetSize(16, 16); 707 721 Icon.Width := Icon.Picture.Bitmap.Width; … … 712 726 713 727 //ShowMessage(IntToStr(Icon.Width) + ' ' + InttoStr(Icon.Height)); 714 Visible := True;715 end ;728 Icon.Visible := True; 729 end else Icon.Visible := False; 716 730 end; 717 731
Note:
See TracChangeset
for help on using the changeset viewer.