Ignore:
Timestamp:
Sep 29, 2010, 9:14:55 AM (14 years ago)
Author:
george
Message:
  • Opraveno: Obsluha událostí OnShow a OnHide.
  • Opraveno: Zamezení ukotvení okna do sebe.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Docking/CoolDocking/UCoolDocking.pas

    r60 r61  
    1010  Classes, SysUtils, Controls, LCLType, LMessages, Graphics, StdCtrls,
    1111  Buttons, ExtCtrls, Contnrs, Forms, ComCtrls, Dialogs, Menus, FileUtil,
    12   UCoolDockCustomize, DOM, XMLWrite, XMLRead, UCoolDockWindowList;
     12  UCoolDockCustomize, DOM, XMLWrite, XMLRead, UCoolDockWindowList,
     13  DateUtils;
    1314
    1415const
     
    3839
    3940  TCoolDockHeader = class(TPanel)
     41  private
     42    procedure CloseButtonClick(Sender: TObject);
     43    procedure DrawGrabber(Canvas: TCanvas; AControl: TControl);
     44  public
    4045    CloseButton: TSpeedButton;
    4146    Title: TLabel;
     
    4550    constructor Create(TheOwner: TComponent); override;
    4651    destructor Destroy; override;
    47   private
    48     procedure CloseButtonClick(Sender: TObject);
    49     procedure DrawGrabber(Canvas: TCanvas; AControl: TControl);
    5052  end;
    5153
     
    158160    FCoolDockCustomize: TCoolDockCustomize;
    159161    FDefaultHeaderPos: THeaderPos;
     162    FDefaultTabsPos: THeaderPos;
    160163    FShowIcons: Boolean;
    161164    FTabsEnabled: Boolean;
     
    177180  published
    178181    property TabsEnabled: Boolean read FTabsEnabled write SetTabsEnabled;
     182    property DefaultTabsPos: THeaderPos read FDefaultTabsPos
     183      write FDefaultTabsPos;
    179184    property DefaultHeaderPos: THeaderPos read FDefaultHeaderPos
    180185      write FDefaultHeaderPos;
     
    194199    procedure SetFloatable(const AValue: Boolean);
    195200    procedure SetMaster(const AValue: TCoolDockMaster);
     201    procedure SetPanel(const AValue: TPanel);
     202  public
    196203    constructor Create(AOwner: TComponent); override;
    197204    destructor Destroy; override;
    198     procedure SetPanel(const AValue: TPanel);
    199205  published
    200206    property Dockable: Boolean read FDockable
     
    716722      TCoolDockClientPanel(FDockPanels[I]).ClientAreaPanel.Parent := TCoolDockClientPanel(FDockPanels[I]);
    717723      TCoolDockClientPanel(FDockPanels[I]).ClientAreaPanel.Visible := True;
     724      TCoolDockClientPanel(FDockPanels[I]).Control.Visible := True;
    718725    end;
    719726  end;
     
    725732  if FMaster = AValue then Exit;
    726733  FMaster := AValue;
     734  TabsPos := AValue.DefaultTabsPos;
    727735end;
    728736
     
    792800  for I := 0 to FDockPanels.Count - 1 do begin
    793801    TCoolDockClientPanel(FDockPanels[I]).ClientAreaPanel.Visible := False;
     802    TCoolDockClientPanel(FDockPanels[I]).Control.Visible := False;
    794803  end;
    795804  if (TabControl.TabIndex <> -1) and (FDockPanels.Count > TabControl.TabIndex) then begin
    796805    with TCoolDockClientPanel(FDockPanels[TabControl.TabIndex]), ClientAreaPanel do begin
     806      Control.Show;
    797807      if AutoHide then begin
    798808        Parent := nil;
     
    892902begin
    893903  if (Button = mbLeft) and (TabControl.TabIndex <> -1) then begin
     904    TCoolDockClientPanel(FDockPanels[TabControl.TabIndex]).ClientAreaPanel.DockSite := False;
    894905    DragManager.DragStart(TCoolDockClientPanel(FDockPanels[TabControl.TabIndex]).Control, False, 1);
    895906  end;
     
    911922
    912923procedure TCoolDockClientPanel.VisibleChange(Sender: TObject);
    913 begin
    914   if Assigned(Control) then begin
     924var
     925  Visible: Boolean;
     926begin
     927  (*if Assigned(Control) then begin
     928    Visible := Control.Visible;
    915929    if Assigned(ClientAreaPanel) then
    916       ClientAreaPanel.Visible := Control.Visible;
     930      ClientAreaPanel.Visible := Visible;
    917931    if Assigned(Splitter) then
    918       Splitter.Visible := Control.Visible;
     932      Splitter.Visible := Visible;
    919933    OwnerDockManager.UpdateClientSize;
    920   end;
     934  end;*)
    921935end;
    922936
     
    936950begin
    937951  inherited;
     952  ShowHeader := True;
    938953  Header := TCoolDockHeader.Create(Self);
    939954  with Header do begin
     
    964979  BevelInner := bvNone;
    965980  BevelOuter := bvNone;
    966   ShowHeader := True;
    967981  AutoHide := False;
    968982  HeaderPos := hpTop;
     
    9891003  R: TRect;
    9901004begin
     1005  if (csDestroyingHandle in ControlState) then
    9911006  if Assigned(Control) then begin
    9921007    R := Control.ClientRect;
     
    10091024  end;
    10101025  if (Button = mbLeft) then begin
    1011     DragManager.DragStart(Control, False, 1);
     1026    //(Control as TWinControl).DockSite := False;
     1027    ClientAreaPanel.DockSite := False;
     1028    (Control as TWinControl).BeginDrag(True);
     1029    //DragManager.DragStart(Control, False, 1);
    10121030  end;
    10131031end;
     
    11791197
    11801198destructor TCoolDockMaster.Destroy;
    1181 begin
     1199var
     1200  I: Integer;
     1201begin
     1202  // Assigning nil to Client Master property cause unregistring client from list
     1203  for I := FClients.Count - 1 downto 0 do
     1204    TCoolDockClient(FClients[I]).Master := nil;
    11821205  FClients.Free;
    11831206  Customize := nil;
     
    11881211begin
    11891212  if Assigned(Client) then
    1190     if FClients.IndexOf(Client) <> -1 then begin
     1213    if FClients.IndexOf(Client) = -1 then begin
    11911214      FClients.Add(Client);
    11921215      Client.Master := Self;
     
    13571380    DragKind := dkDock;
    13581381    DragMode := dmAutomatic;
     1382    DockSite := True;
    13591383  end else begin
    13601384    DragKind := dkDrag;
    13611385    DragMode := dmManual;
     1386    DockSite := False;
    13621387  end;
    13631388end;
     
    13801405        DragKind := dkDock;
    13811406        DragMode := dmAutomatic;
     1407        DockSite := True;
    13821408      end;
    1383       DockSite := True;
    13841409      UseDockManager := True;
    13851410      DockManager := TCoolDockManager.Create(TWinControl(AOwner));
Note: See TracChangeset for help on using the changeset viewer.