lcl: fix Timers class hierarchi. Was: TCustomTimer -> TTimer -> TIdleTimer with published props only in TCustomFirmer. Now: TCustomTimer -> TTimer, TCustomTimer -> TCustomIdleTimer -> TIdleTimer and published props are in TTimer and TIdleTimer.

git-svn-id: trunk@19117 -
This commit is contained in:
paul 2009-03-26 15:09:24 +00:00
parent a6893bb23f
commit 56ae429345
4 changed files with 50 additions and 31 deletions

View File

@ -26,7 +26,7 @@ interface
uses
Classes, SysUtils, LResources, TypInfo, LCLProc, Forms, Controls, Menus,
ExtCtrls, StdCtrls, Graphics, Grids, CheckLst, Buttons, ComCtrls, Dialogs,
ExtCtrls, CustomTimer, StdCtrls, Graphics, Grids, CheckLst, Buttons, ComCtrls, Dialogs,
LazStringGridEdit, CheckListboxEditorDlg, CheckGroupEditorDlg, GraphType, PropEdits,
ObjInspStrConsts;
@ -1200,16 +1200,16 @@ begin
end;
initialization
RegisterComponentEditorProc:=@DefaultRegisterComponentEditorProc;
RegisterComponentEditor(TCustomNotebook,TNotebookComponentEditor);
RegisterComponentEditor(TCustomPage,TPageComponentEditor);
RegisterComponentEditor(TCustomTabControl,TTabControlComponentEditor);
RegisterComponentEditor(TStringGrid,TStringGridComponentEditor);
RegisterComponentEditor(TCheckListBox,TCheckListBoxComponentEditor);
RegisterComponentEditor(TCheckGroup,TCheckGroupComponentEditor);
RegisterComponentEditor(TToolBar,TToolBarComponentEditor);
RegisterComponentEditorProc := @DefaultRegisterComponentEditorProc;
RegisterComponentEditor(TCustomNotebook, TNotebookComponentEditor);
RegisterComponentEditor(TCustomPage, TPageComponentEditor);
RegisterComponentEditor(TCustomTabControl, TTabControlComponentEditor);
RegisterComponentEditor(TStringGrid, TStringGridComponentEditor);
RegisterComponentEditor(TCheckListBox, TCheckListBoxComponentEditor);
RegisterComponentEditor(TCheckGroup, TCheckGroupComponentEditor);
RegisterComponentEditor(TToolBar, TToolBarComponentEditor);
RegisterComponentEditor(TCommonDialog, TCommonDialogComponentEditor);
RegisterComponentEditor(TTimer, TTimerComponentEditor);
RegisterComponentEditor(TCustomTimer, TTimerComponentEditor);
finalization
InternalFinal;

View File

@ -52,7 +52,6 @@ type
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
published
property Enabled: Boolean read FEnabled write SetEnabled default True;
property Interval: Cardinal read FInterval write SetInterval default 1000;
property OnTimer: TNotifyEvent read FOnTimer write SetOnTimer;

View File

@ -314,6 +314,12 @@ type
{ Timer }
TTimer = class (TCustomTimer)
published
property Enabled;
property Interval;
property OnTimer;
property OnStartTimer;
property OnStopTimer;
end;
@ -326,7 +332,7 @@ type
);
TIdleTimerAutoEvents = set of TIdleTimerAutoEvent;
TIdleTimer = class(TTimer)
TCustomIdleTimer = class(TCustomTimer)
private
FAutoEnabled: boolean;
FAutoEndEvent: TIdleTimerAutoEvent;
@ -344,13 +350,26 @@ type
public
constructor Create(TheOwner: TComponent); override;
destructor Destroy; override;
property AutoEnabled: boolean read FAutoEnabled write SetAutoEnabled;
property AutoStartEvent: TIdleTimerAutoEvent
read FAutoStartEvent write SetAutoStartEvent default itaOnIdle;
property AutoEndEvent: TIdleTimerAutoEvent
read FAutoEndEvent write SetAutoEndEvent default itaOnUserInput;
property AutoEnabled: boolean read FAutoEnabled
write SetAutoEnabled default False;
property AutoStartEvent: TIdleTimerAutoEvent read FAutoStartEvent
write SetAutoStartEvent default itaOnIdle;
property AutoEndEvent: TIdleTimerAutoEvent read FAutoEndEvent
write SetAutoEndEvent default itaOnUserInput;
end;
TIdleTimer = class(TCustomIdleTimer)
published
property AutoEnabled;
property AutoStartEvent;
property AutoEndEvent;
property Enabled;
property Interval;
property OnTimer;
property OnStartTimer;
property OnStopTimer;
end;
{ TShape }

