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

Legend:

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

    r204 r205  
    77uses
    88  Classes, Controls, SysUtils, ComCtrls, ExtCtrls, UCDCommon, UCDManager,
    9   UCDManagerTabs, Forms, URectangle;
     9  UCDManagerTabs, Forms, URectangle, UCDConjoinForm;
    1010
    1111type
     
    5353  TCDManagerTabsPopup = class(TCDManagerTabs)
    5454  private
     55    SplitterMouseDrag: Boolean;
     56    SplitterMousePos: TPoint;
    5557    procedure InsertControlNoUpdate(Control: TControl; InsertAt: TAlign); override;
     58    procedure SplitterMouseDown(Sender: TObject; Button: TMouseButton;
     59      Shift: TShiftState; X, Y: Integer);
     60    procedure SplitterMouseMove(Sender: TObject; Shift: TShiftState;
     61                              X, Y: Integer);
     62    procedure SplitterMouseUp(Sender: TObject; Button: TMouseButton;
     63      Shift: TShiftState; X, Y: Integer);
    5664  public
    5765    AutoHideEnabled: Boolean;
    5866    AutoHide: TCDAutoHide;
    5967    PopupForm: TForm;
     68    HeaderPanel: TCDPanelHeader;
     69    Splitter: TPanel;
    6070    procedure SetHeaderPos(const AValue: THeaderPos); override;
    6171    procedure PinShowButtonClick(Sender: TObject);
     
    188198      ControlVisible := True;
    189199      DoShow := False;
    190       HideBounds := ShowBounds;
     200      HideBounds.Assign(ShowBounds);
    191201    end;
    192202  end else
     
    231241    C := TCDManagerTabsPopupItem(DockItems[PageControl.TabIndex]).Control;
    232242    C.Align := alClient;
    233     C.Parent := PopupForm;
     243    C.Parent := HeaderPanel.ControlPanel;
     244    HeaderPanel.Header.Title.Caption := C.Caption;
    234245    Pos := Point(PageControl.Left, PageControl.Top);
    235246
     
    279290  PopupForm.Visible := True;
    280291  PopupForm.BorderStyle := bsNone;
     292  HeaderPanel := TCDPanelHeader.Create(nil);
     293  HeaderPanel.Parent := PopupForm;
     294  HeaderPanel.Align := alClient;
     295  HeaderPanel.Visible := True;
     296  Splitter := TPanel.Create(nil);
     297  Splitter.Visible := True;
     298  Splitter.Parent := PopupForm;
     299  Splitter.OnMouseDown := SplitterMouseDown;
     300  Splitter.OnMouseMove := SplitterMouseMove;
     301  Splitter.OnMouseUp := SplitterMouseUp;
    281302  AutoHide := TCDAutoHide.Create;
    282303  AutoHide.Control := PopupForm;
     
    293314  AutoHide.Free;
    294315  PopupForm.Free;
     316  HeaderPanel.Free;
    295317  inherited Destroy;
    296318end;
     
    339361end;
    340362
     363procedure TCDManagerTabsPopup.SplitterMouseDown(Sender: TObject;
     364  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
     365begin
     366  if Button = mbLeft then begin
     367    SplitterMousePos := Point(X, Y);
     368    SplitterMouseDrag := True;
     369  end;
     370end;
     371
     372procedure TCDManagerTabsPopup.SplitterMouseMove(Sender: TObject; Shift: TShiftState;
     373  X, Y: Integer);
     374begin
     375  if SplitterMouseDrag then begin
     376    case Splitter.Align of
     377      alLeft: begin
     378        PopupForm.SetBounds(PopupForm.Left - (X - SplitterMousePos.X),
     379          PopupForm.Top, PopupForm.Width - (X - SplitterMousePos.X),
     380          PopupForm.Height);
     381      end;
     382      alRight: begin
     383        PopupForm.SetBounds(PopupForm.Left, PopupForm.Top,
     384          PopupForm.Width + (X - SplitterMousePos.X), PopupForm.Height);
     385      end;
     386      alTop: begin
     387        PopupForm.SetBounds(PopupForm.Left,PopupForm.Top + (Y - SplitterMousePos.Y),
     388          PopupForm.Width, PopupForm.Height + (Y - SplitterMousePos.Y));
     389      end;
     390      alBottom: begin
     391        PopupForm.SetBounds(PopupForm.Left, PopupForm.Top,
     392          PopupForm.Width, PopupForm.Height + (Y - SplitterMousePos.Y));
     393      end;
     394    end;
     395  end;
     396end;
     397
     398procedure TCDManagerTabsPopup.SplitterMouseUp(Sender: TObject;
     399  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
     400begin
     401  SplitterMouseDrag := False;
     402end;
     403
    341404procedure TCDManagerTabsPopup.SetHeaderPos(const AValue: THeaderPos);
     405const
     406  SplitterSize: Integer = 4;
    342407begin
    343408  inherited SetHeaderPos(AValue);
     
    348413      Align := alTop;
    349414      Height := 24;
     415      Splitter.Align := alBottom;
     416      Splitter.Height := SplitterSize;
     417      Splitter.Cursor := crSizeNS;
    350418    end;
    351419    hpBottom: begin
    352420      Align := alBottom;
    353421      Height := 24;
     422      Splitter.Align := alTop;
     423      Splitter.Height := SplitterSize;
     424      Splitter.Cursor := crSizeNS;
    354425    end;
    355426    hpLeft: begin
    356427      Align := alLeft;
    357428      Width := 24;
     429      Splitter.Align := alRight;
     430      Splitter.Width := SplitterSize;
     431      Splitter.Cursor := crSizeWE;
    358432    end;
    359433    hpRight: begin
    360434      Align := alRight;
    361435      Width := 24;
     436      Splitter.Align := alLeft;
     437      Splitter.Width := SplitterSize;
     438      Splitter.Cursor := crSizeWE;
    362439    end;
    363440  end;
Note: See TracChangeset for help on using the changeset viewer.