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

    r56 r57  
    77uses
    88  Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
    9   ComCtrls, StdCtrls;
     9  ComCtrls, StdCtrls, Menus;
    1010
    1111type
     
    2727  public
    2828    procedure LoadList;
     29    procedure LoadToMenuItem(MenuItem: TMenuItem);
    2930  end;
    3031
     
    7576  Form: TForm;
    7677  DockState: string;
     78  IconBitmap: TBitmap;
     79  Mask: TBitmap;
    7780begin
    7881  with ListView1, Items do begin
     
    8184    ImageList1.Clear;
    8285    for I := 0 to Application.ComponentCount - 1 do begin
    83       if Application.Components[I] is TForm then begin
     86      if (Application.Components[I] is TForm) then begin
    8487        Form := (Application.Components[I] as TForm);
    85         NewItem := Add;
    86         NewItem.Caption := Form.Caption;
    87         NewItem.Data := Form;
    88         if Assigned(Form.HostDockSite) then DockState := SStateDocked
    89           else DockState := SStateFloating;
    90         NewItem.SubItems.Add(DockState);
    91         if Form.Visible then DockState := SStateVisible
    92           else DockState := SStateHidden;
    93         NewItem.SubItems.Add(DockState);
    94         ImageList1.AddIcon(Form.Icon);
     88        if Form.DragKind = dkDock then begin
     89          NewItem := Add;
     90          NewItem.Caption := Form.Caption;
     91          NewItem.Data := Form;
     92          if Assigned(Form.HostDockSite) then DockState := SStateDocked
     93            else DockState := SStateFloating;
     94          NewItem.SubItems.Add(DockState);
     95          if Form.Visible then DockState := SStateVisible
     96            else DockState := SStateHidden;
     97          NewItem.SubItems.Add(DockState);
     98
     99          try
     100            Mask := TBitmap.Create;
     101            IconBitmap := TBitmap.Create;
     102            //IconBitmap.SetSize(Form.Icon.Width, Form.Icon.Height);
     103            //ShowMessage(IntToStr(Integer(Form.Icon.TransparentColor)));
     104            IconBitmap.Assign(Form.Icon);
     105          //IconBitmap.Canvas.Draw(0, 0, Form.Icon);
     106
     107            Mask.Assign(Form.Icon);
     108            Mask.Canvas.Brush.Color := Form.Icon.TransparentColor;
     109            Mask.Monochrome := True;
     110            ImageList1.BkColor := clBlack;
     111            ImageList1.Add(IconBitmap, Mask);
     112          finally
     113            Mask.Free;
     114            IconBitmap.Free;
     115          end;
     116
     117          NewItem.ImageIndex := ImageList1.Count - 1;
     118        end;
    95119      end;
    96120    end;
    97121    EndUpdate;
     122  end;
     123end;
     124
     125procedure TCoolDockWindowListForm.LoadToMenuItem(MenuItem: TMenuItem);
     126var
     127  NewMenuItem: TMenuItem;
     128  I: Integer;
     129  Form: TForm;
     130begin
     131  with MenuItem do begin
     132    Clear;
     133    for I := 0 to Application.ComponentCount - 1 do begin
     134      if Application.Components[I] is TForm then begin
     135        Form := (Application.Components[I] as TForm);
     136        NewMenuItem := TMenuItem.Create(MenuItem);
     137        NewMenuItem.Caption := Form.Caption;
     138        MenuItem.Add(NewMenuItem);
     139      end;
     140    end;
    98141  end;
    99142end;
Note: See TracChangeset for help on using the changeset viewer.