Changeset 89 for Docking


Ignore:
Timestamp:
Nov 4, 2010, 7:14:07 AM (14 years ago)
Author:
george
Message:
  • Modified: Tabs auto hide function moved to separated class TCoolDockAutoHide.
  • Added: Empty dock style units.
Location:
Docking/CoolDocking
Files:
4 added
7 edited

Legend:

Unmodified
Added
Removed
  • Docking/CoolDocking/CoolDocking.lpk

    r57 r89  
    2525    <Description Value="Set of components for docking of windows."/>
    2626    <Version Major="1"/>
    27     <Files Count="4">
     27    <Files Count="8">
    2828      <Item1>
    2929        <Filename Value="UCoolDocking.pas"/>
     
    4343        <UnitName Value="UCoolDockWindowList"/>
    4444      </Item4>
     45      <Item5>
     46        <Filename Value="UCoolDockStyleTabs.pas"/>
     47        <UnitName Value="UCoolDockStyleTabs"/>
     48      </Item5>
     49      <Item6>
     50        <Filename Value="UCoolDockStyleRegions.pas"/>
     51        <UnitName Value="UCoolDockStyleRegions"/>
     52      </Item6>
     53      <Item7>
     54        <Filename Value="UCoolDockStylePopupTabs.pas"/>
     55        <UnitName Value="UCoolDockStylePopupTabs"/>
     56      </Item7>
     57      <Item8>
     58        <Filename Value="UCoolDockStylePopupRegions.pas"/>
     59        <UnitName Value="UCoolDockStylePopupRegions"/>
     60      </Item8>
    4561    </Files>
    4662    <i18n>
  • Docking/CoolDocking/CoolDocking.pas

    r56 r89  
    88
    99uses
    10     UCoolDocking, UCoolDockCustomize, UCoolDockWindowList, LazarusPackageIntf;
     10    UCoolDocking, UCoolDockCustomize, UCoolDockWindowList, UCoolDockStyleTabs,
     11  UCoolDockStyleRegions, UCoolDockStylePopupTabs, UCoolDockStylePopupRegions,
     12  LazarusPackageIntf;
    1113
    1214implementation
  • Docking/CoolDocking/UCoolDockCustomize.lfm

    r60 r89  
    11object CoolDockCustomizeForm: TCoolDockCustomizeForm
    2   Left = 374
     2  Left = 431
    33  Height = 323
    4   Top = 135
     4  Top = 139
    55  Width = 407
    66  Caption = 'Customize docking'
    77  ClientHeight = 323
    88  ClientWidth = 407
     9  OnShow = FormShow
    910  LCLVersion = '0.9.29'
    1011  object PageControl1: TPageControl
     
    3031      end
    3132      object ComboBox1: TComboBox
    32         Left = 132
     33        Left = 164
    3334        Height = 21
    3435        Top = 10
    3536        Width = 100
    3637        ItemHeight = 13
     38        Items.Strings = (
     39          'Auto'
     40          'Left'
     41          'Top'
     42          'Right'
     43          'Bottom'
     44        )
     45        Style = csDropDownList
    3746        TabOrder = 0
    38         Text = 'ComboBox1'
    3947      end
    4048      object Label2: TLabel
     
    4755      end
    4856      object ComboBox2: TComboBox
    49         Left = 132
     57        Left = 164
    5058        Height = 21
    5159        Top = 38
    5260        Width = 100
    5361        ItemHeight = 13
     62        Items.Strings = (
     63          'Auto'
     64          'Left'
     65          'Top'
     66          'Right'
     67          'Bottom'
     68        )
     69        Style = csDropDownList
    5470        TabOrder = 1
    55         Text = 'ComboBox1'
     71      end
     72      object Label3: TLabel
     73        Left = 7
     74        Height = 14
     75        Top = 67
     76        Width = 101
     77        Caption = 'Hide/unhide duration'
     78        ParentColor = False
     79      end
     80      object SpinEdit1: TSpinEdit
     81        Left = 164
     82        Height = 21
     83        Top = 64
     84        Width = 100
     85        MaxValue = 10000
     86        TabOrder = 2
     87      end
     88      object Label4: TLabel
     89        Left = 270
     90        Height = 14
     91        Top = 67
     92        Width = 14
     93        Caption = 'ms'
     94        ParentColor = False
    5695      end
    5796    end
  • Docking/CoolDocking/UCoolDockCustomize.lrs

    r60 r89  
    22
    33LazarusResources.Add('TCoolDockCustomizeForm','FORMDATA',[
    4   'TPF0'#22'TCoolDockCustomizeForm'#21'CoolDockCustomizeForm'#4'Left'#3'v'#1#6
    5   +'Height'#3'C'#1#3'Top'#3#135#0#5'Width'#3#151#1#7'Caption'#6#17'Customize do'
    6   +'cking'#12'ClientHeight'#3'C'#1#11'ClientWidth'#3#151#1#10'LCLVersion'#6#6'0'
    7   +'.9.29'#0#12'TPageControl'#12'PageControl1'#4'Left'#2#8#6'Height'#3#22#1#3'T'
    8   +'op'#2#8#5'Width'#3#137#1#10'ActivePage'#7#15'TabSheetSetting'#7'Anchors'#11
    9   +#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#8'TabIndex'#2#0#8'TabOrder'#2#0
    10   +#0#9'TTabSheet'#15'TabSheetSetting'#7'Caption'#6#7'Options'#12'ClientHeight'
    11   +#3#252#0#11'ClientWidth'#3#129#1#0#6'TLabel'#6'Label1'#4'Left'#2#7#6'Height'
    12   +#2#14#3'Top'#2#13#5'Width'#2'h'#7'Caption'#6#22'Default tabs position:'#11'P'
    13   +'arentColor'#8#0#0#9'TComboBox'#9'ComboBox1'#4'Left'#3#132#0#6'Height'#2#21#3
    14   +'Top'#2#10#5'Width'#2'd'#10'ItemHeight'#2#13#8'TabOrder'#2#0#4'Text'#6#9'Com'
    15   +'boBox1'#0#0#6'TLabel'#6'Label2'#4'Left'#2#7#6'Height'#2#14#3'Top'#2')'#5'Wi'
    16   +'dth'#2'u'#7'Caption'#6#24'Default header position:'#11'ParentColor'#8#0#0#9
    17   +'TComboBox'#9'ComboBox2'#4'Left'#3#132#0#6'Height'#2#21#3'Top'#2'&'#5'Width'
    18   +#2'd'#10'ItemHeight'#2#13#8'TabOrder'#2#1#4'Text'#6#9'ComboBox1'#0#0#0#9'TTa'
    19   +'bSheet'#15'TabSheetLayouts'#7'Caption'#6#7'Layouts'#12'ClientHeight'#3#252#0
    20   +#11'ClientWidth'#3#129#1#0#8'TListBox'#8'ListBox1'#4'Left'#2#10#6'Height'#3
    21   +#231#0#3'Top'#2#11#5'Width'#3#180#0#7'Anchors'#11#5'akTop'#6'akLeft'#8'akBot'
    22   +'tom'#0#10'ItemHeight'#2#0#8'TabOrder'#2#0#0#0#0#0#7'TButton'#11'ButtonClose'
    23   +#4'Left'#3'D'#1#6'Height'#2#22#3'Top'#3'&'#1#5'Width'#2'K'#7'Anchors'#11#7'a'
    24   +'kRight'#8'akBottom'#0#7'Caption'#6#5'Close'#7'OnClick'#7#16'ButtonCloseClic'
    25   +'k'#8'TabOrder'#2#1#0#0#0
     4  'TPF0'#22'TCoolDockCustomizeForm'#21'CoolDockCustomizeForm'#4'Left'#3#175#1#6
     5  +'Height'#3'C'#1#3'Top'#3#139#0#5'Width'#3#151#1#7'Caption'#6#17'Customize do'
     6  +'cking'#12'ClientHeight'#3'C'#1#11'ClientWidth'#3#151#1#6'OnShow'#7#8'FormSh'
     7  +'ow'#10'LCLVersion'#6#6'0.9.29'#0#12'TPageControl'#12'PageControl1'#4'Left'#2
     8  +#8#6'Height'#3#22#1#3'Top'#2#8#5'Width'#3#137#1#10'ActivePage'#7#15'TabSheet'
     9  +'Setting'#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#8'TabInd'
     10  +'ex'#2#0#8'TabOrder'#2#0#0#9'TTabSheet'#15'TabSheetSetting'#7'Caption'#6#7'O'
     11  +'ptions'#12'ClientHeight'#3#252#0#11'ClientWidth'#3#129#1#0#6'TLabel'#6'Labe'
     12  +'l1'#4'Left'#2#7#6'Height'#2#14#3'Top'#2#13#5'Width'#2'h'#7'Caption'#6#22'De'
     13  +'fault tabs position:'#11'ParentColor'#8#0#0#9'TComboBox'#9'ComboBox1'#4'Lef'
     14  +'t'#3#164#0#6'Height'#2#21#3'Top'#2#10#5'Width'#2'd'#10'ItemHeight'#2#13#13
     15  +'Items.Strings'#1#6#4'Auto'#6#4'Left'#6#3'Top'#6#5'Right'#6#6'Bottom'#0#5'St'
     16  +'yle'#7#14'csDropDownList'#8'TabOrder'#2#0#0#0#6'TLabel'#6'Label2'#4'Left'#2
     17  +#7#6'Height'#2#14#3'Top'#2')'#5'Width'#2'u'#7'Caption'#6#24'Default header p'
     18  +'osition:'#11'ParentColor'#8#0#0#9'TComboBox'#9'ComboBox2'#4'Left'#3#164#0#6
     19  +'Height'#2#21#3'Top'#2'&'#5'Width'#2'd'#10'ItemHeight'#2#13#13'Items.Strings'
     20  +#1#6#4'Auto'#6#4'Left'#6#3'Top'#6#5'Right'#6#6'Bottom'#0#5'Style'#7#14'csDro'
     21  +'pDownList'#8'TabOrder'#2#1#0#0#6'TLabel'#6'Label3'#4'Left'#2#7#6'Height'#2
     22  +#14#3'Top'#2'C'#5'Width'#2'e'#7'Caption'#6#20'Hide/unhide duration'#11'Paren'
     23  +'tColor'#8#0#0#9'TSpinEdit'#9'SpinEdit1'#4'Left'#3#164#0#6'Height'#2#21#3'To'
     24  +'p'#2'@'#5'Width'#2'd'#8'MaxValue'#3#16''''#8'TabOrder'#2#2#0#0#6'TLabel'#6
     25  +'Label4'#4'Left'#3#14#1#6'Height'#2#14#3'Top'#2'C'#5'Width'#2#14#7'Caption'#6
     26  +#2'ms'#11'ParentColor'#8#0#0#0#9'TTabSheet'#15'TabSheetLayouts'#7'Caption'#6
     27  +#7'Layouts'#12'ClientHeight'#3#252#0#11'ClientWidth'#3#129#1#0#8'TListBox'#8
     28  +'ListBox1'#4'Left'#2#10#6'Height'#3#231#0#3'Top'#2#11#5'Width'#3#180#0#7'Anc'
     29  +'hors'#11#5'akTop'#6'akLeft'#8'akBottom'#0#10'ItemHeight'#2#0#8'TabOrder'#2#0
     30  +#0#0#0#0#7'TButton'#11'ButtonClose'#4'Left'#3'D'#1#6'Height'#2#22#3'Top'#3'&'
     31  +#1#5'Width'#2'K'#7'Anchors'#11#7'akRight'#8'akBottom'#0#7'Caption'#6#5'Close'
     32  +#7'OnClick'#7#16'ButtonCloseClick'#8'TabOrder'#2#1#0#0#0
    2633]);
  • Docking/CoolDocking/UCoolDockCustomize.lrt

    r60 r89  
    22TCOOLDOCKCUSTOMIZEFORM.TABSHEETSETTING.CAPTION=Options
    33TCOOLDOCKCUSTOMIZEFORM.LABEL1.CAPTION=Default tabs position:
    4 TCOOLDOCKCUSTOMIZEFORM.COMBOBOX1.TEXT=ComboBox1
    54TCOOLDOCKCUSTOMIZEFORM.LABEL2.CAPTION=Default header position:
    6 TCOOLDOCKCUSTOMIZEFORM.COMBOBOX2.TEXT=ComboBox1
     5TCOOLDOCKCUSTOMIZEFORM.LABEL3.CAPTION=Hide/unhide duration
     6TCOOLDOCKCUSTOMIZEFORM.LABEL4.CAPTION=ms
    77TCOOLDOCKCUSTOMIZEFORM.TABSHEETLAYOUTS.CAPTION=Layouts
    88TCOOLDOCKCUSTOMIZEFORM.BUTTONCLOSE.CAPTION=Close
  • Docking/CoolDocking/UCoolDockCustomize.pas

    r60 r89  
    77uses
    88  Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
    9   ComCtrls, StdCtrls;
     9  ComCtrls, StdCtrls, Spin;
    1010
    1111type
     
    1919    Label1: TLabel;
    2020    Label2: TLabel;
     21    Label3: TLabel;
     22    Label4: TLabel;
    2123    ListBox1: TListBox;
    2224    PageControl1: TPageControl;
     25    SpinEdit1: TSpinEdit;
    2326    TabSheetSetting: TTabSheet;
    2427    TabSheetLayouts: TTabSheet;
    2528    procedure ButtonCloseClick(Sender: TObject);
     29    procedure FormShow(Sender: TObject);
    2630  private
    2731    { private declarations }
     
    3943end;
    4044
     45procedure TCoolDockCustomizeForm.FormShow(Sender: TObject);
     46begin
     47
     48end;
     49
    4150initialization
    4251  {$I UCoolDockCustomize.lrs}
  • Docking/CoolDocking/UCoolDocking.pas

    r64 r89  
    1515const
    1616  GrabberSize = 22;
     17  AutoHideStepCount = 20;
    1718
    1819type
     
    5253  end;
    5354
     55  TCoolDockStyle = class
     56  end;
     57
    5458  { TCoolDockClientPanel }
    5559
     
    5963    FHeaderPos: THeaderPos;
    6064    FShowHeader: Boolean;
     65    function GetAutoHideEnabled: Boolean;
    6166    procedure SetAutoHide(const AValue: Boolean);
     67    procedure SetAutoHideEnabled(const AValue: Boolean);
    6268    procedure SetHeaderPos(const AValue: THeaderPos);
    6369    procedure SetShowHeader(const AValue: Boolean);
     
    7682    procedure ResizeExecute(Sender: TObject);
    7783    property ShowHeader: Boolean read FShowHeader write SetShowHeader;
    78     property AutoHide: Boolean read FAutoHide write SetAutoHide;
     84    property AutoHideEnabled: Boolean read GetAutoHideEnabled
     85      write SetAutoHideEnabled;
    7986    property HeaderPos: THeaderPos read FHeaderPos write SetHeaderPos;
     87  end;
     88
     89  { TCoolDockAutoHide }
     90
     91  TCoolDockAutoHide = class
     92  private
     93    FDuration: Real;
     94    FStepCount: Integer;
     95    StartBounds: TRect;
     96    procedure SetDuration(const AValue: Real);
     97    procedure SetStepCount(const AValue: Integer);
     98    procedure UpdateBounds;
     99    procedure UpdateTimerInterval;
     100  public
     101    Position: Real;
     102    Direction: Integer;
     103    TabPosition: TTabPosition;
     104    Enable: Boolean;
     105    Timer: TTimer;
     106    Control: TControl;
     107    ControlVisible: Boolean;
     108    procedure Hide;
     109    procedure Show;
     110    constructor Create;
     111    destructor Destroy; override;
     112    procedure TimerExecute(Sender: TObject);
     113    property Duration: Real read FDuration write SetDuration;
     114    property StepCount: Integer read FStepCount write SetStepCount;
    80115  end;
    81116
     
    88123    MouseDownSkip: Boolean;
    89124    FMaster: TCoolDockMaster;
    90     FMoveDuration: Integer;
    91125    FTabsPos: THeaderPos;
    92     Timer1: TTimer;
    93126    PopupMenuTabs: TPopupMenu;
    94127    PopupMenuHeader: TPopupMenu;
     
    98131    FDockDirection: TDockDirection;
    99132    FDockSite: TWinControl;
    100     FDockPanels: TObjectList; // of TCoolDockClientPanel
     133    FDockPanels: TObjectList; // TObjectList<TCoolDockClientPanel>
     134    AutoHide: TCoolDockAutoHide;
    101135    function FindControlInPanels(Control: TControl): TCoolDockClientPanel;
    102136    function GetDockSite: TWinControl;
     137    function GetMoveDuration: Integer;
    103138    procedure InsertControlPanel(Control: TControl; InsertAt: TAlign;
    104139      DropCtl: TControl);
     
    126161    procedure PopupMenuUndockClick(Sender: TObject);
    127162    procedure PopupMenuCustomizeClick(Sender: TObject);
    128     procedure Timer1Timer(Sender: TObject);
    129163  public
    130164    constructor Create(ADockSite: TWinControl); override;
     
    154188    function CreateContainer(InsertAt: TAlign): TCoolDockConjoinForm;
    155189    property DockStyle: TDockStyle read FDockStyle write SetDockStyle;
    156     property MoveDuration: Integer read FMoveDuration write SetMoveDuration;
     190    property MoveDuration: Integer read GetMoveDuration write SetMoveDuration;
    157191    property TabsPos: THeaderPos read FTabsPos write SetTabsPos;
    158192    property Master: TCoolDockMaster read FMaster write SetMaster;
     
    166200    FCoolDockCustomize: TCoolDockCustomize;
    167201    FDefaultHeaderPos: THeaderPos;
     202    FDefaultMoveSpeed: Integer;
    168203    FDefaultTabsPos: THeaderPos;
    169204    FShowIcons: Boolean;
     
    190225    property DefaultHeaderPos: THeaderPos read FDefaultHeaderPos
    191226      write FDefaultHeaderPos;
     227    property DefaultMoveSpeed: Integer read FDefaultMoveSpeed
     228      write FDefaultMoveSpeed;
    192229    property Customize: TCoolDockCustomize read FCoolDockCustomize
    193230      write SetCustomize;
     
    250287implementation
    251288
     289uses
     290  UCoolDockStyleTabs;
     291
    252292resourcestring
    253293  SDockStyle = 'Style';
     
    296336end;
    297337
     338function TCoolDockManager.GetMoveDuration: Integer;
     339begin
     340
     341end;
     342
    298343procedure TCoolDockManager.TabControlMouseLeave(Sender: TObject);
    299344begin
     
    315360  FDockPanels := TObjectList.Create;
    316361
    317   Timer1 := TTimer.Create(nil);
    318   Timer1.Enabled := False;
    319   Timer1.OnTimer := Timer1Timer;
     362  AutoHide := TCoolDockAutoHide.Create;
    320363
    321364  // Tabs popup
     
    476519destructor TCoolDockManager.Destroy;
    477520begin
    478   Timer1.Free;
    479521  FDockPanels.Free;
    480522  inherited Destroy;
     
    716758  I: Integer;
    717759begin
    718   FDockStyle := AValue;
    719   if AValue = dsTabs then begin
    720     TabControl.Visible := True;
    721     TabControl.Tabs.Clear;
    722     TabImageList.Clear;
    723     for I := 0 to FDockPanels.Count - 1 do begin
    724       TabControl.Tabs.Add(TCoolDockClientPanel(FDockPanels[I]).Control.Caption);
    725       TabImageList.Add(TCoolDockClientPanel(FDockPanels[I]).Header.Icon.Picture.Bitmap, nil);
    726       if Assigned(TCoolDockClientPanel(FDockPanels[I]).Splitter) then
    727         TCoolDockClientPanel(FDockPanels[I]).Splitter.Visible := False;
    728       TCoolDockClientPanel(FDockPanels[I]).ClientAreaPanel.Visible := False;
    729       TCoolDockClientPanel(FDockPanels[I]).Visible := False;
    730     end;
    731     TabControlChange(Self);
    732   end else
    733   if AValue = dsList then begin
    734     TabControl.Visible := False;
    735     TabControl.Tabs.Clear;
    736     for I := 0 to FDockPanels.Count - 1 do begin
    737       if Assigned(TCoolDockClientPanel(FDockPanels[I]).Splitter) then
     760  if FDockStyle <> AValue then begin
     761    FDockStyle := AValue;
     762    if AValue = dsTabs then begin
     763      TabControl.Visible := True;
     764      TabControl.Tabs.Clear;
     765      TabImageList.Clear;
     766      for I := 0 to FDockPanels.Count - 1 do begin
     767        TabControl.Tabs.Add(TCoolDockClientPanel(FDockPanels[I]).Control.Caption);
     768        TabImageList.Add(TCoolDockClientPanel(FDockPanels[I]).Header.Icon.Picture.Bitmap, nil);
     769        if Assigned(TCoolDockClientPanel(FDockPanels[I]).Splitter) then
     770          TCoolDockClientPanel(FDockPanels[I]).Splitter.Visible := False;
     771        TCoolDockClientPanel(FDockPanels[I]).ClientAreaPanel.Visible := False;
     772        TCoolDockClientPanel(FDockPanels[I]).Visible := False;
     773      end;
     774      TabControlChange(Self);
     775    end else
     776    if AValue = dsList then begin
     777      TabControl.Visible := False;
     778      TabControl.Tabs.Clear;
     779      for I := 0 to FDockPanels.Count - 1 do begin
     780        if Assigned(TCoolDockClientPanel(FDockPanels[I]).Splitter) then
    738781        TCoolDockClientPanel(FDockPanels[I]).Splitter.Visible := True;
    739       TCoolDockClientPanel(FDockPanels[I]).Visible := True;
    740       TCoolDockClientPanel(FDockPanels[I]).ClientAreaPanel.Parent := TCoolDockClientPanel(FDockPanels[I]);
    741       TCoolDockClientPanel(FDockPanels[I]).ClientAreaPanel.Visible := True;
    742       TCoolDockClientPanel(FDockPanels[I]).Control.Visible := True;
     782        TCoolDockClientPanel(FDockPanels[I]).Visible := True;
     783        TCoolDockClientPanel(FDockPanels[I]).ClientAreaPanel.Parent := TCoolDockClientPanel(FDockPanels[I]);
     784        TCoolDockClientPanel(FDockPanels[I]).ClientAreaPanel.Visible := True;
     785        TCoolDockClientPanel(FDockPanels[I]).Control.Visible := True;
     786      end;
    743787    end;
    744788  end;
     
    755799procedure TCoolDockManager.SetMoveDuration(const AValue: Integer);
    756800begin
    757   if FMoveDuration=AValue then exit;
    758   FMoveDuration := AValue;
    759   //Timer1.Interval := AValue;
    760801end;
    761802
    762803procedure TCoolDockManager.SetTabsPos(const AValue: THeaderPos);
    763804begin
    764   if FTabsPos=AValue then exit;
     805  if FTabsPos = AValue then Exit;
    765806  FTabsPos := AValue;
    766807  with TabControl do
     
    816857  I: Integer;
    817858begin
     859  // Hide all clients
    818860  for I := 0 to FDockPanels.Count - 1 do begin
    819861    TCoolDockClientPanel(FDockPanels[I]).ClientAreaPanel.Visible := False;
     862    TCoolDockClientPanel(FDockPanels[I]).ClientAreaPanel.Parent := FDockSite;
     863    TCoolDockClientPanel(FDockPanels[I]).Control.Align := alClient;
    820864    TCoolDockClientPanel(FDockPanels[I]).Control.Visible := False;
    821865  end;
     
    823867    with TCoolDockClientPanel(FDockPanels[TabControl.TabIndex]), ClientAreaPanel do begin
    824868      Control.Show;
    825       if AutoHide then begin
    826         Parent := nil;
     869      AutoHide.Enable := True;
     870      if AutoHide.Enable then begin
     871        //Parent := nil;
    827872        Visible := True;
    828         Width := 0;
    829         //TimerMoveForm :=
    830         //TimerIncrement := 1;
    831         Timer1.Interval := MoveDuration div 10;
    832         Timer1.Enabled := True;
     873        if AutoHide.ControlVisible then begin
     874          AutoHide.Hide;
     875        end;
     876        AutoHide.Control := Control;
     877        AutoHide.Show;
    833878      end else begin
    834879        Parent := FDockSite;
     
    912957end;
    913958
    914 procedure TCoolDockManager.Timer1Timer(Sender: TObject);
    915 begin
    916 //  TimerMoveForm.Width := TimerMoveForm.Width
    917 end;
    918 
    919959procedure TCoolDockManager.TabControlMouseDown(Sender: TObject; Button: TMouseButton;
    920960  Shift: TShiftState; X, Y: Integer);
     
    942982procedure TCoolDockClientPanel.SetShowHeader(const AValue: Boolean);
    943983begin
    944   if FShowHeader=AValue then exit;
     984  if FShowHeader = AValue then Exit;
    945985  FShowHeader := AValue;
    946986  DockPanelPaint(Self);
     
    9631003procedure TCoolDockClientPanel.SetAutoHide(const AValue: Boolean);
    9641004begin
    965   if FAutoHide=AValue then exit;
    966   FAutoHide:=AValue;
     1005  if FAutoHide = AValue then Exit;
     1006  FAutoHide := AValue;
     1007end;
     1008
     1009function TCoolDockClientPanel.GetAutoHideEnabled: Boolean;
     1010begin
     1011end;
     1012
     1013procedure TCoolDockClientPanel.SetAutoHideEnabled(const AValue: Boolean);
     1014begin
     1015
    9671016end;
    9681017
     
    10051054  BevelInner := bvNone;
    10061055  BevelOuter := bvNone;
    1007   AutoHide := False;
     1056  AutoHideEnabled := True;
    10081057  HeaderPos := hpTop;
    10091058end;
     
    10821131procedure TCoolDockMaster.SetTabsEnabled(const AValue: Boolean);
    10831132begin
    1084   if FTabsEnabled=AValue then exit;
    1085   FTabsEnabled:=AValue;
     1133  if FTabsEnabled = AValue then Exit;
     1134  FTabsEnabled := AValue;
    10861135end;
    10871136
     
    13431392begin
    13441393  Form := TCoolDockCustomizeForm.Create(Self);
     1394  if Assigned(Master) then begin
     1395    Form.SpinEdit1.Value := Master.DefaultMoveSpeed;
     1396    Form.ComboBox1.ItemIndex := Integer(Master.DefaultTabsPos);
     1397    Form.ComboBox2.ItemIndex := Integer(Master.DefaultHeaderPos);
     1398  end;
    13451399  Form.ShowModal;
     1400  if Assigned(Master) then begin
     1401    Master.DefaultMoveSpeed := Form.SpinEdit1.Value;
     1402    Master.DefaultTabsPos := THeaderPos(Form.ComboBox1.ItemIndex);
     1403    Master.DefaultHeaderPos := THeaderPos(Form.ComboBox2.ItemIndex);
     1404  end;
    13461405  Form.Free;
    13471406  Result := True;
     
    14641523end;
    14651524
     1525{ TCoolDockAutoHide }
     1526
     1527procedure TCoolDockAutoHide.UpdateBounds;
     1528begin
     1529  case TabPosition of
     1530    tpBottom: begin
     1531      Control.Height := Round((StartBounds.Bottom - StartBounds.Top) * Position);
     1532      Control.Top := StartBounds.Bottom - Control.Height;
     1533    end;
     1534    tpTop: begin
     1535      Control.Height := Round((StartBounds.Bottom - StartBounds.Top) * Position);
     1536    end;
     1537    tpRight: begin
     1538      Control.Width := Round((StartBounds.Right - StartBounds.Left) * Position);
     1539    end;
     1540    tpLeft: begin
     1541      Control.Width := Round((StartBounds.Right - StartBounds.Left) * Position);
     1542      Control.Left := StartBounds.Right - Control.Width;
     1543    end;
     1544  end;
     1545end;
     1546
     1547procedure TCoolDockAutoHide.UpdateTimerInterval;
     1548begin
     1549  Timer.Interval := Round(FDuration * 1000 / FStepCount);
     1550end;
     1551
     1552procedure TCoolDockAutoHide.SetDuration(const AValue: Real);
     1553begin
     1554  if FDuration = AValue then Exit;
     1555  FDuration := AValue;
     1556  UpdateTimerInterval;
     1557end;
     1558
     1559procedure TCoolDockAutoHide.SetStepCount(const AValue: Integer);
     1560begin
     1561  if FStepCount = AValue then Exit;
     1562  FStepCount := AValue;
     1563  UpdateTimerInterval;
     1564end;
     1565
     1566procedure TCoolDockAutoHide.Hide;
     1567begin
     1568  StartBounds := Control.BoundsRect;
     1569  Direction := -1;
     1570  Position := 1;
     1571  Timer.Enabled := True;
     1572  UpdateBounds;
     1573end;
     1574
     1575procedure TCoolDockAutoHide.Show;
     1576begin
     1577  StartBounds := Control.BoundsRect;
     1578  Control.Align := alCustom;
     1579  Direction := 1;
     1580  Position := 0;
     1581  Timer.Enabled := True;
     1582  UpdateBounds;
     1583end;
     1584
     1585constructor TCoolDockAutoHide.Create;
     1586begin
     1587  Timer := TTimer.Create(nil);
     1588  Timer.Enabled := False;
     1589  Timer.OnTimer := TimerExecute;
     1590  StepCount := AutoHideStepCount;
     1591  Duration := 0.5;
     1592end;
     1593
     1594destructor TCoolDockAutoHide.Destroy;
     1595begin
     1596  Timer.Free;
     1597  inherited Destroy;
     1598end;
     1599
     1600procedure TCoolDockAutoHide.TimerExecute(Sender: TObject);
     1601begin
     1602  if Direction = 1 then begin
     1603    Position := Position + 1 / StepCount;
     1604    if Position > 1 then begin
     1605      Position := 1;
     1606      Timer.Enabled := False;
     1607      ControlVisible := True;
     1608    end;
     1609  end else
     1610  if Direction = -1 then begin
     1611    Position := Position - 1 / StepCount;
     1612    if Position < 1 then begin
     1613      Position := 0;
     1614      Timer.Enabled := False;
     1615      ControlVisible := False;
     1616    end;
     1617  end;
     1618  UpdateBounds;
     1619end;
     1620
    14661621end.
    14671622
Note: See TracChangeset for help on using the changeset viewer.