Ignore:
Timestamp:
Mar 16, 2011, 2:17:54 PM (14 years ago)
Author:
george
Message:
  • Modified: Enhanced handling of popup tabs style.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Docking/CoolDocking/Managers/UCDManagerTabsPopup.pas

    r198 r199  
    1616    FDuration: Real;
    1717    FStepCount: Integer;
     18    FTabPosition: TTabPosition;
    1819    StartBounds: TRect;
    1920    procedure SetDuration(const AValue: Real);
     
    2425    Position: Real;
    2526    Direction: Integer;
    26     TabPosition: TTabPosition;
    2727    Enable: Boolean;
    2828    Timer: TTimer;
     
    3434    destructor Destroy; override;
    3535    procedure TimerExecute(Sender: TObject);
     36    property TabPosition: TTabPosition read FTabPosition write FTabPosition;
    3637    property Duration: Real read FDuration write SetDuration;
    3738    property StepCount: Integer read FStepCount write SetStepCount;
     
    5354    AutoHideEnabled: Boolean;
    5455    AutoHide: TCDAutoHide;
    55     PopupPanel: TPanel;
     56    PopupForm: TForm;
    5657    procedure SetHeaderPos(const AValue: THeaderPos); override;
    5758    procedure PinShowButtonClick(Sender: TObject);
     
    8788      Control.Height := Round((StartBounds.Bottom - StartBounds.Top) * Position);
    8889    end;
     90    tpLeft: begin
     91      Control.Width := Round((StartBounds.Right - StartBounds.Left) * Position);
     92    end;
    8993    tpRight: begin
    90       Control.Width := Round((StartBounds.Right - StartBounds.Left) * Position);
    91     end;
    92     tpLeft: begin
    9394      Control.Width := Round((StartBounds.Right - StartBounds.Left) * Position);
    9495      Control.Left := StartBounds.Right - Control.Width;
     
    119120begin
    120121  StartBounds := Control.BoundsRect;
     122  Control.Show;
     123  Control.BringToFront;
    121124  Direction := -1;
    122125  Position := 1;
     
    128131begin
    129132  StartBounds := Control.BoundsRect;
     133  //StartBounds := Bounds(0, 0, Control.UndockWidth, Control.UndockHeight);
    130134  Control.Show;
    131   Control.Align := alCustom;
     135  Control.BringToFront;
     136  Control.Align := alClient;
    132137  Direction := 1;
    133138  Position := 0;
     
    143148  Timer.OnTimer := TimerExecute;
    144149  StepCount := 10;
    145   Duration := 0.5;
     150  Duration := 0.05;
    146151end;
    147152
     
    164169  if Direction = -1 then begin
    165170    Position := Position - 1 / StepCount;
    166     if Position < 1 then begin
     171    if Position < 0 then begin
    167172      Position := 0;
    168173      Timer.Enabled := False;
     
    186191
    187192procedure TCDManagerTabsPopup.TabControlChange(Sender: TObject);
     193var
     194  Pos: TPoint;
     195  C: TControl;
    188196begin
    189197  inherited TabControlChange(Sender);
    190   if PopupPanel.ControlCount > 0 then
    191     PopupPanel.Controls[0].Parent := nil;
     198  MouseDownSkip := True;
     199  if PopupForm.ControlCount > 0 then
     200    PopupForm.Controls[0].Parent := nil;
    192201  AutoHide.Hide;
     202  while AutoHide.Position > 0 do begin
     203    Application.ProcessMessages;
     204    Sleep(1);
     205  end;
    193206  if PageControl.TabIndex >= 0 then begin
    194     TCDManagerTabsPopupItem(DockItems[PageControl.TabIndex]).Control.Parent := PopupPanel;
    195     AutoHide.Control.Align := alCustom;
     207    C := TCDManagerTabsPopupItem(DockItems[PageControl.TabIndex]).Control;
     208    C.Parent := PopupForm;
     209    //AutoHide.Control.Align := alCustom;
     210    Pos := Point(PageControl.Left, PageControl.Top);
     211    Pos := DockSite.ClientToScreen(Pos);
    196212    with AutoHide.Control do
    197213    case AutoHide.TabPosition of
    198       tpTop: SetBounds(PageControl.Left, PageControl.Top + PageControl.Height,
    199         PageControl.Width, Height);
    200       tpLeft: SetBounds(PageControl.Left + PageControl.Width, PageControl.Top,
    201         Width, PageControl.Height);
    202       tpBottom: SetBounds(PageControl.Left, PageControl.Top - Height,
    203         PageControl.Width, Height);
    204       tpRight: SetBounds(PageControl.Left - Width, PageControl.Top,
    205         Width, PageControl.Height);
    206     end;
     214      tpTop: begin
     215        SetBounds(Pos.X, Pos.Y + PageControl.Height,
     216          PageControl.Width, C.TBDockHeight);
     217      end;
     218      tpLeft: begin
     219        SetBounds(Pos.X + PageControl.Width, Pos.Y,
     220          C.LRDockWidth, PageControl.Height);
     221      end;
     222      tpBottom: begin
     223        SetBounds(Pos.X, Pos.Y - C.TBDockHeight,
     224          PageControl.Width, C.TBDockHeight);
     225      end;
     226      tpRight: begin
     227        SetBounds(Pos.X - C.LRDockWidth, Pos.Y,
     228          C.LRDockWidth, PageControl.Height);
     229      end;
     230    end;
     231    //AutoHide.Control.SetBounds(0, 0, 100, 100);
    207232    AutoHide.Show;
    208233  end;
     
    215240  inherited;
    216241  FDockStyle := dsPopupTabs;
    217   PopupPanel := TPanel.Create(nil);
    218   PopupPanel.DockManager := TCDManagerRegions.Create(PopupPanel);
    219   PopupPanel.Visible := True;
     242  PopupForm := TForm.Create(nil);
     243  PopupForm.DockManager := TCDManagerRegions.Create(PopupForm);
     244  PopupForm.Visible := True;
     245  //PopupForm.Parent := ADockSite;
     246  PopupForm.BorderStyle := bsNone;
    220247  AutoHide := TCDAutoHide.Create;
    221   AutoHide.Control := PopupPanel;
     248  AutoHide.Control := PopupForm;
    222249
    223250  for I := 0 to DockItems.Count - 1 do begin
     
    225252//      if
    226253  end;
     254  HeaderPos := HeaderPos; // Reset position
    227255end;
    228256
     
    230258begin
    231259  AutoHide.Free;
    232   PopupPanel.Free;
     260  PopupForm.Free;
    233261  inherited Destroy;
    234262end;
     
    281309  inherited SetHeaderPos(AValue);
    282310  AutoHide.TabPosition := HeaderPosToTabPos(AValue);
     311  with PageControl do
     312  case AValue of
     313    hpTop, hpAuto: begin
     314      Align := alTop;
     315      Height := 24;
     316    end;
     317    hpBottom: begin
     318      Align := alBottom;
     319      Height := 24;
     320    end;
     321    hpLeft: begin
     322      Align := alLeft;
     323      Width := 24;
     324    end;
     325    hpRight: begin
     326      Align := alRight;
     327      Width := 24;
     328    end;
     329  end;
    283330end;
    284331
Note: See TracChangeset for help on using the changeset viewer.