From 1c76b3b38f6f3eaf15ceface8a99d64c3085f081 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Sat, 25 Mar 2017 16:24:00 +0100 Subject: picturelistunit neu --- picturelistunit.pas | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 picturelistunit.pas (limited to 'picturelistunit.pas') diff --git a/picturelistunit.pas b/picturelistunit.pas new file mode 100644 index 0000000..a9dd881 --- /dev/null +++ b/picturelistunit.pas @@ -0,0 +1,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. + -- cgit v1.2.3-70-g09d2