summaryrefslogtreecommitdiff
path: root/picturelistunit.pas
blob: a9dd88135636a51952c9580f507ed6e3ab0a1dbd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
unit picturelistunit;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, ExtCtrls, Graphics;

type
  tMyPictureList = class
  private
    content: tList;
  public
    constructor create;
    destructor destroy;
    procedure addFromFile(s: string);
    procedure saveLastToFile(s: string);
  end;

implementation

constructor tMyPictureList.create;
begin
  inherited create;
  content:=tList.create;
end;

destructor tMyPictureList.destroy;
begin
  content.clear;
  content.free;
  inherited destroy;
end;

procedure tMyPictureList.addFromFile(s: string);
begin
  content.add(tPicture.create);
  last.loadFromFile(s);
end;

function tMyPictureList.last: tPicture;
begin
  result:=items[count-1];
end;

procedure tMyPictureList.delete(idx: int64);
begin
  items[idx].free;
  inherited delete(idx);
end;

procedure tMyPictureList.add;
begin
  inherited add(tPicture.create);
end;

procedure tMyPictureList.clear;
var
  i: longint;
begin
  for i:=0 to count-1 do
    items[i].free;
  inherited clear;
end;

end.