Ignore:
Timestamp:
Mar 18, 2011, 11:05:39 AM (14 years ago)
Author:
george
Message:
  • Fixed: PopupForm auto resize on parent resize.
  • Added: Option in popup menu for change visibility of dock panel header.
File:
1 edited

Legend:

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

    r205 r207  
    5555    SplitterMouseDrag: Boolean;
    5656    SplitterMousePos: TPoint;
     57    procedure PageControlResize(Sender: TObject);
    5758    procedure InsertControlNoUpdate(Control: TControl; InsertAt: TAlign); override;
    5859    procedure SplitterMouseDown(Sender: TObject; Button: TMouseButton;
     
    6263    procedure SplitterMouseUp(Sender: TObject; Button: TMouseButton;
    6364      Shift: TShiftState; X, Y: Integer);
     65    procedure UpdatePopupFormBounds;
     66    procedure TabControlChange(Sender: TObject); override;
    6467  public
    6568    AutoHideEnabled: Boolean;
     
    7174    procedure PinShowButtonClick(Sender: TObject);
    7275    procedure PinHideButtonClick(Sender: TObject);
    73     procedure TabControlChange(Sender: TObject); override;
    7476    constructor Create(ADockSite: TWinControl); override;
    7577    destructor Destroy; override;
     
    243245    C.Parent := HeaderPanel.ControlPanel;
    244246    HeaderPanel.Header.Title.Caption := C.Caption;
    245     Pos := Point(PageControl.Left, PageControl.Top);
    246 
    247     TopParent := DockSite;
    248     while Assigned(TopParent.Parent) do begin
    249       Pos.X := Pos.X + TopParent.Left;;
    250       Pos.Y := Pos.Y + TopParent.Top;
    251       TopParent := TopParent.Parent;
    252     end;
    253     PopupForm.Parent := TopParent;
    254247    //AutoHide.Control.Align := alCustom;
    255248    //Pos := DockSite.ClientToScreen(Pos);
    256     C.TBDockHeight := 100;
    257     C.LRDockWidth := 100;
    258     with AutoHide.Control do
    259     case AutoHide.TabPosition of
    260       tpTop: begin
    261         SetBounds(Pos.X, Pos.Y + PageControl.Height,
    262           PageControl.Width, C.TBDockHeight);
    263       end;
    264       tpLeft: begin
    265         SetBounds(Pos.X + PageControl.Width, Pos.Y,
    266           C.LRDockWidth, PageControl.Height);
    267       end;
    268       tpBottom: begin
    269         SetBounds(Pos.X, Pos.Y - C.TBDockHeight,
    270           PageControl.Width, C.TBDockHeight);
    271       end;
    272       tpRight: begin
    273         SetBounds(Pos.X - C.LRDockWidth, Pos.Y,
    274           C.LRDockWidth, PageControl.Height);
    275       end;
    276     end;
    277249    //AutoHide.Control.SetBounds(0, 0, 100, 100);
     250    UpdatePopupFormBounds;
    278251    AutoHide.Show;
    279252  end;
     
    302275  AutoHide := TCDAutoHide.Create;
    303276  AutoHide.Control := PopupForm;
     277  PageControl.OnResize := PageControlResize;
    304278
    305279  for I := 0 to DockItems.Count - 1 do begin
     
    316290  HeaderPanel.Free;
    317291  inherited Destroy;
     292end;
     293
     294procedure TCDManagerTabsPopup.PageControlResize(Sender: TObject);
     295begin
     296  UpdatePopupFormBounds;
    318297end;
    319298
     
    376355    case Splitter.Align of
    377356      alLeft: begin
    378         PopupForm.SetBounds(PopupForm.Left - (X - SplitterMousePos.X),
     357        PopupForm.SetBounds(PopupForm.Left + (X - SplitterMousePos.X),
    379358          PopupForm.Top, PopupForm.Width - (X - SplitterMousePos.X),
    380359          PopupForm.Height);
     
    385364      end;
    386365      alTop: begin
    387         PopupForm.SetBounds(PopupForm.Left,PopupForm.Top + (Y - SplitterMousePos.Y),
    388           PopupForm.Width, PopupForm.Height + (Y - SplitterMousePos.Y));
     366        PopupForm.SetBounds(PopupForm.Left, PopupForm.Top + (Y - SplitterMousePos.Y),
     367          PopupForm.Width, PopupForm.Height - (Y - SplitterMousePos.Y));
    389368      end;
    390369      alBottom: begin
     
    400379begin
    401380  SplitterMouseDrag := False;
     381end;
     382
     383procedure TCDManagerTabsPopup.UpdatePopupFormBounds;
     384var
     385  Pos: TPoint;
     386  C: TControl;
     387  TopParent: TWinControl;
     388begin
     389  if PageControl.TabIndex <> - 1 then begin
     390    Pos := Point(PageControl.Left, PageControl.Top);
     391    TopParent := DockSite;
     392    while Assigned(TopParent.Parent) do begin
     393      Pos.X := Pos.X + TopParent.Left;;
     394      Pos.Y := Pos.Y + TopParent.Top;
     395      TopParent := TopParent.Parent;
     396    end;
     397    PopupForm.Parent := TopParent;
     398
     399    C := TCDManagerTabsPopupItem(DockItems[PageControl.TabIndex]).Control;
     400    C.TBDockHeight := 100;
     401    C.LRDockWidth := 100;
     402    with AutoHide.Control do
     403    case AutoHide.TabPosition of
     404      tpTop: begin
     405        SetBounds(Pos.X, Pos.Y + PageControl.Height,
     406          PageControl.Width, C.TBDockHeight);
     407      end;
     408      tpLeft: begin
     409        SetBounds(Pos.X + PageControl.Width, Pos.Y,
     410          C.LRDockWidth, PageControl.Height);
     411      end;
     412      tpBottom: begin
     413        SetBounds(Pos.X, Pos.Y - C.TBDockHeight,
     414          PageControl.Width, C.TBDockHeight);
     415      end;
     416      tpRight: begin
     417        SetBounds(Pos.X - C.LRDockWidth, Pos.Y,
     418          C.LRDockWidth, PageControl.Height);
     419      end;
     420    end;
     421  end;
    402422end;
    403423
     
    411431  case AValue of
    412432    hpTop, hpAuto: begin
    413       Align := alTop;
    414       Height := 24;
     433      //Align := alTop;
     434      //Height := 24;
    415435      Splitter.Align := alBottom;
    416436      Splitter.Height := SplitterSize;
     
    418438    end;
    419439    hpBottom: begin
    420       Align := alBottom;
    421       Height := 24;
     440      //Align := alBottom;
     441      //Height := 24;
    422442      Splitter.Align := alTop;
    423443      Splitter.Height := SplitterSize;
     
    425445    end;
    426446    hpLeft: begin
    427       Align := alLeft;
    428       Width := 24;
     447      //Align := alLeft;
     448      //Width := 24;
    429449      Splitter.Align := alRight;
    430450      Splitter.Width := SplitterSize;
     
    432452    end;
    433453    hpRight: begin
    434       Align := alRight;
    435       Width := 24;
     454      //Align := alRight;
     455      //Width := 24;
    436456      Splitter.Align := alLeft;
    437457      Splitter.Width := SplitterSize;
Note: See TracChangeset for help on using the changeset viewer.