Changeset 198 for Docking/CoolDocking/Managers/UCDManagerRegions.pas
- Timestamp:
- Mar 16, 2011, 12:32:41 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Docking/CoolDocking/Managers/UCDManagerRegions.pas
r197 r198 17 17 PanelHeader: TCDPanelHeader; 18 18 Splitter: TSplitter; 19 procedure Paint(Sender: TObject); override; 19 20 constructor Create; 20 21 destructor Destroy; override; … … 26 27 private 27 28 FDockItems: TObjectList; // TList<TCDManagerRegionsItem> 29 function GetHeaderPos: THeaderPos; override; 30 procedure SetHeaderPos(const AValue: THeaderPos); override; 28 31 function GetDirection(InsertAt: TAlign): TCDDirection; 29 32 public … … 53 56 { TCDManagerRegionsItem } 54 57 58 procedure TCDManagerRegionsItem.Paint(Sender: TObject); 59 var 60 I: Integer; 61 R: TRect; 62 begin 63 inherited Paint(Sender); 64 with PanelHeader do 65 if not (csDesigning in ComponentState) then 66 if Assigned(Control) then begin 67 //R := Control.ClientRect; 68 //Canvas.FillRect(R); 69 Header.Visible := ShowHeader; 70 if ShowHeader then begin 71 if ControlPanel.DockClientCount = 0 then 72 Header.DrawGrabber(Canvas, Control) else 73 Header.DrawGrabber(Canvas, ControlPanel); 74 end; 75 end; 76 end; 77 55 78 constructor TCDManagerRegionsItem.Create; 56 79 begin … … 59 82 PanelHeader.Header.OnMouseDown := DockPanelMouseDown; 60 83 PanelHeader.Header.Title.OnMouseDown := DockPanelMouseDown; 84 PanelHeader.Header.Icon.OnMouseDown := DockPanelMouseDown; 61 85 62 86 Splitter := TSplitter.Create(nil); … … 81 105 82 106 { TCDManagerRegions } 107 108 function TCDManagerRegions.GetHeaderPos: THeaderPos; 109 begin 110 Result := inherited; 111 end; 112 113 procedure TCDManagerRegions.SetHeaderPos(const AValue: THeaderPos); 114 begin 115 inherited SetHeaderPos(AValue); 116 case AValue of 117 hpBottom, hpTop: FDockDirection := ddVertical; 118 hpLeft, hpRight: FDockDirection := ddHorizontal; 119 end; 120 end; 83 121 84 122 function TCDManagerRegions.GetDirection(InsertAt: TAlign): TCDDirection; … … 117 155 PanelHeader.Header.PopupMenu := Self.PopupMenu; 118 156 end; 119 if (Control is TForm) and Assigned((Control as TForm).Icon) then 157 if (Control is TForm) and Assigned((Control as TForm).Icon) then begin 120 158 NewItem.PanelHeader.Header.Icon.Picture.Assign((Control as TForm).Icon); 121 NewItem.PanelHeader.Parent := DockSite; 122 NewItem.PanelHeader.Header.Title.Caption := TForm(Control).Caption; 123 124 NewItem.Control := Control; 125 Control.AddHandlerOnVisibleChanged(NewItem.VisibleChange); 126 Control.Parent := NewItem.PanelHeader.ControlPanel; 127 Control.Align := alClient; 128 if (InsertAt = alTop) or (InsertAt = alLeft) then 129 DockItems.Insert(0, NewItem) 130 else DockItems.Add(NewItem); 131 end; 159 NewItem.PanelHeader.Header.Icon.Width := NewItem.PanelHeader.Header.Icon.Picture.Bitmap.Width; 160 NewItem.PanelHeader.Header.Icon.Height := NewItem.PanelHeader.Header.Icon.Picture.Bitmap.Height; 161 end; 162 163 NewItem.PanelHeader.Parent := DockSite; 164 NewItem.PanelHeader.Header.Title.Caption := TForm(Control).Caption; 165 166 NewItem.Control := Control; 167 Control.AddHandlerOnVisibleChanged(NewItem.VisibleChange); 168 Control.Parent := NewItem.PanelHeader.ControlPanel; 169 Control.Align := alClient; 170 if (InsertAt = alTop) or (InsertAt = alLeft) then 171 DockItems.Insert(0, NewItem) 172 else DockItems.Add(NewItem); 173 end; 132 174 133 175 procedure TCDManagerRegions.InsertControlPanel(Control: TControl; InsertAt: TAlign; … … 248 290 PanelHeader.Width := Self.DockSite.Width div 249 291 Self.DockSite.DockClientCount; 250 //TCDClientPanel(FDockPanels[I]).DockPanelPaint(Self);292 Paint(Self); 251 293 if I < (DockItems.Count - 1) then PanelHeader.Align := BaseAlign 252 294 else PanelHeader.Align := alClient;
Note:
See TracChangeset
for help on using the changeset viewer.