View File

@ -8,7 +8,7 @@
* *
* This file is part of the Lazarus Component Library (LCL) *
* *
* See the file COPYING.modifiedLGPL.txt, included in this distribution, *
* See the file COPYING.modifiedLGPL.txt, included in this distribution, *
* for details about the copyright. *
* *
* This program is distributed in the hope that it will be useful, *
@ -21,14 +21,14 @@
{ TIdleTimer }
procedure TIdleTimer.SetAutoEnabled(const AValue: boolean);
procedure TCustomIdleTimer.SetAutoEnabled(const AValue: boolean);
begin
if FAutoEnabled=AValue then exit;
FAutoEnabled:=AValue;
UpdateHandlers;
end;
procedure TIdleTimer.DoOnIdle(Sender: TObject; var Done: Boolean);
procedure TCustomIdleTimer.DoOnIdle(Sender: TObject; var Done: Boolean);
begin
if not AutoEnabled then exit;
// automatic start, stop or restart
@ -38,7 +38,7 @@ begin
Enabled:=true;
end;
procedure TIdleTimer.DoOnIdleEnd(Sender: TObject);
procedure TCustomIdleTimer.DoOnIdleEnd(Sender: TObject);
begin
if not AutoEnabled then exit;
// automatic start, stop or restart
@ -48,7 +48,7 @@ begin
Enabled:=true;
end;
procedure TIdleTimer.DoOnUserInput(Sender: TObject; Msg: Cardinal);
procedure TCustomIdleTimer.DoOnUserInput(Sender: TObject; Msg: Cardinal);
begin
if not AutoEnabled then exit;
// automatic start, stop or restart
@ -58,26 +58,27 @@ begin
Enabled:=true;
end;
procedure TIdleTimer.Loaded;
procedure TCustomIdleTimer.Loaded;
begin
inherited Loaded;
UpdateHandlers;
end;
constructor TIdleTimer.Create(TheOwner: TComponent);
constructor TCustomIdleTimer.Create(TheOwner: TComponent);
begin
inherited Create(TheOwner);
FAutoStartEvent:=itaOnIdle;
FAutoEndEvent:=itaOnUserInput;
FAutoEnabled := False;
FAutoStartEvent := itaOnIdle;
FAutoEndEvent := itaOnUserInput;
end;
destructor TIdleTimer.Destroy;
destructor TCustomIdleTimer.Destroy;
begin
AutoEnabled:=false;
AutoEnabled := False;
inherited Destroy;
end;
procedure TIdleTimer.UpdateHandlers;
procedure TCustomIdleTimer.UpdateHandlers;
begin
if FAutoEnabled
and ([csDesigning,csLoading,csDestroying]*ComponentState=[]) then begin
@ -97,13 +98,13 @@ begin
end;
end;
procedure TIdleTimer.SetAutoEndEvent(const AValue: TIdleTimerAutoEvent);
procedure TCustomIdleTimer.SetAutoEndEvent(const AValue: TIdleTimerAutoEvent);
begin
if FAutoEndEvent=AValue then exit;
FAutoEndEvent:=AValue;
end;
procedure TIdleTimer.SetAutoStartEvent(const AValue: TIdleTimerAutoEvent);
procedure TCustomIdleTimer.SetAutoStartEvent(const AValue: TIdleTimerAutoEvent);
begin
if FAutoStartEvent=AValue then exit;
FAutoStartEvent:=AValue;