Ignore:
Timestamp:
Dec 29, 2010, 1:56:04 PM (14 years ago)
Author:
george
Message:
  • Fixed: Hiding invisible docked forms as tabs.
  • Added: Ability to bring window to front on execute Form.Show.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Docking/CoolDocking/UCoolDockClientPanel.pas

    r98 r103  
    77uses
    88  Classes, Controls, SysUtils, Forms, StdCtrls, ExtCtrls, Graphics,
    9   Buttons, UCoolDockPopupMenu;
     9  Buttons;
    1010
    1111type
     
    3838    FHeaderPos: THeaderPos;
    3939    FShowHeader: Boolean;
     40    FControl: TControl;
    4041    function GetAutoHideEnabled: Boolean;
     42    function GetControl: TControl;
    4143    procedure SetAutoHide(const AValue: Boolean);
    4244    procedure SetAutoHideEnabled(const AValue: Boolean);
     45    procedure SetControl(const AValue: TControl);
    4346    procedure SetHeaderPos(const AValue: THeaderPos);
    4447    procedure SetShowHeader(const AValue: Boolean);
    4548  public
    4649    OwnerDockManager: TObject; // TCoolDockManager;
    47     Control: TControl;
    4850    Splitter: TSplitter;
    4951    ClientAreaPanel: TPanel;
     
    6062      write SetAutoHideEnabled;
    6163    property HeaderPos: THeaderPos read FHeaderPos write SetHeaderPos;
     64    property Control: TControl read GetControl write SetControl;
    6265  end;
    6366
     
    7881procedure TCoolDockClientPanel.VisibleChange(Sender: TObject);
    7982var
    80   Visible: Boolean;
    81 begin
    82   (*if Assigned(Control) then begin
    83     Visible := Control.Visible;
    84     if Assigned(ClientAreaPanel) then
    85       ClientAreaPanel.Visible := Visible;
     83  ControlVisible: Boolean;
     84  Temp: TControl;
     85  Temp2: TControl;
     86begin
     87  Temp := TControl(Sender);
     88  if Assigned(Control) then
     89  begin
     90
     91    ControlVisible := TControl(Sender).Visible;
     92    (*if Assigned(ClientAreaPanel) then
     93      ClientAreaPanel.Visible := ControlVisible;
    8694    if Assigned(Splitter) then
    87       Splitter.Visible := Visible;
    88     OwnerDockManager.UpdateClientSize;
    89   end;*)
     95      Splitter.Visible := ControlVisible;
     96      *)
     97//    if Assigned(TCoolDockManager(OwnerDockManager).DockStyleHandler) then
     98    if Assigned(OwnerDockManager) then
     99    with TCoolDockManager(OwnerDockManager) do
     100    if Assigned(DockStyleHandler) then
     101    with DockStyleHandler do begin
     102      if ControlVisible then
     103        Switch(DockPanels.IndexOf(FindControlInPanels(TControl(Sender))));
     104      //UpdateClientSize;
     105      ChangeVisible(TWinControl(Control), ControlVisible);
     106      // Show parent control
     107      Temp := TControl(Sender).HostDockSite;
     108
     109      if ControlVisible then
     110        TControl(Sender).HostDockSite.Visible := ControlVisible;
     111    end;
     112    if csDestroying in Control.ComponentState then Control := nil;
     113  end;
    90114end;
    91115
     
    100124end;
    101125
     126function TCoolDockClientPanel.GetControl: TControl;
     127begin
     128  Result := FControl;
     129end;
     130
    102131procedure TCoolDockClientPanel.SetAutoHideEnabled(const AValue: Boolean);
    103132begin
    104133
     134end;
     135
     136procedure TCoolDockClientPanel.SetControl(const AValue: TControl);
     137begin
     138  FControl := AValue;
    105139end;
    106140
     
    148182
    149183destructor TCoolDockClientPanel.Destroy;
    150 begin
     184var
     185  Temp: TControl;
     186begin
     187  Temp := Control;
     188  //if ClientAreaPanel.GetControlIndex(Control) <> - 1 then
     189  if Assigned(Control) then
     190    Control.RemoveHandlerOnVisibleChanged(VisibleChange);
     191  // If panel is destroyed undock docket control
     192  //TWinControl(Control).ManualFloat(TWinControl(Control).BoundsRect);
     193
    151194  inherited Destroy;
    152195end;
     
    154197procedure TCoolDockClientPanel.ResizeExecute(Sender: TObject);
    155198begin
    156   Control.Top := GrabberSize;
    157   Control.Left := 0;
    158   Control.Width := Width;
    159   Control.Height := Height - GrabberSize;
    160   //Control.SetBounds(0, GrabberSize, Width - Control.Left,
    161   //  Height - Control.Top);
     199  if Assigned(Control) then begin
     200    Control.Top := GrabberSize;
     201    Control.Left := 0;
     202    Control.Width := Width;
     203    Control.Height := Height - GrabberSize;
     204    //Control.SetBounds(0, GrabberSize, Width - Control.Left,
     205    //  Height - Control.Top);
     206  end;
    162207end;
    163208
Note: See TracChangeset for help on using the changeset viewer.