LCL: added TControl.AddHandlerBeforeDestruction

git-svn-id: trunk@35090 -
This commit is contained in:
mattias 2012-02-02 16:46:20 +00:00
parent 1f910951e2
commit aad4d125c5
2 changed files with 30 additions and 1 deletions

View File

@ -872,7 +872,8 @@ type
chtOnVisibleChanged,
chtOnEnabledChanging,
chtOnEnabledChanged,
chtOnKeyDown
chtOnKeyDown,
chtOnBeforeDestruction
);
TLayoutAdjustmentPolicy = (
@ -1118,6 +1119,7 @@ type
procedure SetAccessibleValue(AValue: TCaption);
procedure SetAccessibleRole(AValue: TLazAccessibilityRole);
procedure SetAnchorSide(Kind: TAnchorKind; AValue: TAnchorSide);
procedure SetAnchorSide(AIndex: Integer; AValue: TAnchorSide);
procedure SetBorderSpacing(const AValue: TControlBorderSpacing);
procedure SetBoundsRect(const ARect: TRect);
procedure SetBoundsRectForNewParent(const AValue: TRect);
@ -1455,6 +1457,7 @@ type
public
constructor Create(TheOwner: TComponent);override;
destructor Destroy; override;
procedure BeforeDestruction; override;
procedure EditingDone; virtual;
procedure ExecuteDefaultAction; virtual;
procedure ExecuteCancelAction; virtual;
@ -1521,6 +1524,9 @@ type
procedure AddHandlerOnKeyDown(const OnKeyDownEvent: TKeyEvent;
AsFirst: boolean = false);
procedure RemoveHandlerOnKeyDown(const OnKeyDownEvent: TKeyEvent);
procedure AddHandlerOnBeforeDestruction(const OnBeforeDestructionEvent: TNotifyEvent;
AsFirst: boolean = false);
procedure RemoveHandlerOnBeforeDestruction(const OnBeforeDestructionEvent: TNotifyEvent);
public
// standard properties, which should be supported by all descendants
property AccessibleDescription: TCaption read GetAccessibleDescription write SetAccessibleDescription;

View File

@ -2139,6 +2139,11 @@ begin
GetAnchorSide(Kind).Assign(AValue);
end;
procedure TControl.SetAnchorSide(AIndex: Integer; AValue: TAnchorSide);
begin
end;
procedure TControl.SetBorderSpacing(const AValue: TControlBorderSpacing);
begin
if FBorderSpacing=AValue then exit;
@ -4554,6 +4559,18 @@ begin
RemoveHandler(chtOnKeyDown,TMethod(OnKeyDownEvent));
end;
procedure TControl.AddHandlerOnBeforeDestruction(
const OnBeforeDestructionEvent: TNotifyEvent; AsFirst: boolean);
begin
AddHandler(chtOnBeforeDestruction,TMethod(OnBeforeDestructionEvent));
end;
procedure TControl.RemoveHandlerOnBeforeDestruction(
const OnBeforeDestructionEvent: TNotifyEvent);
begin
RemoveHandler(chtOnBeforeDestruction,TMethod(OnBeforeDestructionEvent));
end;
procedure TControl.RemoveAllHandlersOfObject(AnObject: TObject);
var
HandlerType: TControlHandlerType;
@ -4711,6 +4728,12 @@ begin
{$ENDIF}
end;
procedure TControl.BeforeDestruction;
begin
inherited BeforeDestruction;
DoCallNotifyHandler(chtOnBeforeDestruction);
end;
{------------------------------------------------------------------------------
Method: TControl.Create
Params: None