Ignore:
Timestamp:
Sep 22, 2010, 9:21:42 AM (14 years ago)
Author:
george
Message:
  • Přidáno: Zobrazení ikon v titulku ukotvených oken.
  • Opraveno: Vzájemné provázání TCoolDockCustomize a TCoolDockMaster.
  • Upraveno: Vytváření seznamu ukotvitelných oken komponenty TCoolDockWindowList.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Docking/CoolDocking/UCoolDocking.pas

    r56 r57  
    3737    CloseButton: TSpeedButton;
    3838    Title: TLabel;
    39     Icon: TIcon;
     39    Icon: TImage;
    4040    ParentClientPanel: TCoolDockClientPanel;
    4141    Shape: TShape;
     
    157157    procedure SaveLayoutToFile(FileName: string);
    158158    procedure LoadLayoutFromFile(FileName: string);
     159    destructor Destroy; override;
    159160  published
    160161    property TabsEnabled: Boolean read FTabsEnabled write SetTabsEnabled;
     
    169170  TCoolDockCustomize = class(TComponent)
    170171  private
    171     FManager: TCoolDockMaster;
    172     procedure SetManager(const AValue: TCoolDockMaster);
     172    FMaster: TCoolDockMaster;
     173    Form: TCoolDockCustomizeForm;
     174    procedure SetMaster(const AValue: TCoolDockMaster);
    173175  public
    174     Form: TCoolDockCustomizeForm;
    175176    function Execute: Boolean;
    176177    constructor Create(AOwner: TComponent); override;
     178    destructor Destroy; override;
    177179  published
    178     property Manager: TCoolDockMaster read FManager write SetManager;
     180    property Master: TCoolDockMaster read FMaster write SetMaster;
    179181  end;
    180182
     
    183185  TCoolDockWindowList = class(TComponent)
    184186  private
     187    Form: TCoolDockWindowListForm;
    185188  public
    186     Form: TCoolDockWindowListForm;
    187189    function Execute: Boolean;
    188190    constructor Create(AOwner: TComponent); override;
     
    469471      Header.PopupMenu := PopupMenuHeader;
    470472    end;
     473    if (Control is TForm) and Assigned((Control as TForm).Icon) then
     474      NewPanel.Header.Icon.Picture.Assign((Control as TForm).Icon);
    471475
    472476    if DockStyle = dsTabs then begin
     
    708712    for I := 0 to FDockPanels.Count - 1 do begin
    709713      TCoolDockClientPanel(FDockPanels[I]).Height := FDockSite.Height div
    710         FDockSite.VisibleDockClientCount;
     714        FDockSite.DockClientCount;
    711715      TCoolDockClientPanel(FDockPanels[I]).Width := FDockSite.Width div
    712         FDockSite.VisibleDockClientCount;
     716        FDockSite.DockClientCount;
    713717      //TCoolDockClientPanel(FDockPanels[I]).DockPanelPaint(Self);
     718      TCoolDockClientPanel(FDockPanels[I]).DockPanelPaint(Self);
    714719    end;
    715720  end else
     
    841846procedure TCoolDockClientPanel.VisibleChange(Sender: TObject);
    842847begin
    843   //OwnerDockManager.FDockPanels.Remove(Self);
    844   ClientAreaPanel.Visible := Control.Visible;
    845   Splitter.Visible := Control.Visible;
    846   OwnerDockManager.UpdateClientSize;
     848(*  if Assigned(Control) then begin
     849    //OwnerDockManager.FDockPanels.Remove(Self);
     850    if Assigned(ClientAreaPanel) then
     851      ClientAreaPanel.Visible := Control.Visible;
     852    if Assigned(Splitter) then
     853      Splitter.Visible := Control.Visible;
     854    OwnerDockManager.UpdateClientSize;
     855  end;*)
    847856end;
    848857
     
    968977procedure TCoolDockMaster.SetCustomize(const AValue: TCoolDockCustomize
    969978  );
    970 begin
    971   if FCoolDockCustomize=AValue then exit;
    972   FCoolDockCustomize:=AValue;
    973   if Assigned(AValue) then
    974     if not Assigned(AValue.Manager) then
    975       AValue.Manager := Self;
     979var
     980  OldCustomize: TCoolDockCustomize;
     981begin
     982  if FCoolDockCustomize = AValue then Exit;
     983  OldCustomize := FCoolDockCustomize;
     984  FCoolDockCustomize := AValue;
     985  if Assigned(AValue) then begin
     986    FCoolDockCustomize.Master := Self;
     987  end else begin
     988    OldCustomize.Master := nil;
     989  end;
    976990end;
    977991
     
    10771091    Free;
    10781092  end;
     1093end;
     1094
     1095destructor TCoolDockMaster.Destroy;
     1096begin
     1097  Customize := nil;
     1098  inherited Destroy;
    10791099end;
    10801100
     
    11161136    BevelOuter := bvNone;
    11171137  end;
     1138  Icon := TImage.Create(Self);
     1139  with Icon do begin
     1140    Parent := Self;
     1141    Left := 4;
     1142    Top := 3;
     1143    Visible := True;
     1144  end;
    11181145end;
    11191146
     
    11341161      else Title.Font.Style := Font.Style - [fsBold];
    11351162    Rectangle(1, 1, AControl.Width - 1, GrabberSize - 1);
     1163    if Icon.Picture.Width > 0 then Title.Left := 8 + Icon.Picture.Width
     1164      else Title.Left := 6;
    11361165    Title.Caption := AControl.Caption;
    11371166  end;
     
    11451174{ TCoolDockCustomize }
    11461175
    1147 procedure TCoolDockCustomize.SetManager(const AValue: TCoolDockMaster);
    1148 begin
    1149   if FManager = AValue then exit;
    1150   FManager := AValue;
    1151   if Assigned(AValue) then
    1152     if not Assigned(AValue.Customize) then
    1153       AValue.Customize := Self;
     1176procedure TCoolDockCustomize.SetMaster(const AValue: TCoolDockMaster);
     1177var
     1178  OldMaster: TCoolDockMaster;
     1179begin
     1180  if FMaster = AValue then Exit;
     1181  OldMaster := FMaster;
     1182  FMaster := AValue;
     1183  if Assigned(AValue) then begin
     1184    FMaster.Customize := Self;
     1185  end else begin
     1186    OldMaster.Customize := nil;
     1187  end;
    11541188end;
    11551189
    11561190function TCoolDockCustomize.Execute: Boolean;
    11571191begin
     1192  Form := TCoolDockCustomizeForm.Create(Self);
    11581193  Form.ShowModal;
     1194  Form.Free;
    11591195  Result := True;
    11601196end;
     
    11631199begin
    11641200  inherited Create(AOwner);
    1165   Form := TCoolDockCustomizeForm.Create(Self);
     1201end;
     1202
     1203destructor TCoolDockCustomize.Destroy;
     1204begin
     1205  Master := nil;
     1206  inherited Destroy;
    11661207end;
    11671208
     
    11711212function TCoolDockWindowList.Execute: Boolean;
    11721213begin
     1214  Form := TCoolDockWindowListForm.Create(Self);
    11731215  Form.ShowModal;
     1216  Form.Free;
    11741217  Result := True;
    11751218end;
     
    11781221begin
    11791222  inherited Create(AOwner);
    1180   Form := TCoolDockWindowListForm.Create(Self);
    11811223end;
    11821224
Note: See TracChangeset for help on using the changeset viewer.