-
Notifications
You must be signed in to change notification settings - Fork 0
/
resizeprofiles.pas
77 lines (58 loc) · 1.4 KB
/
resizeprofiles.pas
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
69
70
71
72
73
74
75
76
77
unit resizeProfiles;
{
Gère les profils de résolution et les valeurs correspondantes
}
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, globalizationDatas;
type
PResizeProfile = ^TResizeProfile;
TResizeProfile = record
Name: string;
width, height: integer;
end;
{ TResizeProfileList }
TResizeProfileList = class(TList)
private
function Get(Index: integer): PResizeProfile;
function Add(Value: PResizeProfile): integer;
public
constructor Create;
destructor Destroy; override;
procedure AddProfile(_name: string; _width, _height: integer);
property Items[Index: integer]: PResizeProfile read Get; default;
end;
implementation
{ TResizeProfileList }
function TResizeProfileList.Get(Index: integer): PResizeProfile;
begin
Result := PResizeProfile(inherited Get(Index));
end;
destructor TResizeProfileList.Destroy;
var
i: integer;
begin
for i := 0 to Count - 1 do
FreeMem(Items[i]);
inherited;
end;
procedure TResizeProfileList.AddProfile(_name: string; _width, _height: integer);
var
profile: PResizeProfile;
begin
New(profile);
profile^.Name := _name;
profile^.width := _width;
profile^.height := _height;
Add(profile);
end;
constructor TResizeProfileList.Create;
begin
inherited;
end;
function TResizeProfileList.Add(Value: PResizeProfile): integer;
begin
Result := inherited Add(Value);
end;
end.