-
Notifications
You must be signed in to change notification settings - Fork 10
/
DW.VCL.Frame.pas
84 lines (67 loc) · 1.73 KB
/
DW.VCL.Frame.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
78
79
80
81
82
83
84
unit DW.VCL.Frame;
interface
uses Classes, VCL.Controls, DW.VCL.Region, DWElementTag;
type
TDWCustomFrameClass = class of TDWCustomFrame;
TDWCustomFrame = class(TDWRegion)
private
FOnDestroy: TNotifyEvent;
FOnCreate: TNotifyEvent;
procedure SetOnCreate(const Value: TNotifyEvent);
procedure SetOnDestroy(const Value: TNotifyEvent);
protected
procedure AfterConstruction; override;
procedure BeforeDestruction; override;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
published
property OnCreate: TNotifyEvent read FOnCreate write SetOnCreate;
property OnDestroy: TNotifyEvent read FOnDestroy write SetOnDestroy;
end;
TDWFrame = class(TDWCustomFrame)
end;
implementation
uses
DW.VCL.Common, System.RTLConsts;
{ TDWFrame }
procedure TDWCustomFrame.AfterConstruction;
begin
inherited;
if Assigned(FOnCreate) then
FOnCreate(Self);
end;
procedure TDWCustomFrame.BeforeDestruction;
begin
inherited;
if Assigned(FOnDestroy) then
FOnDestroy(Self);
end;
constructor TDWCustomFrame.Create(AOwner: TComponent);
begin
inherited;
ControlStyle := ControlStyle + [csAcceptsControls];
if (ClassType <> TDWCustomFrame) and not(csDesignInstance in ComponentState) then
begin
if not InitInheritedComponent(Self, TDWCustomFrame) then
raise EResNotFound.CreateFmt(SResNotFound, [ClassName]);
end
else
begin
Width := 320;
Height := 240;
end;
end;
destructor TDWCustomFrame.Destroy;
begin
inherited;
end;
procedure TDWCustomFrame.SetOnCreate(const Value: TNotifyEvent);
begin
FOnCreate := Value;
end;
procedure TDWCustomFrame.SetOnDestroy(const Value: TNotifyEvent);
begin
FOnDestroy := Value;
end;
end.