Changeset 191 for Docking/CoolDocking/UCDStyleTabs.pas
- Timestamp:
- Mar 11, 2011, 10:07:38 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Docking/CoolDocking/UCDStyleTabs.pas
r189 r191 7 7 uses 8 8 Classes, Controls, ExtCtrls, ComCtrls, SysUtils, Dialogs, 9 Menus, UCDStyle, Forms, UCDClientPanel, UCDCommon;9 Menus, Forms, UCDClientPanel, UCDCommon, UCDManager; 10 10 11 11 type … … 13 13 { TCDStyleTabs } 14 14 15 TCDStyleTabs = class(TCDStyle) 15 TCDStyleTabs = class(TCDManager) 16 public 16 17 MouseDown: Boolean; 17 18 MouseButton: TMouseButton; … … 25 26 procedure TabControlMouseUp(Sender: TObject; Button: TMouseButton; 26 27 Shift: TShiftState; X, Y: Integer); 27 procedure InsertControl(AControl: TControl; InsertAt: TAlign); override; 28 procedure InsertControl(AControl: TControl; InsertAt: TAlign; 29 DropCtl: TControl); override; 28 30 procedure UpdateClientSize; override; 29 31 private … … 33 35 public 34 36 constructor Create(AManager: TCDManagerBase); 35 procedure SetVisible(const AValue: Boolean); override;37 procedure DoSetVisible(const AValue: Boolean); 36 38 destructor Destroy; override; 37 39 procedure ChangeVisible(Control: TWinControl; Visible: Boolean); override; … … 45 47 46 48 uses 47 UCDClient , UCDManager;49 UCDClient; 48 50 49 51 { TCDStyleTabs } … … 52 54 begin 53 55 if Assigned(PageControl.ActivePage) then 54 TCDClientPanel( TCDManager(Manager).DockPanels[PageControl.TabIndex]).Control.Hide;56 TCDClientPanel(DockPanels[PageControl.TabIndex]).Control.Hide; 55 57 end; 56 58 … … 58 60 begin 59 61 if MouseDown then 60 with TCDManager(Manager) do61 62 if Assigned(PageControl.ActivePage) then begin 62 63 TCDClientPanel(DockPanels[PageControl.TabIndex]).ClientAreaPanel.DockSite := False; … … 71 72 begin 72 73 // Hide all clients 73 with TCDManager(Manager) do74 74 for I := 0 to DockPanels.Count - 1 do 75 75 if TCDClientPanel(DockPanels[I]).Control.Visible … … 93 93 94 94 // Show selected 95 with TCDManager(Manager) do96 95 if (PageControl.TabIndex <> -1) and (DockPanels.Count > PageControl.TabIndex) 97 96 // and not TCDClientPanel(DockPanels[PageControl.TabIndex]).Control.Visible … … 144 143 NewTabSheet: TTabSheet; 145 144 begin 146 inherited;147 145 148 146 TabImageList := TImageList.Create(TCDManager(AManager).DockSite); //FDockSite); 149 147 with TabImageList do begin 150 Name := TCDManager(Manager).DockSite.Name + '_' + 'ImageList';148 Name := DockSite.Name + '_' + 'ImageList'; 151 149 end; 152 150 PageControl := TPageControl.Create(TCDManager(AManager).DockSite); //FDockSite); 153 151 with PageControl do begin 154 Parent := TCDManager(Manager).DockSite;155 Name := TCDManager(Manager).DockSite.Name + '_' + 'TabControl';152 Parent := Self.DockSite; 153 Name := Self.DockSite.Name + '_' + 'TabControl'; 156 154 Visible := False; 157 155 Align := alTop; … … 160 158 OnChange := TabControlChange; 161 159 MultiLine := True; 162 PopupMenu := TCDManager(Manager).PopupMenu;160 PopupMenu := Self.PopupMenu; 163 161 OnMouseLeave := TabControlMouseLeave; 164 162 OnMouseDown := TabControlMouseDown; … … 174 172 PageControl.Visible := True; 175 173 //TabImageList.Clear; 176 with TCDManager(Manager) do177 174 for I := 0 to DockPanels.Count - 1 do 178 175 Self.InsertControlNoUpdate(TCDClientPanel(DockPanels[I]).Control, alNone); … … 189 186 procedure TCDStyleTabs.Switch(Index: Integer); 190 187 begin 191 inherited Switch(Index);192 188 PageControl.TabIndex := Index; 193 189 end; … … 199 195 begin 200 196 inherited; 201 with TCDManager(Manager) dobegin197 begin 202 198 NewPanel := TCDClientPanel.Create(nil); 203 199 with NewPanel do begin 204 Parent := TCDManager(Manager).DockSite;205 OwnerDockManager := TCDManager(Manager);200 Parent := Self.DockSite; 201 OwnerDockManager := Self; 206 202 if DockStyle = dsList then Visible := True; 207 203 Align := alClient; 208 Header.PopupMenu := TCDManager(Manager).PopupMenu;204 Header.PopupMenu := Self.PopupMenu; 209 205 //PopupMenu.Parent := Self.DockSite; 210 206 end; … … 241 237 end; 242 238 243 procedure TCDStyleTabs.InsertControl(AControl: TControl; InsertAt: TAlign); 239 procedure TCDStyleTabs.InsertControl(AControl: TControl; InsertAt: TAlign; 240 DropCtl: TControl); 244 241 var 245 242 NewTabSheet: TTabSheet; … … 255 252 begin 256 253 inherited UpdateClientSize; 257 with TCDManager(Manager) do258 254 for I := 0 to DockPanels.Count - 1 do begin 259 255 //TCDClientPanel(DockPanels[I]).ClientAreaPanel.Width := DockSite.Width; … … 263 259 end; 264 260 265 procedure TCDStyleTabs.SetVisible(const AValue: Boolean); 266 begin 267 inherited SetVisible(AValue); 268 with TCDManager(Manager) do 261 procedure TCDStyleTabs.DoSetVisible(const AValue: Boolean); 262 begin 269 263 if (PageControl.TabIndex >= 0) and (PageControl.TabIndex < DockPanels.Count) then 270 264 with TCDClientPanel(DockPanels[PageControl.TabIndex]) do begin … … 288 282 //if Assigned(TWinControl(Control).DockManager) then 289 283 //with TCDManager(TWinControl(Control).DockManager) do 290 if Assigned(Manager) then291 with TCDManager(Manager) do292 284 begin 293 285 // ShowMessage(IntToStr(TabControl.TabIndex) + ' ' + IntToStr(DockPanels.Count)); … … 312 304 // if Assigned(TWinControl(Control).DockManager) then 313 305 // with TCDManager(TWinControl(Control).DockManager) do 314 if Assigned(Manager) then315 with TCDManager(Manager) do316 306 begin 317 307 // if Control.Tag = 0 then begin
Note:
See TracChangeset
for help on using the changeset viewer.