- Timestamp:
- Mar 7, 2011, 4:16:02 PM (14 years ago)
- Location:
- Docking/CoolDocking
- Files:
-
- 28 added
- 12 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
Docking/CoolDocking/UCoolDockClientPanel.pas
r103 r177 100 100 if Assigned(DockStyleHandler) then 101 101 with DockStyleHandler do begin 102 //UpdateClientSize; 102 103 if ControlVisible then 103 104 Switch(DockPanels.IndexOf(FindControlInPanels(TControl(Sender)))); 104 //UpdateClientSize; 105 if not (Control is TWinControl) then raise Exception.Create('Not TWinControl'); 106 if not Assigned(Control) then raise Exception.Create('Control not assigned'); 105 107 ChangeVisible(TWinControl(Control), ControlVisible); 106 108 // Show parent control -
Docking/CoolDocking/UCoolDockPopupMenu.pas
r176 r177 163 163 Control: TControl; 164 164 begin 165 if PopupComponent is T TabControl then166 with T TabControl(PopupComponent) do begin165 if PopupComponent is TPageControl then 166 with TPageControl(PopupComponent) do begin 167 167 TForm(TCoolDockClientPanel(TCoolDockManager(Manager).DockPanels[TabIndex]).Control).Close; 168 168 end; … … 178 178 begin 179 179 //ShowMessage(PopupComponent.ClassName); 180 if PopupComponent is T TabControl then181 with T TabControl(PopupComponent) do begin180 if PopupComponent is TPageControl then 181 with TPageControl(PopupComponent) do begin 182 182 Value := TCoolDockClientPanel(TCoolDockManager(Manager).DockPanels[TabIndex]).Control.Caption; 183 183 if InputQuery(SRenameWindow, SEnterNewWindowName, False, Value) then begin 184 184 TCoolDockClientPanel(TCoolDockManager(Manager).DockPanels[TabIndex]).Control.Caption := Value; 185 Tabs[TabIndex]:= Value;185 Pages[TabIndex].Caption := Value; 186 186 end; 187 187 end; … … 228 228 Control: TControl; 229 229 begin 230 231 //Control.ManualFloat(Control.BoundsRect); 230 if PopupComponent is TPageControl then 231 with TPageControl(PopupComponent) do begin 232 Control := TCoolDockClientPanel(TCoolDockManager(Manager).DockPanels[TabIndex]).Control; 233 end else 234 if PopupComponent is TCoolDockHeader then 235 with TCoolDockHeader(PopupComponent) do begin 236 Control := ParentClientPanel.Control; 237 end else Control := nil; 238 if Assigned(Control) then 239 Control.ManualFloat(Control.BoundsRect); 232 240 end; 233 241 -
Docking/CoolDocking/UCoolDockStyleTabs.pas
r176 r177 17 17 MouseButton: TMouseButton; 18 18 MouseDownSkip: Boolean; 19 TabControl: TTabControl;19 PageControl: TPageControl; 20 20 TabImageList: TImageList; 21 21 procedure TabControlMouseLeave(Sender: TObject); … … 30 30 private 31 31 FTabsPos: THeaderPos; 32 procedure InsertControlNoUpdate(NewPanel: TCoolDockClientPanel; 33 AControl: TControl; InsertAt: TAlign); 32 34 public 33 35 constructor Create(AManager: TObject); … … 50 52 procedure TCoolDockStyleTabs.PopupMenuTabCloseClick(Sender: TObject); 51 53 begin 52 if TabControl.TabIndex <> -1then53 TCoolDockClientPanel(TCoolDockManager(Manager).DockPanels[ TabControl.TabIndex]).Control.Hide;54 if Assigned(PageControl.ActivePage) then 55 TCoolDockClientPanel(TCoolDockManager(Manager).DockPanels[PageControl.TabIndex]).Control.Hide; 54 56 end; 55 57 … … 58 60 if MouseDown then 59 61 with TCoolDockManager(Manager) do 60 if (TabControl.TabIndex <> -1) then begin61 TCoolDockClientPanel(DockPanels[ TabControl.TabIndex]).ClientAreaPanel.DockSite := False;62 DragManager.DragStart(TCoolDockClientPanel(DockPanels[ TabControl.TabIndex]).Control, False, 1);62 if Assigned(PageControl.ActivePage) then begin 63 TCoolDockClientPanel(DockPanels[PageControl.TabIndex]).ClientAreaPanel.DockSite := False; 64 DragManager.DragStart(TCoolDockClientPanel(DockPanels[PageControl.TabIndex]).Control, False, 1); 63 65 end; 64 66 MouseDown := False; … … 72 74 with TCoolDockManager(Manager) do 73 75 for I := 0 to DockPanels.Count - 1 do 74 if TCoolDockClientPanel(DockPanels[I]).Control.Visible then begin 76 if TCoolDockClientPanel(DockPanels[I]).Control.Visible 77 //and (PageControl.TabIndex <> I) 78 then 79 begin 75 80 TCoolDockClientPanel(DockPanels[I]).Control.Tag := 1; 76 81 TCoolDockClientPanel(DockPanels[I]).Control.Hide; 77 82 TCoolDockClientPanel(DockPanels[I]).ClientAreaPanel.Hide; 78 TCoolDockClientPanel(DockPanels[I]).ClientAreaPanel.Parent := DockSite; 83 TCoolDockClientPanel(DockPanels[I]).ClientAreaPanel.Parent := PageControl.Pages[I]; 84 //TCoolDockClientPanel(DockPanels[I]).ClientAreaPanel.Parent := DockSite; 79 85 TCoolDockClientPanel(DockPanels[I]).Control.Align := alClient; 86 //TCoolDockClientPanel(DockPanels[I]).Control.Parent := 87 // TCoolDockClientPanel(DockPanels[I]).ClientAreaPanel; 80 88 //ShowMessage(TCoolDockClientPanel(DockPanels[I]).Control.ClassName); 81 89 Application.ProcessMessages; … … 87 95 // Show selected 88 96 with TCoolDockManager(Manager) do 89 if (TabControl.TabIndex <> -1) and (DockPanels.Count > TabControl.TabIndex) then begin 90 with TCoolDockClientPanel(DockPanels[TabControl.TabIndex]), ClientAreaPanel do begin 97 if (PageControl.TabIndex <> -1) and (DockPanels.Count > PageControl.TabIndex) 98 // and not TCoolDockClientPanel(DockPanels[PageControl.TabIndex]).Control.Visible 99 then begin 100 with TCoolDockClientPanel(DockPanels[PageControl.TabIndex]), ClientAreaPanel do begin 91 101 Control.Show; 92 Control.Tag := 0;93 102 (*AutoHide.Enable := True; 94 103 if AutoHide.Enable then begin … … 134 143 NewMenuItem2: TMenuItem; 135 144 I: Integer; 145 NewTabSheet: TTabSheet; 136 146 begin 137 147 inherited; … … 141 151 Name := TCoolDockManager(Manager).DockSite.Name + '_' + 'ImageList'; 142 152 end; 143 TabControl := TTabControl.Create(TCoolDockManager(AManager).DockSite); //FDockSite);144 with TabControl do begin153 PageControl := TPageControl.Create(TCoolDockManager(AManager).DockSite); //FDockSite); 154 with PageControl do begin 145 155 Parent := TCoolDockManager(Manager).DockSite; 146 156 Name := TCoolDockManager(Manager).DockSite.Name + '_' + 'TabControl'; 147 157 Visible := False; 148 158 Align := alTop; 149 Height := 24; 159 //Height := 24; 160 Align := alClient; 150 161 OnChange := TabControlChange; 162 MultiLine := True; 151 163 PopupMenu := TCoolDockManager(Manager).PopupMenu; 152 164 //TTabControlNoteBookStrings(Tabs).NoteBook.OnMouseLeave := TabControlMouseLeave; … … 159 171 //MoveDuration := 1000; // ms 160 172 161 TabControl.Visible := True; 162 TabControl.Tabs.Clear; 163 TabImageList.Clear; 173 PageControl.Visible := True; 174 //TabImageList.Clear; 164 175 with TCoolDockManager(Manager) do 165 176 for I := 0 to DockPanels.Count - 1 do 166 if TCoolDockClientPanel(DockPanels[I]).Control.Visible then begin 167 TCoolDockClientPanel(DockPanels[I]).Control.Tag := 1; 168 TabControl.Tabs.Add(TCoolDockClientPanel(DockPanels[I]).Control.Caption); 169 TabImageList.Add(TCoolDockClientPanel(DockPanels[I]).Header.Icon.Picture.Bitmap, nil); 170 if Assigned(TCoolDockClientPanel(DockPanels[I]).Splitter) then 171 TCoolDockClientPanel(DockPanels[I]).Splitter.Visible := False; 172 TCoolDockClientPanel(DockPanels[I]).ClientAreaPanel.Visible := False; 173 TCoolDockClientPanel(DockPanels[I]).Visible := False; 174 end; 177 Self.InsertControlNoUpdate(TCoolDockClientPanel(DockPanels[I]), 178 TCoolDockClientPanel(DockPanels[I]).Control, alNone); 179 TabControlChange(Self); 175 180 end; 176 181 177 182 destructor TCoolDockStyleTabs.Destroy; 178 183 begin 179 TabControl.Free;184 PageControl.Free; 180 185 TabImageList.Free; 181 186 inherited Destroy; … … 185 190 begin 186 191 inherited Switch(Index); 187 TabControl.TabIndex := Index;188 end; 189 190 procedure TCoolDockStyleTabs.InsertControl (NewPanel: TCoolDockClientPanel;192 PageControl.TabIndex := Index; 193 end; 194 195 procedure TCoolDockStyleTabs.InsertControlNoUpdate(NewPanel: TCoolDockClientPanel; 191 196 AControl: TControl; InsertAt: TAlign); 197 var 198 NewTabSheet: TTabSheet; 192 199 begin 193 200 inherited; 194 201 if AControl.Visible then begin 195 AControl.Tag := 1; 196 TabControl.Tabs.Add(AControl.Caption); 202 NewTabSheet := TTabSheet.Create(PageControl); 203 NewTabSheet.PageControl := PageControl; 204 NewTabSheet.Caption := AControl.Caption; 205 NewTabSheet.ImageIndex := TabImageList.Count; 197 206 TabImageList.Add(NewPanel.Header.Icon.Picture.Bitmap, nil); 198 207 if Assigned(NewPanel.Splitter) then … … 200 209 NewPanel.ClientAreaPanel.Visible := False; 201 210 NewPanel.Visible := False; 202 TabControlChange(Self); 203 end; 211 //NewPanel.Parent := NewTabSheet; 212 end; 213 end; 214 215 procedure TCoolDockStyleTabs.InsertControl(NewPanel: TCoolDockClientPanel; 216 AControl: TControl; InsertAt: TAlign); 217 var 218 NewTabSheet: TTabSheet; 219 begin 220 inherited; 221 InsertControlNoUpdate(NewPanel, AControl, InsertAt); 222 TabControlChange(Self); 204 223 end; 205 224 … … 211 230 with TCoolDockManager(Manager) do 212 231 for I := 0 to DockPanels.Count - 1 do begin 213 TCoolDockClientPanel(DockPanels[I]).ClientAreaPanel.Width := DockSite.Width;214 TCoolDockClientPanel(DockPanels[I]).ClientAreaPanel.Height := DockSite.Height - TabControl.Height;232 //TCoolDockClientPanel(DockPanels[I]).ClientAreaPanel.Width := DockSite.Width; 233 //TCoolDockClientPanel(DockPanels[I]).ClientAreaPanel.Height := DockSite.Height - PageControl.Height; 215 234 //TCoolDockClientPanel(FDockPanels[I]).DockPanelPaint(Self); 216 235 end; … … 221 240 inherited SetVisible(AValue); 222 241 with TCoolDockManager(Manager) do 223 if ( TabControl.TabIndex >= 0) and (TabControl.TabIndex < DockPanels.Count) then224 with TCoolDockClientPanel(DockPanels[ TabControl.TabIndex]) do begin242 if (PageControl.TabIndex >= 0) and (PageControl.TabIndex < DockPanels.Count) then 243 with TCoolDockClientPanel(DockPanels[PageControl.TabIndex]) do begin 225 244 //Show; 226 if AValue and (not Control.Visible) and (Control.Tag = 1) then begin245 if AValue and (not Control.Visible) and (Control.Tag = 1) then begin 227 246 Control.Show; 228 247 Control.Tag := 0; … … 239 258 inherited; 240 259 if not Visible then begin 241 if Assigned(TWinControl(Control).DockManager) then 242 with TCoolDockManager(TWinControl(Control).DockManager) do begin 260 //if Assigned(TWinControl(Control).DockManager) then 261 //with TCoolDockManager(TWinControl(Control).DockManager) do 262 if Assigned(Manager) then 263 with TCoolDockManager(Manager) do 264 begin 243 265 // ShowMessage(IntToStr(TabControl.TabIndex) + ' ' + IntToStr(DockPanels.Count)); 244 266 // TabControl.Tabs[0].; … … 248 270 // end; 249 271 // ShowMessage(IntToStr(DockPanels.Count)); 250 if Control.Tag = 0 then begin 251 TabImageList.Delete(TabControl.Tabs.IndexOf(Control.Caption)); 252 253 with TabControl.Tabs do 254 Delete(IndexOf(Control.Caption)); 255 end; 272 //TabImageList.Delete(PageControl.Tabs.IndexOf(Control.Caption)); 273 274 I := DockPanels.IndexOf(FindControlInPanels(Control)); 275 if Control.Tag = 0 then 276 if I <> -1 then 277 // Control.Hide; 278 PageControl.Page[I].TabVisible := False; 279 Control.Tag := 0; 280 // end; 256 281 end; 257 282 end else 258 283 begin 259 if Control.Tag = 0 then begin 260 TabImageList.Add(TCoolDockClientPanel(TCoolDockManager(Manager).FindControlInPanels(Control)).Header.Icon.Picture.Bitmap, nil); 261 TabControl.Tabs.Add(Control.Caption); 284 // if Assigned(TWinControl(Control).DockManager) then 285 // with TCoolDockManager(TWinControl(Control).DockManager) do 286 if Assigned(Manager) then 287 with TCoolDockManager(Manager) do 288 begin 289 // if Control.Tag = 0 then begin 290 I := DockPanels.IndexOf(FindControlInPanels(Control)); 291 //if then 292 if I <> -1 then 293 PageControl.Page[I].TabVisible := True; 294 // TabImageList.Add(TCoolDockClientPanel(TCoolDockManager(Manager).FindControlInPanels(Control)).Header.Icon.Picture.Bitmap, nil); 295 // TabControl.Tabs.Add(Control.Caption); 296 297 // end; 262 298 end; 263 299 end; … … 268 304 if FTabsPos = AValue then Exit; 269 305 FTabsPos := AValue; 270 with TabControl do306 with PageControl do 271 307 case AValue of 272 308 hpAuto, hpTop: begin -
Docking/CoolDocking/UCoolDocking.pas
r114 r177 507 507 if FDockStyle <> AValue then begin 508 508 FDockStyle := AValue; 509 DockStyleHandler.Free;509 FreeAndNil(DockStyleHandler); 510 510 if AValue = dsTabs then begin 511 511 DockStyleHandler := TCoolDockStyleTabs.Create(Self);
Note:
See TracChangeset
for help on using the changeset viewer.