lcl: moved TWinControlActionLink Help attributes to TControlActionLink from Sergei

git-svn-id: trunk@10392 -
This commit is contained in:
mattias 2007-01-08 01:27:21 +00:00
parent eb2bc015d7
commit 312ea10264
5 changed files with 21 additions and 59 deletions

View File

@ -2066,7 +2066,6 @@ end;
Function TSourceEditor.RefreshEditorSettings: Boolean;
Begin
Result:=true;
EditorOpts.
SetSyntaxHighlighterType(fSyntaxHighlighterType);
EditorOpts.GetSynEditSettings(FEditor);
SourceNotebook.UpdateActiveEditColors;

View File

@ -1422,13 +1422,10 @@ type
{ TWinControlActionLink }
TWinControlActionLink = class(TControlActionLink)
protected
procedure AssignClient(AClient: TObject); override;
function IsHelpContextLinked: Boolean; override;
procedure SetHelpContext(Value: THelpContext); override;
end;
// Since HelpContext and HelpKeyword are properties of TControl,
// this class is obsolete. In order not to break existing code,
// its declaration is aliased to TControlActionLink.
TWinControlActionLink = TControlActionLink;
TWinControlActionLinkClass = class of TWinControlActionLink;
@ -1518,9 +1515,6 @@ type
var BoundsModified: Boolean);
protected
FWinControlFlags: TWinControlFlags;
procedure AssignTo(Dest: TPersistent); override;
procedure ActionChange(Sender: TObject; CheckDefaults: Boolean); override;
function GetActionLinkClass: TControlActionLinkClass; override;
procedure AdjustClientRect(var ARect: TRect); virtual;
procedure AlignControls(AControl: TControl;
var RemainingClientRect: TRect); virtual;

View File

@ -591,21 +591,18 @@ end;
------------------------------------------------------------------------------}
function TControl.IsHelpContextStored: boolean;
begin
if ActionLink=nil then
Result := HelpContext<>0
else
Result := not ActionLink.IsHelpContextLinked;
Result := (ActionLink = nil) or not ActionLink.IsHelpLinked;
end;
{------------------------------------------------------------------------------
function TControl.IsHelpKeyWordStored: boolean;
------------------------------------------------------------------------------}
// Using IsHelpContextLinked() for controlling HelpKeyword
// is not correct. Therefore, use IsHelpLinked which means that all 3 Help* properties
// must be equal. Also, this function becomes exactly the same as one just above.
function TControl.IsHelpKeyWordStored: boolean;
begin
if ActionLink=nil then
Result := HelpKeyword<>''
else
Result := not ActionLink.IsHelpContextLinked;
Result := (ActionLink = nil) or not ActionLink.IsHelpLinked;
end;
function TControl.IsOnClickStored: Boolean;
@ -1358,6 +1355,11 @@ begin
Visible := NewAction.Visible;
if not CheckDefaults or not Assigned(OnClick) then
OnClick := NewAction.OnExecute;
if not CheckDefaults or (Self.HelpContext = 0) then
Self.HelpContext := HelpContext;
if not CheckDefaults or (Self.HelpKeyword = '') then
Self.HelpKeyword := HelpKeyword;
// HelpType is set implicitly when assigning HelpContext or HelpKeyword
end;
end;
@ -2624,6 +2626,9 @@ begin
Caption := Self.Caption;
Visible := Self.Visible;
OnExecute := Self.OnClick;
HelpContext := Self.HelpContext;
HelpKeyword := Self.HelpKeyword;
HelpType := Self.HelpType;
end
else inherited AssignTo(Dest);
end;
@ -2925,6 +2930,8 @@ end;
procedure TControl.SetHelpContext(const AValue: THelpContext);
begin
if FHelpContext=AValue then exit;
if not (csLoading in ComponentState) then
FHelpType := htContext;
FHelpContext:=AValue;
end;
@ -2934,6 +2941,8 @@ end;
procedure TControl.SetHelpKeyword(const AValue: String);
begin
if FHelpKeyword=AValue then exit;
if not (csLoading in ComponentState) then
FHelpType := htKeyword;
FHelpKeyword:=AValue;
end;

View File

@ -115,23 +115,4 @@ begin
if IsHelpLinked then FClient.HelpType := Value;
end;
{ TWinControlActionLink }
procedure TWinControlActionLink.AssignClient(AClient: TObject);
begin
inherited AssignClient(AClient);
FClient := AClient as TWinControl;
end;
function TWinControlActionLink.IsHelpContextLinked: Boolean;
begin
// only for Delphi compatibility
Result := IsHelpLinked;
end;
procedure TWinControlActionLink.SetHelpContext(Value: THelpContext);
begin
inherited SetHelpContext(Value);
end;
// included by controls.pp

View File

@ -3629,27 +3629,6 @@ Begin
end;
end;
procedure TWinControl.AssignTo(Dest: TPersistent);
begin
inherited AssignTo(Dest);
if Dest is TCustomAction then
TCustomAction(Dest).HelpContext:=HelpContext;
end;
procedure TWinControl.ActionChange(Sender: TObject; CheckDefaults: Boolean);
begin
inherited ActionChange(Sender,CheckDefaults);
if Sender is TCustomAction then
with TCustomAction(Sender) do
if (not CheckDefaults) or (Self.HelpContext = 0) then
Self.HelpContext := HelpContext;
end;
function TWinControl.GetActionLinkClass: TControlActionLinkClass;
begin
Result := TWinControlActionLink;
end;
{------------------------------------------------------------------------------
TWinControl KeyDown
------------------------------------------------------------------------------}