mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-22 09:39:31 +02:00
lcl: add TApplicationProperties.OnActivate, OnDeactivate events
git-svn-id: trunk@35503 -
This commit is contained in:
parent
1b0fc1ad3d
commit
2f4158711d
14
lcl/forms.pp
14
lcl/forms.pp
@ -1543,6 +1543,8 @@ type
|
||||
FHintPause: Integer;
|
||||
FHintShortCuts: Boolean;
|
||||
FHintShortPause: Integer;
|
||||
FOnActivate: TNotifyEvent;
|
||||
FOnDeactivate: TNotifyEvent;
|
||||
FOnDropFiles: TDropFilesEvent;
|
||||
FOnGetMainFormHandle: TGetHandleEvent;
|
||||
FOnModalBegin: TNotifyEvent;
|
||||
@ -1579,6 +1581,8 @@ type
|
||||
procedure SetShowMainForm(const AValue: Boolean);
|
||||
procedure SetTitle(const AValue : String);
|
||||
|
||||
procedure SetOnActivate(AValue: TNotifyEvent);
|
||||
procedure SetOnDeactivate(AValue: TNotifyEvent);
|
||||
procedure SetOnException(const AValue : TExceptionEvent);
|
||||
procedure SetOnGetMainFormHandle(const AValue: TGetHandleEvent);
|
||||
procedure SetOnIdle(const AValue : TIdleEvent);
|
||||
@ -1613,16 +1617,18 @@ type
|
||||
property ShowMainForm: Boolean read FShowMainForm write SetShowMainForm default True;
|
||||
property Title: String read FTitle write SetTitle;
|
||||
|
||||
property OnActivate: TNotifyEvent read FOnActivate write SetOnActivate;
|
||||
property OnDeactivate: TNotifyEvent read FOnDeactivate write SetOnDeactivate;
|
||||
property OnException: TExceptionEvent read FOnException write SetOnException;
|
||||
property OnGetMainFormHandle: TGetHandleEvent read FOnGetMainFormHandle write SetOnGetMainFormHandle;
|
||||
property OnIdle: TIdleEvent read FOnIdle write SetOnIdle;
|
||||
property OnIdleEnd: TNotifyEvent read FOnIdleEnd write SetOnIdleEnd;
|
||||
property OnEndSession : TNotifyEvent read FOnEndSession write SetOnEndSession;
|
||||
property OnQueryEndSession : TQueryEndSessionEvent read FOnQueryEndSession write SetOnQueryEndSession;
|
||||
property OnMinimize : TNotifyEvent read FOnMinimize write SetOnMinimize;
|
||||
property OnEndSession: TNotifyEvent read FOnEndSession write SetOnEndSession;
|
||||
property OnQueryEndSession: TQueryEndSessionEvent read FOnQueryEndSession write SetOnQueryEndSession;
|
||||
property OnMinimize: TNotifyEvent read FOnMinimize write SetOnMinimize;
|
||||
property OnModalBegin: TNotifyEvent read FOnModalBegin write SetOnModalBegin;
|
||||
property OnModalEnd: TNotifyEvent read FOnModalEnd write SetOnModalEnd;
|
||||
property OnRestore : TNotifyEvent read FOnRestore write SetOnRestore;
|
||||
property OnRestore: TNotifyEvent read FOnRestore write SetOnRestore;
|
||||
property OnDropFiles: TDropFilesEvent read FOnDropFiles write SetOnDropFiles;
|
||||
property OnHelp: THelpEvent read FOnHelp write SetOnHelp;
|
||||
property OnHint: TNotifyEvent read FOnHint write SetOnHint;
|
||||
|
@ -50,6 +50,28 @@ begin
|
||||
Application.AddOnGetMainFormHandleHandler(FOnGetMainFormHandle);
|
||||
end;
|
||||
|
||||
procedure TApplicationProperties.SetOnActivate(AValue: TNotifyEvent);
|
||||
begin
|
||||
if (TMethod(FOnActivate).Data = TMethod(AValue).Data) and
|
||||
(TMethod(FOnActivate).Code = TMethod(AValue).Code) then Exit;
|
||||
if not (csDesigning in ComponentState) and Assigned(FOnActivate) then
|
||||
Application.RemoveOnActivateHandler(FOnActivate);
|
||||
FOnActivate := AValue;
|
||||
if not (csDesigning in ComponentState) and Assigned(FOnActivate) then
|
||||
Application.AddOnActivateHandler(FOnActivate);
|
||||
end;
|
||||
|
||||
procedure TApplicationProperties.SetOnDeactivate(AValue: TNotifyEvent);
|
||||
begin
|
||||
if (TMethod(FOnDeactivate).Data = TMethod(AValue).Data) and
|
||||
(TMethod(FOnDeactivate).Code = TMethod(AValue).Code) then Exit;
|
||||
if not (csDesigning in ComponentState) and Assigned(FOnDeactivate) then
|
||||
Application.RemoveOnDeactivateHandler(FOnDeactivate);
|
||||
FOnDeactivate := AValue;
|
||||
if not (csDesigning in ComponentState) and Assigned(FOnDeactivate) then
|
||||
Application.AddOnDeactivateHandler(FOnDeactivate);
|
||||
end;
|
||||
|
||||
procedure TApplicationProperties.SetCaptureExceptions(const AValue : boolean);
|
||||
begin
|
||||
FCaptureExceptions := AValue;
|
||||
@ -321,6 +343,8 @@ begin
|
||||
end;
|
||||
FShowMainForm := True;
|
||||
|
||||
FOnActivate := nil;
|
||||
FOnDeactivate := nil;
|
||||
FOnException := nil;
|
||||
FOnGetMainFormHandle := nil;
|
||||
FOnIdle := nil;
|
||||
@ -342,6 +366,8 @@ destructor TApplicationProperties.Destroy;
|
||||
begin
|
||||
if not (csDesigning in ComponentState) then
|
||||
begin
|
||||
Application.RemoveOnActivateHandler(FOnActivate);
|
||||
Application.RemoveOnDeactivateHandler(FOnDeactivate);
|
||||
Application.RemoveOnExceptionHandler(FOnException);
|
||||
Application.RemoveOnGetMainFormHandleHandler(FOnGetMainFormHandle);
|
||||
Application.RemoveOnIdleHandler(FOnIdle);
|
||||
|
Loading…
Reference in New Issue
Block a user