Changeset 98 for Docking/CoolDocking/UCoolDocking.pas
- Timestamp:
- Dec 9, 2010, 2:51:55 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Docking/CoolDocking/UCoolDocking.pas
r97 r98 12 12 UCoolDockCustomize, DOM, XMLWrite, XMLRead, UCoolDockWindowList, 13 13 DateUtils, UCoolDockStyleTabs, UCoolDockStyleRegions, UCoolDockStylePopupTabs, 14 UCoolDockStylePopupRegions, UCoolDockStyle, UCoolDockClientPanel; 14 UCoolDockStylePopupRegions, UCoolDockStyle, UCoolDockClientPanel, 15 UCoolDockPopupMenu; 15 16 16 17 const … … 42 43 FMaster: TCoolDockMaster; 43 44 DockStyleHandler: TCoolDockStyle; 44 PopupMenuHeader: TPopupMenu;45 45 FDockStyle: TDockStyle; 46 46 FDockDirection: TDockDirection; … … 56 56 procedure SetMoveDuration(const AValue: Integer); 57 57 procedure UpdateClientSize; 58 procedure PopupMenuListClick(Sender: TObject);59 procedure PopupMenuTabsClick(Sender: TObject);60 procedure PopupMenuCloseClick(Sender: TObject);61 procedure PopupMenuRenameClick(Sender: TObject);62 procedure PopupMenuPositionAutoClick(Sender: TObject);63 procedure PopupMenuPositionLeftClick(Sender: TObject);64 procedure PopupMenuPositionRightClick(Sender: TObject);65 procedure PopupMenuPositionTopClick(Sender: TObject);66 procedure PopupMenuPositionBottomClick(Sender: TObject);67 procedure PopupMenuUndockClick(Sender: TObject);68 procedure PopupMenuCustomizeClick(Sender: TObject);69 58 public 59 PopupMenu: TCoolDockPopupMenu; 70 60 constructor Create(ADockSite: TWinControl); override; 71 61 destructor Destroy; override; … … 192 182 193 183 resourcestring 194 SDockStyle = 'Style';195 SDockList = 'List';196 SDockTabs = 'Tabs';197 SCloseForm = 'Close';198 SRenameForm = 'Rename';199 SPosition = 'Position';200 SPositionAuto = 'Auto';201 SPositionTop = 'Top';202 SPositionLeft = 'Left';203 SPositionRight = 'Right';204 SPositionBottom = 'Bottom';205 SUndock = 'Undock';206 SCustomize = 'Customize...';207 184 SWrongOwner = 'Owner of TCoolDockClient have to be TForm'; 208 SEnterNewWindowName = 'Enter new window name';209 SRenameWindow = 'Rename window';210 211 185 212 186 implementation … … 256 230 FDockStyle := dsTabs; // To initialize style value have to be different 257 231 DockStyle := dsList; 258 259 (* // Tabs popup 260 261 PopupMenuTabs := TPopupMenu.Create(FDockSite); 262 PopupMenuTabs.Name := ADockSite.Name + '_' + 'PopupMenuTabs'; 263 264 NewMenuItem := TMenuItem.Create(PopupMenuTabs); 265 NewMenuItem.Caption := SDockStyle; 266 PopupMenuTabs.Items.Add(NewMenuItem); 267 268 NewMenuItem2 := TMenuItem.Create(NewMenuItem); 269 NewMenuItem2.Caption := SDockList; 270 NewMenuItem2.OnClick := PopupMenuListClick; 271 NewMenuItem.Add(NewMenuItem2); 272 273 NewMenuItem2 := TMenuItem.Create(NewMenuItem); 274 NewMenuItem2.Caption := SDockTabs; 275 NewMenuItem2.OnClick := PopupMenuTabsClick; 276 NewMenuItem.Add(NewMenuItem2); 277 278 NewMenuItem := TMenuItem.Create(PopupMenuTabs); 279 NewMenuItem.Caption := SPosition; 280 PopupMenuTabs.Items.Add(NewMenuItem); 281 282 NewMenuItem2 := TMenuItem.Create(NewMenuItem); 283 NewMenuItem2.Caption := SPositionAuto; 284 NewMenuItem2.OnClick := PopupMenuPositionAutoClick; 285 NewMenuItem.Add(NewMenuItem2); 286 287 NewMenuItem2 := TMenuItem.Create(NewMenuItem); 288 NewMenuItem2.Caption := SPositionTop; 289 NewMenuItem2.OnClick := PopupMenuPositionTopClick; 290 NewMenuItem.Add(NewMenuItem2); 291 292 NewMenuItem2 := TMenuItem.Create(NewMenuItem); 293 NewMenuItem2.Caption := SPositionLeft; 294 NewMenuItem2.OnClick := PopupMenuPositionLeftClick; 295 NewMenuItem.Add(NewMenuItem2); 296 297 NewMenuItem2 := TMenuItem.Create(NewMenuItem); 298 NewMenuItem2.Caption := SPositionBottom; 299 NewMenuItem2.OnClick := PopupMenuPositionBottomClick; 300 NewMenuItem.Add(NewMenuItem2); 301 302 NewMenuItem2 := TMenuItem.Create(NewMenuItem); 303 NewMenuItem2.Caption := SPositionRight; 304 NewMenuItem2.OnClick := PopupMenuPositionRightClick; 305 NewMenuItem.Add(NewMenuItem2); 306 307 NewMenuItem := TMenuItem.Create(PopupMenuTabs); 308 NewMenuItem.Caption := SCloseForm; 309 NewMenuItem.OnClick := PopupMenuCloseClick; 310 PopupMenuTabs.Items.Add(NewMenuItem); 311 312 NewMenuItem := TMenuItem.Create(PopupMenuTabs); 313 NewMenuItem.Caption := SRenameForm; 314 NewMenuItem.OnClick := PopupMenuRenameClick; 315 PopupMenuTabs.Items.Add(NewMenuItem); 316 317 NewMenuItem := TMenuItem.Create(PopupMenuTabs); 318 NewMenuItem.Caption := SUndock; 319 NewMenuItem.OnClick := PopupMenuUndockClick; 320 PopupMenuTabs.Items.Add(NewMenuItem); 321 322 NewMenuItem := TMenuItem.Create(PopupMenuTabs); 323 NewMenuItem.Caption := SCustomize; 324 NewMenuItem.OnClick := PopupMenuCustomizeClick; 325 PopupMenuTabs.Items.Add(NewMenuItem); 326 327 // Header popup 328 329 PopupMenuHeader := TPopupMenu.Create(FDockSite); 330 PopupMenuHeader.Name := ADockSite.Name + '_' + 'PopupMenuHeader'; 331 332 NewMenuItem := TMenuItem.Create(PopupMenuHeader); 333 NewMenuItem.Caption := SDockStyle; 334 PopupMenuHeader.Items.Add(NewMenuItem); 335 336 NewMenuItem2 := TMenuItem.Create(NewMenuItem); 337 NewMenuItem2.Caption := SDockList; 338 NewMenuItem2.OnClick := PopupMenuListClick; 339 NewMenuItem.Add(NewMenuItem2); 340 341 NewMenuItem2 := TMenuItem.Create(NewMenuItem); 342 NewMenuItem2.Caption := SDockTabs; 343 NewMenuItem2.OnClick := PopupMenuTabsClick; 344 NewMenuItem.Add(NewMenuItem2); 345 346 NewMenuItem := TMenuItem.Create(PopupMenuHeader); 347 NewMenuItem.Caption := SPosition; 348 PopupMenuHeader.Items.Add(NewMenuItem); 349 350 NewMenuItem2 := TMenuItem.Create(NewMenuItem); 351 NewMenuItem2.Caption := SPositionAuto; 352 NewMenuItem2.OnClick := PopupMenuPositionAutoClick; 353 NewMenuItem.Add(NewMenuItem2); 354 355 NewMenuItem2 := TMenuItem.Create(NewMenuItem); 356 NewMenuItem2.Caption := SPositionTop; 357 NewMenuItem2.OnClick := PopupMenuPositionTopClick; 358 NewMenuItem.Add(NewMenuItem2); 359 360 NewMenuItem2 := TMenuItem.Create(NewMenuItem); 361 NewMenuItem2.Caption := SPositionLeft; 362 NewMenuItem2.OnClick := PopupMenuPositionLeftClick; 363 NewMenuItem.Add(NewMenuItem2); 364 365 NewMenuItem2 := TMenuItem.Create(NewMenuItem); 366 NewMenuItem2.Caption := SPositionBottom; 367 NewMenuItem2.OnClick := PopupMenuPositionBottomClick; 368 NewMenuItem.Add(NewMenuItem2); 369 370 NewMenuItem2 := TMenuItem.Create(NewMenuItem); 371 NewMenuItem2.Caption := SPositionRight; 372 NewMenuItem2.OnClick := PopupMenuPositionRightClick; 373 NewMenuItem.Add(NewMenuItem2); 374 375 NewMenuItem := TMenuItem.Create(PopupMenuHeader); 376 NewMenuItem.Caption := SCloseForm; 377 NewMenuItem.OnClick := PopupMenuCloseClick; 378 PopupMenuHeader.Items.Add(NewMenuItem); 379 380 NewMenuItem := TMenuItem.Create(PopupMenuHeader); 381 NewMenuItem.Caption := SRenameForm; 382 NewMenuItem.OnClick := PopupMenuRenameClick; 383 PopupMenuHeader.Items.Add(NewMenuItem); 384 385 NewMenuItem := TMenuItem.Create(PopupMenuHeader); 386 NewMenuItem.Caption := SUndock; 387 NewMenuItem.OnClick := PopupMenuUndockClick; 388 PopupMenuHeader.Items.Add(NewMenuItem); 389 390 NewMenuItem := TMenuItem.Create(PopupMenuHeader); 391 NewMenuItem.Caption := SCustomize; 392 NewMenuItem.OnClick := PopupMenuCustomizeClick; 393 PopupMenuHeader.Items.Add(NewMenuItem); 394 *) 232 PopupMenu := TCoolDockPopupMenu.Create(Self); 395 233 end; 396 234 397 235 destructor TCoolDockManager.Destroy; 398 236 begin 237 PopupMenu.Free; 399 238 FDockPanels.Free; 239 DockStyleHandler.Free; 400 240 inherited Destroy; 401 241 end; … … 469 309 if DockStyle = dsList then Visible := True; 470 310 Align := alClient; 471 Header.PopupMenu := PopupMenu Header;311 Header.PopupMenu := PopupMenu; 472 312 end; 473 313 if (Control is TForm) and Assigned((Control as TForm).Icon) then … … 515 355 516 356 // FDockPanel.Invalidate; 517 inherited;357 //inherited; 518 358 end; 519 359 … … 574 414 ClientPanel: TCoolDockClientPanel; 575 415 begin 576 inherited;416 //inherited; 577 417 if Control.HostDockSite = Self.FDockSite then begin 578 418 ClientPanel := FindControlInPanels(Control); … … 663 503 end; 664 504 665 procedure TCoolDockManager.PopupMenuTabsClick(Sender: TObject);666 begin667 DockStyle := dsTabs;668 end;669 670 procedure TCoolDockManager.PopupMenuCloseClick(Sender: TObject);671 var672 Control: TControl;673 begin674 Control := FindLCLControl(Mouse.CursorPos);675 if Assigned(Control) then676 ShowMessage(Control.ClassName);677 // DockSiteTForm(TCoolDockManager(TControl(Sender).Parent.Parent.Parent.DockManager).FDockSite).Close;678 end;679 680 procedure TCoolDockManager.PopupMenuRenameClick(Sender: TObject);681 var682 Value: string;683 begin684 Value := DockSite.Parent.Caption;685 if InputQuery(SRenameWindow, SEnterNewWindowName, False, Value) then686 DockSite.Parent.Caption := Value;687 end;688 689 procedure TCoolDockManager.PopupMenuPositionAutoClick(Sender: TObject);690 begin691 //TabsPos := hpAuto;692 end;693 694 procedure TCoolDockManager.PopupMenuPositionLeftClick(Sender: TObject);695 begin696 //TabsPos := hpLeft;697 end;698 699 procedure TCoolDockManager.PopupMenuPositionRightClick(Sender: TObject);700 begin701 //TabsPos := hpRight;702 end;703 704 procedure TCoolDockManager.PopupMenuPositionTopClick(Sender: TObject);705 begin706 //TabsPos := hpTop;707 end;708 709 procedure TCoolDockManager.PopupMenuPositionBottomClick(Sender: TObject);710 begin711 //TabsPos := hpBottom;712 end;713 714 procedure TCoolDockManager.PopupMenuUndockClick(Sender: TObject);715 var716 Control: TControl;717 begin718 719 //Control.ManualFloat(Control.BoundsRect);720 end;721 722 procedure TCoolDockManager.PopupMenuCustomizeClick(Sender: TObject);723 begin724 if Assigned(Master) and725 Assigned(Master.Customize) then726 Master.Customize.Execute;727 end;728 729 procedure TCoolDockManager.PopupMenuListClick(Sender: TObject);730 begin731 DockStyle := dsList;732 end;733 734 735 505 { TCoolDockConjoinForm } 736 506
Note:
See TracChangeset
for help on using the changeset viewer.