lcl: use message CM_PARENTFONTCHANGED to notify of parent font change. This is Delphi compatible, fixes the order of the font change events and is consistent with the other parent properties notifications: Color, ShowHint, BidiMode

git-svn-id: trunk@23246 -
This commit is contained in:
blikblum 2009-12-24 01:05:47 +00:00
parent 55d2de062f
commit 442c987512
3 changed files with 21 additions and 9 deletions

View File

@ -1113,6 +1113,7 @@ type
procedure CMHintShow(var Message: TLMessage); message CM_HINTSHOW;
procedure CMParentBiDiModeChanged(var Message: TLMessage); message CM_PARENTBIDIMODECHANGED;
procedure CMParentColorChanged(var Message: TLMessage); message CM_PARENTCOLORCHANGED;
procedure CMParentFontChanged(var Message: TLMessage); message CM_PARENTFONTCHANGED;
procedure CMParentShowHintChanged(var Message: TLMessage); message CM_PARENTSHOWHINTCHANGED;
procedure CMVisibleChanged(var Message: TLMessage); message CM_VISIBLECHANGED;
procedure CMTextChanged(var Message: TLMessage); message CM_TEXTCHANGED;

View File

@ -281,11 +281,7 @@ end;
procedure TControl.ParentFontChanged;
begin
if csLoading in ComponentState then exit;
if FParentFont then
Font := FParent.Font;
Perform(CM_PARENTFONTCHANGED, 0, 0);
//kept for compatibility. The real work is done in CMParentFontChanged
end;
procedure TControl.SetAction(Value: TBasicAction);
@ -762,6 +758,21 @@ begin
Color := FParent.Color;
end;
{------------------------------------------------------------------------------
TControl.CMParentFontChanged
assumes: FParent <> nil
------------------------------------------------------------------------------}
procedure TControl.CMParentFontChanged(var Message: TLMessage);
begin
if csLoading in ComponentState then exit;
if FParentFont then
Font := FParent.Font;
//call here for compatibility with older LCL code
ParentFontChanged;
end;
{------------------------------------------------------------------------------
TControl.CMShowHintChanged
@ -3522,7 +3533,7 @@ begin
begin
FParentFont := Value;
if Assigned(FParent) and not (csReading in ComponentState) then
ParentFontChanged;
Perform(CM_PARENTFONTCHANGED, 0, 0);
end;
end;

View File

@ -4546,7 +4546,7 @@ begin
Include(FWinControlFlags, wcfFontChanged);
inherited;
for i := 0 to ControlCount - 1 do
Controls[i].ParentFontChanged;
Controls[i].Perform(CM_PARENTFONTCHANGED, 0, 0);
end;
procedure TWinControl.SetColor(Value: TColor);
@ -5989,7 +5989,7 @@ begin
AControl.Perform(CM_PARENTCOLORCHANGED, 0, 0);
AControl.Perform(CM_PARENTSHOWHINTCHANGED, 0, 0);
AControl.Perform(CM_PARENTBIDIMODECHANGED, 0, 0);
AControl.ParentFontChanged;
AControl.Perform(CM_PARENTFONTCHANGED, 0, 0);
if AControl is TWinControl then
TWinControl(AControl).UpdateControlState
else
@ -7273,7 +7273,7 @@ begin
TWSWinControlClass(WidgetSetClass).SetFont(Self,Font);
NotifyControls(CM_PARENTCOLORCHANGED);
for i := 0 to ControlCount - 1 do
Controls[i].ParentFontChanged;
Controls[i].Perform(CM_PARENTFONTCHANGED, 0, 0);
FWinControlFlags:=FWinControlFlags-[wcfFontChanged];
end;
end;