unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Menus;

type
  TForm1 = class(TForm)
    MainMenu1: TMainMenu;
    Plik1: TMenuItem;
    Otworz1: TMenuItem;
    koniec1: TMenuItem;
    Okno1: TMenuItem;
    kaskada1: TMenuItem;
    obok1: TMenuItem;
    oknasasiadujacewpionie1: TMenuItem;
    minimalizujwszystkieokna1: TMenuItem;
    uprzdkujikony1: TMenuItem;
    zamknijwszystkie1: TMenuItem;
    procedure Otworz1Click(Sender: TObject);
    procedure koniec1Click(Sender: TObject);
    procedure zamknijwszystkie1Click(Sender: TObject);
    procedure uprzdkujikony1Click(Sender: TObject);
    procedure minimalizujwszystkieokna1Click(Sender: TObject);
    procedure oknasasiadujacewpionie1Click(Sender: TObject);
    procedure obok1Click(Sender: TObject);
    procedure kaskada1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.kaskada1Click(Sender: TObject);
begin
   Cascade;
end;

procedure TForm1.koniec1Click(Sender: TObject);
begin
   Application.Terminate;
end;

procedure TForm1.minimalizujwszystkieokna1Click(Sender: TObject);
var licz: integer;
begin
////uporzadkuj okna na dole aplikacji,obok siebie tylko paski nazwy
 for licz:=MDIchildcount-1 downto 0 do
   MDIchildren[licz].WindowState:=wsMinimized;
end;

//wyświetlenie okien zminimalizowanych
procedure TForm1.obok1Click(Sender: TObject);
var licz:integer;
begin
  for licz:=0 to MDIchildcount-1 do
   MDIchildren[licz].WindowState:=wsNormal;

  TileMode:=tbHorizontal; Tile;
end;

procedure TForm1.oknasasiadujacewpionie1Click(Sender: TObject);
begin
TileMode:=tbVertical; Tile;
end;

procedure TForm1.Otworz1Click(Sender: TObject);
var fn: TForm;
begin
   fn:=TForm.Create(Self);
   fn.FormStyle:=fsMDIChild;
   fn.Caption:='Nowy';
end;

procedure TForm1.uprzdkujikony1Click(Sender: TObject);
begin
 ArrangeIcons;
end;

procedure TForm1.zamknijwszystkie1Click(Sender: TObject);
var
  I: Integer;
begin
  with Form1 do
    for I := MDIChildCount-1 downto 0 do
      MDIChildren[I].Close;// Destroy;//

end;

end.
