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/UCDManagerTabsPopup.pas

    r197 r198  
    66
    77uses
    8   Classes, Controls, SysUtils, ComCtrls, ExtCtrls, UCDCommon,
    9   UCDManagerTabs;
     8  Classes, Controls, SysUtils, ComCtrls, ExtCtrls, UCDCommon, UCDManager,
     9  UCDManagerTabs, Forms;
    1010
    1111type
     
    4040  { TCDManagerTabsPopupItem }
    4141
    42   TCDManagerTabsPopupItem = class
    43     constructor Create;
    44   end;
    45 
    46   { TCDStylePopupTabs }
    47 
    48   TCDStylePopupTabs = class(TCDManagerTabs)
     42  TCDManagerTabsPopupItem = class(TCDManagerTabsItem)
     43    Hidden: Boolean;
     44    constructor Create; override;
     45  end;
     46
     47  { TCDManagerTabsPopup }
     48
     49  TCDManagerTabsPopup = class(TCDManagerTabs)
     50  private
     51    procedure InsertControlNoUpdate(Control: TControl; InsertAt: TAlign); override;
    4952  public
    5053    AutoHideEnabled: Boolean;
    5154    AutoHide: TCDAutoHide;
    5255    PopupPanel: TPanel;
    53     constructor Create(ADockSite: TWinControl);
     56    procedure SetHeaderPos(const AValue: THeaderPos); override;
     57    procedure PinShowButtonClick(Sender: TObject);
     58    procedure PinHideButtonClick(Sender: TObject);
     59    procedure TabControlChange(Sender: TObject); override;
     60    constructor Create(ADockSite: TWinControl); override;
    5461    destructor Destroy; override;
    55   private
    5662  end;
    5763
     
    6066
    6167uses
    62   UCDClient;
     68  UCDClient, UCDManagerRegions;
    6369
    6470{ TCDManagerTabsPopupItem }
     
    6672constructor TCDManagerTabsPopupItem.Create;
    6773begin
     74  inherited;
    6875end;
    6976
     
    121128begin
    122129  StartBounds := Control.BoundsRect;
     130  Control.Show;
    123131  Control.Align := alCustom;
    124132  Direction := 1;
     
    165173end;
    166174
    167 { TCDStylePopupTabs }
    168 
    169 
    170 constructor TCDStylePopupTabs.Create(ADockSite: TWinControl);
     175{ TCDManagerTabsPopup }
     176
     177procedure TCDManagerTabsPopup.PinShowButtonClick(Sender: TObject);
     178begin
     179
     180end;
     181
     182procedure TCDManagerTabsPopup.PinHideButtonClick(Sender: TObject);
     183begin
     184
     185end;
     186
     187procedure TCDManagerTabsPopup.TabControlChange(Sender: TObject);
     188begin
     189  inherited TabControlChange(Sender);
     190  if PopupPanel.ControlCount > 0 then
     191    PopupPanel.Controls[0].Parent := nil;
     192  AutoHide.Hide;
     193  if PageControl.TabIndex >= 0 then begin
     194    TCDManagerTabsPopupItem(DockItems[PageControl.TabIndex]).Control.Parent := PopupPanel;
     195    AutoHide.Control.Align := alCustom;
     196    with AutoHide.Control do
     197    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;
     207    AutoHide.Show;
     208  end;
     209end;
     210
     211constructor TCDManagerTabsPopup.Create(ADockSite: TWinControl);
    171212var
    172213  I: Integer;
     
    174215  inherited;
    175216  FDockStyle := dsPopupTabs;
     217  PopupPanel := TPanel.Create(nil);
     218  PopupPanel.DockManager := TCDManagerRegions.Create(PopupPanel);
     219  PopupPanel.Visible := True;
    176220  AutoHide := TCDAutoHide.Create;
    177   PopupPanel := TPanel.Create(nil);
    178 end;
    179 
    180 destructor TCDStylePopupTabs.Destroy;
     221  AutoHide.Control := PopupPanel;
     222
     223  for I := 0 to DockItems.Count - 1 do begin
     224//    if TCDManagerTabsPopupItem(DockItems[I]).Hidden then
     225//      if
     226  end;
     227end;
     228
     229destructor TCDManagerTabsPopup.Destroy;
    181230begin
    182231  AutoHide.Free;
     
    185234end;
    186235
     236procedure TCDManagerTabsPopup.InsertControlNoUpdate(Control: TControl; InsertAt: TAlign);
     237var
     238  NewTabSheet: TTabSheet;
     239  NewItem: TCDManagerTabsItem;
     240begin
     241  //inherited;
     242  begin
     243    NewItem := TCDManagerTabsPopupItem.Create;
     244    with NewItem do begin
     245      //Panel.Parent := Self.DockSite;
     246      Manager := Self;
     247      //if DockStyle = dsList then Visible := True;
     248      //Align := alClient;
     249      //Header.PopupMenu := Self.PopupMenu;
     250      //PopupMenu.Parent := Self.DockSite;
     251    end;
     252    if (Control is TForm) and Assigned((Control as TForm).Icon) then
     253      NewItem.Icon.Picture.Assign((Control as TForm).Icon);
     254
     255    NewItem.Control := Control;
     256    Control.AddHandlerOnVisibleChanged(NewItem.VisibleChange);
     257    //AControl.Parent := NewItem.ClientAreaPanel;
     258    Control.Align := alClient;
     259    if (InsertAt = alTop) or (InsertAt = alLeft) then
     260      DockItems.Insert(0, NewItem)
     261      else DockItems.Add(NewItem);
     262
     263  end;
     264
     265    NewTabSheet := TTabSheet.Create(PageControl);
     266    NewTabSheet.PageControl := PageControl;
     267    NewTabSheet.Caption := Control.Caption;
     268    NewTabSheet.ImageIndex := TabImageList.Count;
     269    NewTabSheet.TabVisible := Control.Visible;
     270    Control.Parent := NewTabSheet;
     271    TabImageList.Add(NewItem.Icon.Picture.Bitmap, nil);
     272//    if Assigned(NewItem.Splitter) then
     273//      NewItem.Splitter.Visible := False;
     274//    NewItem.ClientAreaPanel.Visible := False;
     275//    NewItem.Visible := False;
     276    //NewItem.Parent := NewTabSheet;
     277end;
     278
     279procedure TCDManagerTabsPopup.SetHeaderPos(const AValue: THeaderPos);
     280begin
     281  inherited SetHeaderPos(AValue);
     282  AutoHide.TabPosition := HeaderPosToTabPos(AValue);
     283end;
     284
    187285end.
    188286
Note: See TracChangeset for help on using the changeset viewer.