Ignore:
Timestamp:
Mar 16, 2011, 12:32:41 PM (14 years ago)
Author:
george
Message:
  • Fixed: Popup submenus style and position item selection.
  • Added: Locking dock managers.
  • Modified: Enhanced auto popup tabs handling. Not yet finished.
  • Modified: Dock manager position united for all dock manager descendands.
File:
1 edited

Legend:

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

    r197 r198  
    1717    PanelHeader: TCDPanelHeader;
    1818    Splitter: TSplitter;
     19    procedure Paint(Sender: TObject); override;
    1920    constructor Create;
    2021    destructor Destroy; override;
     
    2627  private
    2728    FDockItems: TObjectList; // TList<TCDManagerRegionsItem>
     29    function GetHeaderPos: THeaderPos; override;
     30    procedure SetHeaderPos(const AValue: THeaderPos); override;
    2831    function GetDirection(InsertAt: TAlign): TCDDirection;
    2932  public
     
    5356{ TCDManagerRegionsItem }
    5457
     58procedure TCDManagerRegionsItem.Paint(Sender: TObject);
     59var
     60  I: Integer;
     61  R: TRect;
     62begin
     63  inherited Paint(Sender);
     64  with PanelHeader do
     65  if not (csDesigning in ComponentState) then
     66  if Assigned(Control) then begin
     67    //R := Control.ClientRect;
     68    //Canvas.FillRect(R);
     69    Header.Visible := ShowHeader;
     70    if ShowHeader then begin
     71      if ControlPanel.DockClientCount = 0 then
     72        Header.DrawGrabber(Canvas, Control) else
     73      Header.DrawGrabber(Canvas, ControlPanel);
     74    end;
     75  end;
     76end;
     77
    5578constructor TCDManagerRegionsItem.Create;
    5679begin
     
    5982  PanelHeader.Header.OnMouseDown := DockPanelMouseDown;
    6083  PanelHeader.Header.Title.OnMouseDown := DockPanelMouseDown;
     84  PanelHeader.Header.Icon.OnMouseDown := DockPanelMouseDown;
    6185
    6286  Splitter := TSplitter.Create(nil);
     
    81105
    82106{ TCDManagerRegions }
     107
     108function TCDManagerRegions.GetHeaderPos: THeaderPos;
     109begin
     110  Result := inherited;
     111end;
     112
     113procedure TCDManagerRegions.SetHeaderPos(const AValue: THeaderPos);
     114begin
     115  inherited SetHeaderPos(AValue);
     116  case AValue of
     117    hpBottom, hpTop: FDockDirection := ddVertical;
     118    hpLeft, hpRight: FDockDirection := ddHorizontal;
     119  end;
     120end;
    83121
    84122function TCDManagerRegions.GetDirection(InsertAt: TAlign): TCDDirection;
     
    117155    PanelHeader.Header.PopupMenu := Self.PopupMenu;
    118156  end;
    119   if (Control is TForm) and Assigned((Control as TForm).Icon) then
     157  if (Control is TForm) and Assigned((Control as TForm).Icon) then begin
    120158    NewItem.PanelHeader.Header.Icon.Picture.Assign((Control as TForm).Icon);
    121     NewItem.PanelHeader.Parent := DockSite;
    122     NewItem.PanelHeader.Header.Title.Caption := TForm(Control).Caption;
    123 
    124     NewItem.Control := Control;
    125     Control.AddHandlerOnVisibleChanged(NewItem.VisibleChange);
    126     Control.Parent := NewItem.PanelHeader.ControlPanel;
    127     Control.Align := alClient;
    128     if (InsertAt = alTop) or (InsertAt = alLeft) then
    129       DockItems.Insert(0, NewItem)
    130       else DockItems.Add(NewItem);
    131   end;
     159    NewItem.PanelHeader.Header.Icon.Width := NewItem.PanelHeader.Header.Icon.Picture.Bitmap.Width;
     160    NewItem.PanelHeader.Header.Icon.Height := NewItem.PanelHeader.Header.Icon.Picture.Bitmap.Height;
     161  end;
     162
     163  NewItem.PanelHeader.Parent := DockSite;
     164  NewItem.PanelHeader.Header.Title.Caption := TForm(Control).Caption;
     165
     166  NewItem.Control := Control;
     167  Control.AddHandlerOnVisibleChanged(NewItem.VisibleChange);
     168  Control.Parent := NewItem.PanelHeader.ControlPanel;
     169  Control.Align := alClient;
     170  if (InsertAt = alTop) or (InsertAt = alLeft) then
     171    DockItems.Insert(0, NewItem)
     172    else DockItems.Add(NewItem);
     173end;
    132174
    133175procedure TCDManagerRegions.InsertControlPanel(Control: TControl; InsertAt: TAlign;
     
    248290    PanelHeader.Width := Self.DockSite.Width div
    249291      Self.DockSite.DockClientCount;
    250     //TCDClientPanel(FDockPanels[I]).DockPanelPaint(Self);
     292    Paint(Self);
    251293    if I < (DockItems.Count - 1) then PanelHeader.Align := BaseAlign
    252294      else PanelHeader.Align := alClient;
Note: See TracChangeset for help on using the changeset viewer.