Ignore:
Timestamp:
Sep 24, 2010, 7:46:17 AM (14 years ago)
Author:
george
Message:
  • Přidáno: Provázání odkazu na TCoolDockMaster přímo do TCoolDockManager.
  • Opraveno: Nyní funkční odkaz kontextového menu Customize..., který zobrazí patřičné okno.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Docking/CoolDocking/UCoolDocking.pas

    r58 r59  
    2323  TCoolDockCustomize = class;
    2424  TCoolDockClient = class;
     25  TCoolDockMaster = class;
    2526
    2627  { TCoolDockConjoinForm }
     
    8182  TCoolDockManager = class(TDockManager)
    8283  private
     84    FMaster: TCoolDockMaster;
    8385    FMoveDuration: Integer;
    8486    FTabsPos: THeaderPos;
     
    9799    procedure PopupMenuTabCloseClick(Sender: TObject);
    98100    procedure SetDockStyle(const AValue: TDockStyle);
     101    procedure SetMaster(const AValue: TCoolDockMaster);
    99102    procedure SetMoveDuration(const AValue: Integer);
    100103    procedure SetTabsPos(const AValue: THeaderPos);
     
    144147    property MoveDuration: Integer read FMoveDuration write SetMoveDuration;
    145148    property TabsPos: THeaderPos read FTabsPos write SetTabsPos;
     149    property Master: TCoolDockMaster read FMaster write SetMaster;
    146150  end;
    147151
     
    181185  TCoolDockClient = class(TComponent)
    182186  private
     187    FDockable: Boolean;
    183188    FMaster: TCoolDockMaster;
    184189    FPanel: TPanel;
     190    procedure SetDockable(const AValue: Boolean);
    185191    procedure SetMaster(const AValue: TCoolDockMaster);
    186192    constructor Create(AOwner: TComponent); override;
     
    188194    procedure SetPanel(const AValue: TPanel);
    189195  published
     196    property Dockable: Boolean read FDockable
     197      write SetDockable default True;
    190198    property Master: TCoolDockMaster read FMaster
    191199      write SetMaster;
     
    538546    if (not Assigned(FDockSite.Parent)) then begin
    539547      // Create conjointed form
    540       NewConjoinDockForm := TCoolDockConjoinForm.Create(Application);
    541       NewConjoinDockForm.Visible := True;
    542       NewConjoinDockForm.BoundsRect := FDockSite.BoundsRect;
     548      NewConjoinDockForm := CreateContainer(InsertAt);
    543549      FDockSite.ManualDock(NewConjoinDockForm.Panel);
    544550      Control.ManualDock(NewConjoinDockForm.Panel, nil, InsertAt);
    545551    end else begin
    546       NewConjoinDockForm := TCoolDockConjoinForm.Create(Application);
    547       NewConjoinDockForm.Visible := True;
    548       NewConjoinDockForm.BoundsRect := FDockSite.BoundsRect;
    549       NewConjoinDockForm.DragMode := dmAutomatic;
    550       NewConjoinDockForm.DragKind := dkDock;
     552      NewConjoinDockForm := CreateContainer(InsertAt);
    551553      NewDockSite := FDockSite.HostDockSite;
    552554//      FDockSite.ManualFloat(FDockSite.BoundsRect);
     
    664666  NewConjoinDockForm.Visible := True;
    665667  NewConjoinDockForm.BoundsRect := FDockSite.BoundsRect;
    666   NewConjoinDockForm.DragMode := dmAutomatic;
    667   NewConjoinDockForm.DragKind := dkDock;
     668  NewConjoinDockForm.CoolDockClient.Master := Self.Master;
    668669  NewDockSite := FDockSite.HostDockSite;
    669670  //      FDockSite.ManualFloat(FDockSite.BoundsRect);
     
    703704  end;
    704705  UpdateClientSize;
     706end;
     707
     708procedure TCoolDockManager.SetMaster(const AValue: TCoolDockMaster);
     709begin
     710  if FMaster = AValue then Exit;
     711  FMaster := AValue;
    705712end;
    706713
     
    849856procedure TCoolDockManager.PopupMenuCustomizeClick(Sender: TObject);
    850857begin
    851 //  if Assigned(DockMaster.Customize) then
    852 //    DockMaster.Customize.Execute;
     858  if Assigned(Master) and
     859    Assigned(Master.Customize) then
     860    Master.Customize.Execute;
    853861end;
    854862
     
    13071315  if Assigned(FOldMaster) then
    13081316    FOldMaster.UnregisterClient(Self);
    1309   if Assigned(FMaster) then
     1317  if Assigned(FMaster) then begin
    13101318    FMaster.RegisterClient(Self);
     1319    if not (csDesigning in ComponentState) then begin
     1320      if Assigned(TWinControl(Owner).DockManager) then
     1321        TCoolDockManager(TWinControl(Owner).DockManager).Master := FMaster;
     1322      if Assigned(Panel) then
     1323        TCoolDockManager(Panel.DockManager).Master := FMaster;
     1324    end;
     1325  end;
     1326end;
     1327
     1328procedure TCoolDockClient.SetDockable(const AValue: Boolean);
     1329begin
     1330  if FDockable = AValue then Exit;
     1331  FDockable := AValue;
     1332  if not (Owner is TForm) then
     1333  with (Owner as TForm) do
     1334  if AValue then begin
     1335    DragKind := dkDock;
     1336    DragMode := dmAutomatic;
     1337  end else begin
     1338    DragKind := dkDrag;
     1339    DragMode := dmManual;
     1340  end;
    13111341end;
    13121342
     
    13141344begin
    13151345  inherited Create(AOwner);
     1346  FDockable := True;
    13161347  if not (AOwner is TForm) then
    13171348    raise Exception.Create(SWrongOwner);
    13181349  with (AOwner as TForm) do begin
    13191350    if not (csDesigning in ComponentState) then begin
    1320       DragKind := dkDock;
    1321       DragMode := dmAutomatic;
     1351      if Dockable then begin
     1352        DragKind := dkDock;
     1353        DragMode := dmAutomatic;
     1354      end;
    13221355      DockSite := True;
    13231356      UseDockManager := True;
Note: See TracChangeset for help on using the changeset viewer.